[NUI] Add xaml binding testcases
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Xaml / TSXamlNode.cs
1 using NUnit.Framework;
2 using System;
3 using System.Collections.Generic;
4 using Tizen.NUI.Xaml;
5
6 namespace Tizen.NUI.Devel.Tests
7 {
8     using tlog = Tizen.Log;
9
10     [TestFixture]
11     [Description("internal/Xaml/ValueNode")]
12     public class InternalValueNodeTest
13     {
14         private const string tag = "NUITEST";
15
16         [SetUp]
17         public void Init()
18         {
19             tlog.Info(tag, "Init() is called!");
20         }
21
22         [TearDown]
23         public void Destroy()
24         {
25             tlog.Info(tag, "Destroy() is called!");
26         }
27
28         [Test]
29         [Category("P1")]
30         [Description("ValueNode Clone")]
31         [Property("SPEC", "Tizen.NUI.Xaml.ValueNode.Clone M")]
32         [Property("SPEC_URL", "-")]
33         [Property("CRITERIA", "MR")]
34         public void ValueNodeCloneTest()
35         {
36             tlog.Debug(tag, $"ValueNodeCloneTest START");
37
38             try
39             {
40                 var node = new ValueNode("1", null, 1, 1);
41                 var ret = node.Clone();
42                 Assert.IsNotNull(ret, "Should not be equal");
43             }
44             catch (Exception e)
45             {
46                 tlog.Debug(tag, e.Message.ToString());
47                 Assert.Fail("Caught Exception : Failed!");
48             }
49
50             tlog.Debug(tag, $"ValueNodeCloneTest END");
51         }
52
53         [Test]
54         [Category("P1")]
55         [Description("MarkupNode Clone")]
56         [Property("SPEC", "Tizen.NUI.Xaml.MarkupNode.Clone M")]
57         [Property("SPEC_URL", "-")]
58         [Property("CRITERIA", "MR")]
59         public void MarkupNodeCloneTest()
60         {
61             tlog.Debug(tag, $"MarkupNodeCloneTest START");
62
63             try
64             {
65                 var node = new MarkupNode("1", null, 1, 1);
66                 var ret = node.Clone();
67                 Assert.IsNotNull(ret, "Should not be equal");
68             }
69             catch (Exception e)
70             {
71                 tlog.Debug(tag, e.Message.ToString());
72                 Assert.Fail("Caught Exception : Failed!");
73             }
74
75             tlog.Debug(tag, $"MarkupNodeCloneTest END");
76         }
77
78         [Test]
79         [Category("P1")]
80         [Description("ElementNode Clone")]
81         [Property("SPEC", "Tizen.NUI.Xaml.ElementNode.Clone M")]
82         [Property("SPEC_URL", "-")]
83         [Property("CRITERIA", "MR")]
84         public void ElementNodeCloneTest()
85         {
86             tlog.Debug(tag, $"ElementNodeCloneTest START");
87
88             try
89             {
90                 var node = new ElementNode(null, "1", null, 1, 1);
91                 node.Properties.Add(new XmlName("1", "View"), new ElementNode(null, "1", null, 1, 1));
92                 node.SkipProperties.Add(new XmlName("1", "View"));
93                 node.CollectionItems.Add(new ElementNode(null, "1", null, 1, 1));
94                 var ret = node.Clone();
95                 Assert.IsNotNull(ret, "Should not be equal");
96             }
97             catch (Exception e)
98             {
99                 tlog.Debug(tag, e.Message.ToString());
100                 Assert.Fail("Caught Exception : Failed!");
101             }
102
103             tlog.Debug(tag, $"ElementNodeCloneTest END");
104         }
105
106         [Test]
107         [Category("P1")]
108         [Description("ListNode Clone")]
109         [Property("SPEC", "Tizen.NUI.Xaml.ListNode.Clone M")]
110         [Property("SPEC_URL", "-")]
111         [Property("CRITERIA", "MR")]
112         public void ListNodeCloneTest()
113         {
114             tlog.Debug(tag, $"ListNodeCloneTest START");
115
116             try
117             {
118                 List<INode> nodes = new List<INode>() { new ElementNode(null, "1", null, 1, 1) };
119                 var node = new ListNode(nodes, null, 1, 1);
120                 var ret = node.Clone();
121                 Assert.IsNotNull(ret, "Should not be equal");
122             }
123             catch (Exception e)
124             {
125                 tlog.Debug(tag, e.Message.ToString());
126                 Assert.Fail("Caught Exception : Failed!");
127             }
128
129             tlog.Debug(tag, $"ListNodeCloneTest END");
130         }
131
132         [Test]
133         [Category("P1")]
134         [Description("ListNode Clone")]
135         [Property("SPEC", "Tizen.NUI.Xaml.INodeExtensions.Clone M")]
136         [Property("SPEC_URL", "-")]
137         [Property("CRITERIA", "MR")]
138         public void INodeExtensionsSkipPrefixTest()
139         {
140             tlog.Debug(tag, $"INodeExtensionsSkipPrefixTest START");
141
142             try
143             {
144                 var node = new ElementNode(null, "1", null, 1, 1);
145                 node.IgnorablePrefixes = new List<string>() { "1" };
146                 var ret = node.SkipPrefix("1");
147                 
148                 Assert.True(ret, "Should be true");
149             }
150             catch (Exception e)
151             {
152                 tlog.Debug(tag, e.Message.ToString());
153                 Assert.Fail("Caught Exception : Failed!");
154             }
155
156             tlog.Debug(tag, $"INodeExtensionsSkipPrefixTest END");
157         }
158     }
159 }