1 using NUnit.Framework;
3 using System.Collections.Generic;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("internal/Xaml/NamescopingVisitor")]
13 internal class PublicNamescopingVisitorTest
15 private const string tag = "NUITEST";
16 private static NamescopingVisitor n1;
21 tlog.Info(tag, "Init() is called!");
22 HydrationContext context = new HydrationContext();
23 NamescopingVisitor n1 = new NamescopingVisitor(context);
30 tlog.Info(tag, "Destroy() is called!");
35 [Description("NamescopingVisitor NamescopingVisitor")]
36 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.NamescopingVisitor C")]
37 [Property("SPEC_URL", "-")]
38 [Property("CRITERIA", "CONSTR")]
39 public void NamescopingVisitorConstructor()
41 tlog.Debug(tag, $"NamescopingVisitorConstructor START");
43 HydrationContext context = new HydrationContext();
45 NamescopingVisitor namescoping = new NamescopingVisitor(context);
47 tlog.Debug(tag, $"NamescopingVisitorConstructor END (OK)");
48 Assert.Pass("NamescopingVisitorConstructor");
53 [Description("NamescopingVisitor VisitingMode")]
54 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.VisitingMode A")]
55 [Property("SPEC_URL", "-")]
56 [Property("CRITERIA", "PRW")]
57 public void NamescopingVisitorVisitingMode()
59 tlog.Debug(tag, $"NamescopingVisitorVisitingMode START");
63 TreeVisitingMode t1 = n1.VisitingMode;
67 tlog.Debug(tag, e.Message.ToString());
68 tlog.Debug(tag, $"NamescopingVisitorVisitingMode END (OK)");
69 Assert.Pass("Caught Exception : passed!");
76 [Description("NamescopingVisitor StopOnDataTemplate")]
77 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnDataTemplate A")]
78 [Property("SPEC_URL", "-")]
79 [Property("CRITERIA", "PRW")]
80 public void NamescopingVisitorStopOnDataTemplate()
82 tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate START");
86 bool b1 = n1.StopOnDataTemplate;
90 tlog.Debug(tag, e.Message.ToString());
91 tlog.Debug(tag, $"NamescopingVisitorStopOnDataTemplate END (OK)");
92 Assert.Pass("Caught Exception : passed!");
99 [Description("NamescopingVisitor StopOnResourceDictionary")]
100 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.StopOnResourceDictionary A")]
101 [Property("SPEC_URL", "-")]
102 [Property("CRITERIA", "PRW")]
103 public void NamescopingVisitorStopOnResourceDictionary()
105 tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary START");
109 bool b1 = n1.StopOnResourceDictionary;
113 tlog.Debug(tag, e.Message.ToString());
114 tlog.Debug(tag, $"NamescopingVisitorStopOnResourceDictionary END (OK)");
115 Assert.Pass("Caught Exception : passed!");
122 [Description("NamescopingVisitor VisitNodeOnDataTemplate")]
123 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.VisitNodeOnDataTemplate A")]
124 [Property("SPEC_URL", "-")]
125 [Property("CRITERIA", "PRW")]
126 public void NamescopingVisitorVisitNodeOnDataTemplate()
128 tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate START");
132 bool b1 = n1.VisitNodeOnDataTemplate;
136 tlog.Debug(tag, e.Message.ToString());
137 tlog.Debug(tag, $"NamescopingVisitorVisitNodeOnDataTemplate END (OK)");
138 Assert.Pass("Caught Exception : passed!");
143 public class INodeImplement : INode
145 public List<string> IgnorablePrefixes { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
147 public IXmlNamespaceResolver NamespaceResolver => throw new NotImplementedException();
149 public INode Parent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
151 public void Accept(IXamlNodeVisitor visitor, INode parentNode)
153 throw new NotImplementedException();
158 throw new NotImplementedException();
164 [Description("NamescopingVisitor SkipChildren")]
165 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.SkipChildren M")]
166 [Property("SPEC_URL", "-")]
167 [Property("CRITERIA", "MR")]
168 public void NamescopingVisitorSkipChildren()
170 tlog.Debug(tag, $"NamescopingVisitorSkipChildren START");
174 INodeImplement nodeImplement = new INodeImplement();
175 INodeImplement parentNode = new INodeImplement();
177 n1.SkipChildren(nodeImplement, parentNode);
182 tlog.Debug(tag, e.Message.ToString());
183 tlog.Debug(tag, $"NamescopingVisitorSkipChildren END (OK)");
184 Assert.Pass("Caught Exception : passed!");
189 public class IXmlNamespaceResolverImplement : IXmlNamespaceResolver
191 public IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
196 public string LookupNamespace(string prefix)
198 return "mynamespaceName";
201 public string LookupPrefix(string namespaceName)
209 [Description("NamescopingVisitor IsResourceDictionary")]
210 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.IsResourceDictionary M")]
211 [Property("SPEC_URL", "-")]
212 [Property("CRITERIA", "MR")]
213 public void NamescopingVisitorIsResourceDictionary()
215 tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary START");
219 IList<XmlType> list = null;
220 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
222 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
223 ElementNode e1 = new ElementNode(xmlType, "myNameSpace", i1);
225 bool b1 = n1.IsResourceDictionary(e1);
229 tlog.Debug(tag, e.Message.ToString());
230 tlog.Debug(tag, $"NamescopingVisitorIsResourceDictionary END (OK)");
231 Assert.Pass("Caught Exception : passed!");
235 public class RootNodeImplement : RootNode
237 public RootNodeImplement(XmlType xmlType, IXmlNamespaceResolver nsResolver) : base(xmlType, nsResolver)
244 [Description("NamescopingVisitor Visit")]
245 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
246 [Property("SPEC_URL", "-")]
247 [Property("CRITERIA", "MR")]
248 public void NamescopingVisitorVisit1()
250 tlog.Debug(tag, $"NamescopingVisitorVisit START");
254 object o1 = new object();
255 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
256 ValueNode node = new ValueNode(o1, i1);
258 INodeImplement parentNode = new INodeImplement();
259 n1.Visit(node, parentNode);
263 tlog.Debug(tag, e.Message.ToString());
264 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
265 Assert.Pass("Caught Exception : passed!");
271 [Description("NamescopingVisitor Visit")]
272 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
273 [Property("SPEC_URL", "-")]
274 [Property("CRITERIA", "MR")]
275 public void NamescopingVisitorVisit2()
277 tlog.Debug(tag, $"NamescopingVisitorVisit START");
281 INodeImplement parentNode = new INodeImplement();
282 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
283 MarkupNode markupnode = new MarkupNode("markup", i1);
284 n1.Visit(markupnode, parentNode);
290 tlog.Debug(tag, e.Message.ToString());
291 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
292 Assert.Pass("Caught Exception : passed!");
298 [Description("NamescopingVisitor Visit")]
299 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
300 [Property("SPEC_URL", "-")]
301 [Property("CRITERIA", "MR")]
302 public void NamescopingVisitorVisit3()
304 tlog.Debug(tag, $"NamescopingVisitorVisit START");
308 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
309 INodeImplement parentNode = new INodeImplement();
311 IList<XmlType> list = null;
312 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
314 ElementNode e1 = new ElementNode(xmlType, "myNameSpace", i1);
316 n1.Visit(e1, parentNode);
320 tlog.Debug(tag, e.Message.ToString());
321 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
322 Assert.Pass("Caught Exception : passed!");
328 [Description("NamescopingVisitor Visit")]
329 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
330 [Property("SPEC_URL", "-")]
331 [Property("CRITERIA", "MR")]
332 public void NamescopingVisitorVisit4()
334 tlog.Debug(tag, $"NamescopingVisitorVisit START");
338 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
340 INodeImplement parentNode = new INodeImplement();
342 IList<XmlType> list = null;
343 XmlType xmlType = new XmlType("myNameSpace", "myName", list);
344 RootNodeImplement rootNode = new RootNodeImplement(xmlType, i1);
345 n1.Visit(rootNode, parentNode);
349 tlog.Debug(tag, e.Message.ToString());
350 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
351 Assert.Pass("Caught Exception : passed!");
357 [Description("NamescopingVisitor Visit")]
358 [Property("SPEC", "Tizen.NUI.NamescopingVisitor.Visit M")]
359 [Property("SPEC_URL", "-")]
360 [Property("CRITERIA", "MR")]
361 public void NamescopingVisitorVisit5()
363 tlog.Debug(tag, $"NamescopingVisitorVisit START");
367 IXmlNamespaceResolverImplement i1 = new IXmlNamespaceResolverImplement();
368 INodeImplement parentNode = new INodeImplement();
370 IList<INode> nodes = null;
371 ListNode li = new ListNode(nodes, i1);
372 n1.Visit(li, parentNode);
376 tlog.Debug(tag, e.Message.ToString());
377 tlog.Debug(tag, $"NamescopingVisitorVisit END (OK)");
378 Assert.Pass("Caught Exception : passed!");