e573b8079922b291431c5af2df3711d8ec691868
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Xaml / TSHydrationContext.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/HydrationContext")]
12     internal class PublicHydrationContextTest
13     {
14         private const string tag = "NUITEST";
15         private static HydrationContext h1;
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21             h1 = new HydrationContext();
22         }
23
24         [TearDown]
25         public void Destroy()
26         {
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("HydrationContext Values")]
33         [Property("SPEC", "Tizen.NUI.HydrationContext.Values A")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "PRW")]
36         public void HydrationContextValues()
37         {
38             tlog.Debug(tag, $"HydrationContextValues START");
39
40             try
41             {
42                 Dictionary<INode, object> d1 = h1.Values;
43             }
44             catch (Exception e)
45             {
46                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
47                 Assert.Fail("Caught Exception" + e.ToString());
48             }
49
50             tlog.Debug(tag, $"HydrationContextValues END (OK)");
51             Assert.Pass("HydrationContextValues");
52         }
53
54         [Test]
55         [Category("P1")]
56         [Description("HydrationContext Types")]
57         [Property("SPEC", "Tizen.NUI.HydrationContext.Types A")]
58         [Property("SPEC_URL", "-")]
59         [Property("CRITERIA", "PRW")]
60         public void HydrationContextTypes()
61         {
62             tlog.Debug(tag, $"HydrationContextTypes START");
63
64             try
65             {
66                 Dictionary<IElementNode, Type> d1 = h1.Types;
67             }
68             catch (Exception e)
69             {
70                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
71                 Assert.Fail("Caught Exception" + e.ToString());
72             }
73
74             tlog.Debug(tag, $"HydrationContextTypes END (OK)");
75             Assert.Pass("HydrationContextTypes");
76         }
77
78         [Test]
79         [Category("P1")]
80         [Description("HydrationContext ParentContext")]
81         [Property("SPEC", "Tizen.NUI.HydrationContext.ParentContext A")]
82         [Property("SPEC_URL", "-")]
83         [Property("CRITERIA", "PRW")]
84         public void HydrationContextParentContext()
85         {
86             tlog.Debug(tag, $"HydrationContextParentContext START");
87
88             try
89             {
90                 HydrationContext hy1 = h1.ParentContext;
91                 h1.ParentContext = hy1;
92             }
93             catch (Exception e)
94             {
95                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
96                 Assert.Fail("Caught Exception" + e.ToString());
97             }
98
99             tlog.Debug(tag, $"HydrationContextParentContext END (OK)");
100             Assert.Pass("HydrationContextParentContext");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("HydrationContext ExceptionHandler")]
106         [Property("SPEC", "Tizen.NUI.HydrationContext.ExceptionHandler A")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "PRW")]
109         public void HydrationContextExceptionHandler()
110         {
111             tlog.Debug(tag, $"HydrationContextExceptionHandler START");
112
113             try
114             {
115                 Action<Exception> a1 = h1.ExceptionHandler;
116                 h1.ExceptionHandler = a1;
117             }
118             catch (Exception e)
119             {
120                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
121                 Assert.Fail("Caught Exception" + e.ToString());
122             }
123
124             tlog.Debug(tag, $"HydrationContextExceptionHandler END (OK)");
125             Assert.Pass("HydrationContextExceptionHandler");
126         }
127     }
128 }