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