d0b632674afc93d230e8fbbb44a7de7584ac0772
[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     internal class PublicXamlResourceIdAttributeTest
13     {
14         private const string tag = "NUITEST";
15         private static XamlResourceIdAttribute resourceIdAttribute;
16         [SetUp]
17         public void Init()
18         {
19             tlog.Info(tag, "Init() is called!");
20             resourceIdAttribute = new XamlResourceIdAttribute("myId", "myPath", typeof(string));
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             resourceIdAttribute = null;
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("XamlResourceIdAttribute XamlResourceIdAttribute")]
33         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.XamlResourceIdAttribute C")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "CONSTR")]
36         public void XamlResourceIdAttributeConstructor()
37         {
38             tlog.Debug(tag, $"XamlResourceIdAttributeConstructor START");
39
40             XamlResourceIdAttribute x1 = new XamlResourceIdAttribute("myId", "myPath", typeof(string));
41
42             tlog.Debug(tag, $"XamlResourceIdAttributeConstructor END (OK)");
43             Assert.Pass("XamlResourceIdAttributeConstructor");
44         }
45
46         [Test]
47         [Category("P1")]
48         [Description("XamlResourceIdAttribute ResourceId")]
49         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.ResourceId A")]
50         [Property("SPEC_URL", "-")]
51         [Property("CRITERIA", "PRW")]
52         public void XamlResourceIdAttributeResourceId()
53         {
54             tlog.Debug(tag, $"XamlResourceIdAttributeResourceId START");
55
56             try
57             {
58                 string s1 = resourceIdAttribute.ResourceId;
59                 resourceIdAttribute.ResourceId = s1;
60             }
61             catch (Exception e)
62             {
63                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
64                 Assert.Fail("Caught Exception" + e.ToString());
65             }
66
67             tlog.Debug(tag, $"XamlResourceIdAttributeResourceId END (OK)");
68             Assert.Pass("XamlResourceIdAttributeResourceId");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("XamlResourceIdAttribute Path")]
74         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.Path A")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "PRW")]
77         public void XamlResourceIdAttributePath()
78         {
79             tlog.Debug(tag, $"XamlResourceIdAttributePath START");
80
81             try
82             {
83                 string s1 = resourceIdAttribute.Path;
84                 resourceIdAttribute.Path = s1;
85             }
86             catch (Exception e)
87             {
88                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
89                 Assert.Fail("Caught Exception" + e.ToString());
90             }
91
92             tlog.Debug(tag, $"XamlResourceIdAttributePath END (OK)");
93             Assert.Pass("XamlResourceIdAttributePath");
94         }
95
96         [Test]
97         [Category("P1")]
98         [Description("XamlResourceIdAttribute Type")]
99         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.Type A")]
100         [Property("SPEC_URL", "-")]
101         [Property("CRITERIA", "PRW")]
102         public void XamlResourceIdAttributeType()
103         {
104             tlog.Debug(tag, $"XamlResourceIdAttributeType START");
105
106             try
107             {
108                 Type t1 = resourceIdAttribute.Type;
109                 resourceIdAttribute.Type = t1;
110             }
111             catch (Exception e)
112             {
113                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
114                 Assert.Fail("Caught Exception" + e.ToString());
115             }
116
117             tlog.Debug(tag, $"XamlResourceIdAttributeType END (OK)");
118             Assert.Pass("XamlResourceIdAttributeType");
119         }
120
121         [Test]
122         [Category("P1")]
123         [Description("XamlResourceIdAttribute GetResourceIdForType")]
124         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetResourceIdForType M")]
125         [Property("SPEC_URL", "-")]
126         [Property("CRITERIA", "MR")]
127         public void XamlResourceIdAttributeGetResourceIdForType()
128         {
129             tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForType START");
130
131             try
132             {
133                 XamlResourceIdAttribute.GetResourceIdForType(typeof(string));
134             }
135             catch (Exception e)
136             {
137                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
138                 Assert.Fail("Caught Exception" + e.ToString());
139             }
140
141             tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForType END (OK)");
142             Assert.Pass("XamlResourceIdAttributeGetResourceIdForType");
143         }
144
145         [Test]
146         [Category("P1")]
147         [Description("XamlResourceIdAttribute GetPathForType")]
148         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetPathForType M")]
149         [Property("SPEC_URL", "-")]
150         [Property("CRITERIA", "MR")]
151         public void XamlResourceIdAttributeGetPathForType()
152         {
153             tlog.Debug(tag, $"XamlResourceIdAttributeGetPathForType START");
154
155             try
156             {
157                 XamlResourceIdAttribute.GetPathForType(typeof(string));
158             }
159             catch (Exception e)
160             {
161                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
162                 Assert.Fail("Caught Exception" + e.ToString());
163             }
164
165             tlog.Debug(tag, $"XamlResourceIdAttributeGetPathForType END (OK)");
166             Assert.Pass("XamlResourceIdAttributeGetPathForType");
167         }
168
169         private class AssemblyImplent : Assembly
170         {
171             public override object[] GetCustomAttributes(bool inherit)
172             {
173                 return null;
174             }
175         }
176
177         [Test]
178         [Category("P1")]
179         [Description("XamlResourceIdAttribute GetTypeForResourceId")]
180         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetTypeForResourceId M")]
181         [Property("SPEC_URL", "-")]
182         [Property("CRITERIA", "MR")]
183         public void XamlResourceIdAttributeGetTypeForResourceId()
184         {
185             tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId START");
186
187             try
188             {
189                 AssemblyImplent assembly = new AssemblyImplent();
190                 XamlResourceIdAttribute.GetTypeForResourceId(assembly, "myResourceId");
191             }
192             catch (Exception e)
193             {
194                 tlog.Debug(tag, e.Message.ToString());
195                 tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForResourceId END (OK)");
196                 Assert.Pass("Caught Exception : passed!");
197             }
198         }
199
200         [Test]
201         [Category("P1")]
202         [Description("XamlResourceIdAttribute GetResourceIdForPath")]
203         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetResourceIdForPath M")]
204         [Property("SPEC_URL", "-")]
205         [Property("CRITERIA", "MR")]
206         public void XamlResourceIdAttributeGetResourceIdForPath()
207         {
208             tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForPath START");
209
210             try
211             {
212                 AssemblyImplent assembly = new AssemblyImplent();
213                 XamlResourceIdAttribute.GetResourceIdForPath(assembly, "myPath");
214             }
215             catch (Exception e)
216             {
217                 tlog.Debug(tag, e.Message.ToString());
218                 tlog.Debug(tag, $"XamlResourceIdAttributeGetResourceIdForPath END (OK)");
219                 Assert.Pass("Caught Exception : passed!");
220             }
221         }
222
223         [Test]
224         [Category("P1")]
225         [Description("XamlResourceIdAttribute GetTypeForPath")]
226         [Property("SPEC", "Tizen.NUI.XamlResourceIdAttribute.GetTypeForPath M")]
227         [Property("SPEC_URL", "-")]
228         [Property("CRITERIA", "MR")]
229         public void XamlResourceIdAttributeGetTypeForPath()
230         {
231             tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath START");
232
233             try
234             {
235                 AssemblyImplent assembly = new AssemblyImplent();
236                 XamlResourceIdAttribute.GetTypeForPath(assembly, "myPath");
237             }
238             catch (Exception e)
239             {
240                 tlog.Debug(tag, e.Message.ToString());
241                 tlog.Debug(tag, $"XamlResourceIdAttributeGetTypeForPath END (OK)");
242                 Assert.Pass("Caught Exception : passed!");
243             }
244         }
245     }
246 }