3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6 using System.Reflection;
7 using System.Collections.Generic;
8 using Tizen.NUI.Binding;
10 namespace Tizen.NUI.Devel.Tests
12 using tlog = Tizen.Log;
15 [Description("internal/XamlBinding/BindingExpression")]
16 public class InternalBindingExpressionTest
18 private const string tag = "NUITEST";
19 private string selfpath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Test_View.xaml";
24 tlog.Info(tag, "Init() is called!");
30 tlog.Info(tag, "Destroy() is called!");
35 [Description("BindingExpression constructor")]
36 [Property("SPEC", "Tizen.NUI.BindingExpression.BindingExpression C")]
37 [Property("SPEC_URL", "-")]
38 [Property("CRITERIA", "CONSTR")]
39 public void BindingExpressionConstructor()
41 tlog.Debug(tag, $"BindingExpressionConstructor START");
43 var testingTarget = new BindingExpression(new TemplateBinding(), selfpath);
44 Assert.IsNotNull(testingTarget, "Can't create success object BindingExpression.");
45 Assert.IsInstanceOf<BindingExpression>(testingTarget, "Should return BindingExpression instance.");
47 tlog.Debug(tag, "Binding : " + testingTarget.Binding);
49 tlog.Debug(tag, $"BindingExpressionConstructor END");
54 [Description("BindingExpression constructor")]
55 [Property("SPEC", "Tizen.NUI.BindingExpression.BindingExpression C")]
56 [Property("SPEC_URL", "-")]
57 [Property("CRITERIA", "CONSTR")]
58 public void BindingExpressionConstructorNullBinding()
60 tlog.Debug(tag, $"BindingExpressionConstructorNullBinding START");
62 BindingBase binding = null;
65 var testingTarget = new BindingExpression(binding, selfpath);
67 catch (ArgumentNullException)
69 tlog.Debug(tag, $"BindingExpressionConstructorNullBinding END");
70 Assert.Pass("Caught ArgumentNullException : Passed!");
76 [Description("BindingExpression constructor")]
77 [Property("SPEC", "Tizen.NUI.BindingExpression.BindingExpression C")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "CONSTR")]
80 public void BindingExpressionConstructorNullPath()
82 tlog.Debug(tag, $"BindingExpressionConstructorNullPath START");
86 var testingTarget = new BindingExpression(new TemplateBinding(), null);
88 catch (ArgumentNullException)
90 tlog.Debug(tag, $"BindingExpressionConstructorNullPath END");
91 Assert.Pass("Caught ArgumentNullException : Passed!");
97 [Description("BindingExpression Apply")]
98 [Property("SPEC", "Tizen.NUI.BindingExpression.Apply M")]
99 [Property("SPEC_URL", "-")]
100 [Property("CRITERIA", "MR")]
101 public void BindingExpressionApplyNullSource()
103 tlog.Debug(tag, $"BindingExpressionApplyNullSource START");
105 var testingTarget = new BindingExpression(new TemplateBinding(), selfpath);
106 Assert.IsNotNull(testingTarget, "Can't create success object BindingExpression.");
107 Assert.IsInstanceOf<BindingExpression>(testingTarget, "Should return BindingExpression instance.");
111 testingTarget.Apply(false);
115 tlog.Debug(tag, e.Message.ToString());
116 Assert.Fail("Caught Exception : Failed!");
119 tlog.Debug(tag, $"BindingExpressionApplyNullSource END");
124 [Description("BindingExpression Apply")]
125 [Property("SPEC", "Tizen.NUI.BindingExpression.Apply M")]
126 [Property("SPEC_URL", "-")]
127 [Property("CRITERIA", "MR")]
128 public void BindingExpressionApply()
130 tlog.Debug(tag, $"BindingExpressionApply START");
132 var testingTarget = new BindingExpression(new TemplateBinding(), selfpath);
133 Assert.IsNotNull(testingTarget, "Can't create success object BindingExpression.");
134 Assert.IsInstanceOf<BindingExpression>(testingTarget, "Should return BindingExpression instance.");
138 using (View view = new View() { Color = Color.Red })
140 using (View preView = new View() { Color = Color.Cyan })
142 BindableProperty property = BindableProperty.Create("myProperty", typeof(string), typeof(View), null, BindingMode.OneWay,
143 null, null, null, null, null);
145 testingTarget.Apply(view, preView, property);
146 testingTarget.Apply(true);
147 testingTarget.Apply(false);
148 testingTarget.Unapply();
154 tlog.Debug(tag, e.Message.ToString());
155 Assert.Fail("Caught Exception : Failed!");
158 tlog.Debug(tag, $"BindingExpressionApply END");