[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / TSXamlResourceIdAttribute.cs
1 using NUnit.Framework;
2 using System;
3 using System.Reflection;
4 using Tizen.NUI.Xaml;
5
6 namespace Tizen.NUI.Devel.Tests
7 {
8     using tlog = Tizen.Log;
9
10     [TestFixture]
11     [Description("public/xaml/XamlResourceIdAttribute ")]
12     public class PublicXamlResourceIdAttributeTest
13     {
14         private const string tag = "NUITEST";
15         private XamlResourceIdAttribute resourceId;
16         [SetUp]
17         public void Init()
18         {
19             tlog.Info(tag, "Init() is called!");
20             resourceId = new XamlResourceIdAttribute("myId", "myPath", typeof(string));
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             resourceId = null;
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("XamlResourceIdAttribute ResourceId")]
33         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.ResourceId A")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "PRW")]
36         public void XamlResourceIdAttributeResourceId()
37         {
38             tlog.Debug(tag, $"XamlResourceIdAttributeResourceId START");
39
40             try
41             {
42                 var id = resourceId.ResourceId;
43                 resourceId.ResourceId = id;
44                 Assert.AreEqual(id, resourceId.ResourceId, "Should be equal");
45             }
46             catch (Exception e)
47             {
48                 tlog.Debug(tag, e.Message.ToString());
49                 Assert.Fail("Caught Exception : Failed!");
50             }
51
52             tlog.Debug(tag, $"XamlResourceIdAttributeResourceId END");
53         }
54
55         [Test]
56         [Category("P1")]
57         [Description("XamlResourceIdAttribute Path")]
58         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.Path A")]
59         [Property("SPEC_URL", "-")]
60         [Property("CRITERIA", "PRW")]
61         public void XamlResourceIdAttributePath()
62         {
63             tlog.Debug(tag, $"XamlResourceIdAttributePath START");
64
65             try
66             {
67                 var path = resourceId.Path;
68                 resourceId.Path = path;
69                 Assert.AreEqual(path, resourceId.Path, "Should be equal");
70             }
71             catch (Exception e)
72             {
73                 tlog.Debug(tag, e.Message.ToString());
74                 Assert.Fail("Caught Exception : Failed!");
75             }
76
77             tlog.Debug(tag, $"XamlResourceIdAttributePath END");
78         }
79
80         [Test]
81         [Category("P1")]
82         [Description("XamlResourceIdAttribute Type")]
83         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.Type A")]
84         [Property("SPEC_URL", "-")]
85         [Property("CRITERIA", "PRW")]
86         public void XamlResourceIdAttributeType()
87         {
88             tlog.Debug(tag, $"XamlResourceIdAttributeType START");
89
90             try
91             {
92                 var type = resourceId.Type;
93                 resourceId.Type = type;
94                 Assert.AreEqual(type, resourceId.Type, "Should be equal");
95             }
96             catch (Exception e)
97             {
98                 tlog.Debug(tag, e.Message.ToString());
99                 Assert.Fail("Caught Exception : Failed!");
100             }
101
102             tlog.Debug(tag, $"XamlResourceIdAttributeType END");
103             Assert.Pass("XamlResourceIdAttributeType");
104         }
105
106         [Test]
107         [Category("P1")]
108         [Description("XamlResourceIdAttribute GetResourceIdForType")]
109         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetResourceIdForType M")]
110         [Property("SPEC_URL", "-")]
111         [Property("CRITERIA", "MR")]
112         public void XamlResourceIdAttributeGetResourceIdForType()
113         {
114             tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForType START");
115
116             try
117             {
118                 XamlResourceIdAttribute.GetResourceIdForType(typeof(string));
119             }
120             catch (Exception e)
121             {
122                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
123                 Assert.Fail("Caught Exception" + e.ToString());
124             }
125
126             tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForType END");
127         }
128
129         [Test]
130         [Category("P1")]
131         [Description("XamlResourceIdAttribute GetPathForType")]
132         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetPathForType M")]
133         [Property("SPEC_URL", "-")]
134         [Property("CRITERIA", "MR")]
135         public void XamlResourceIdAttributeGetPathForType()
136         {
137             tlog.Debug(tag, $"XamlResourceIdAttributeGetPathForType START");
138
139             try
140             {
141                 XamlResourceIdAttribute.GetPathForType(typeof(string));
142             }
143             catch (Exception e)
144             {
145                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
146                 Assert.Fail("Caught Exception" + e.ToString());
147             }
148
149             tlog.Debug(tag, $"XamlResourceIdAttributeGetPathForType END");
150         }
151     }
152 }