bf177838c58aa1e6630b13f2f0c3b4f3126466eb
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Xaml / TSReflectionExtensions.cs
1 using NUnit.Framework;
2 using System;
3 using Tizen.NUI.Binding.Internals;
4
5 namespace Tizen.NUI.Devel.Tests
6 {
7     using tlog = Tizen.Log;
8
9     [TestFixture]
10     [Description("internal/Xaml/ReflectionExtensions")]
11     internal class PublicReflectionExtensionsTest
12     {
13         private const string tag = "NUITEST";
14
15         [SetUp]
16         public void Init()
17         {
18             tlog.Info(tag, "Init() is called!");
19         }
20
21         [TearDown]
22         public void Destroy()
23         {
24             tlog.Info(tag, "Destroy() is called!");
25         }
26
27         private class TypeImplement : Type
28         {
29             public override global::System.Reflection.Assembly Assembly => throw new NotImplementedException();
30
31             public override string AssemblyQualifiedName => throw new NotImplementedException();
32
33             public override Type BaseType => throw new NotImplementedException();
34
35             public override string FullName => throw new NotImplementedException();
36
37             public override Guid GUID => throw new NotImplementedException();
38
39             public override global::System.Reflection.Module Module => throw new NotImplementedException();
40
41             public override string Namespace => throw new NotImplementedException();
42
43             public override Type UnderlyingSystemType => throw new NotImplementedException();
44
45             public override string Name => throw new NotImplementedException();
46
47             public override global::System.Reflection.ConstructorInfo[] GetConstructors(global::System.Reflection.BindingFlags bindingAttr)
48             {
49                 throw new NotImplementedException();
50             }
51
52             public override object[] GetCustomAttributes(bool inherit)
53             {
54                 throw new NotImplementedException();
55             }
56
57             public override object[] GetCustomAttributes(Type attributeType, bool inherit)
58             {
59                 throw new NotImplementedException();
60             }
61
62             public override Type GetElementType()
63             {
64                 throw new NotImplementedException();
65             }
66
67             public override global::System.Reflection.EventInfo GetEvent(string name, global::System.Reflection.BindingFlags bindingAttr)
68             {
69                 throw new NotImplementedException();
70             }
71
72             public override global::System.Reflection.EventInfo[] GetEvents(global::System.Reflection.BindingFlags bindingAttr)
73             {
74                 throw new NotImplementedException();
75             }
76
77             public override global::System.Reflection.FieldInfo GetField(string name, global::System.Reflection.BindingFlags bindingAttr)
78             {
79                 throw new NotImplementedException();
80             }
81
82             public override global::System.Reflection.FieldInfo[] GetFields(global::System.Reflection.BindingFlags bindingAttr)
83             {
84                 throw new NotImplementedException();
85             }
86
87             public override Type GetInterface(string name, bool ignoreCase)
88             {
89                 throw new NotImplementedException();
90             }
91
92             public override Type[] GetInterfaces()
93             {
94                 throw new NotImplementedException();
95             }
96
97             public override global::System.Reflection.MemberInfo[] GetMembers(global::System.Reflection.BindingFlags bindingAttr)
98             {
99                 throw new NotImplementedException();
100             }
101
102             public override global::System.Reflection.MethodInfo[] GetMethods(global::System.Reflection.BindingFlags bindingAttr)
103             {
104                 throw new NotImplementedException();
105             }
106
107             public override Type GetNestedType(string name, global::System.Reflection.BindingFlags bindingAttr)
108             {
109                 throw new NotImplementedException();
110             }
111
112             public override Type[] GetNestedTypes(global::System.Reflection.BindingFlags bindingAttr)
113             {
114                 throw new NotImplementedException();
115             }
116
117             public override global::System.Reflection.PropertyInfo[] GetProperties(global::System.Reflection.BindingFlags bindingAttr)
118             {
119                 throw new NotImplementedException();
120             }
121
122             public override object InvokeMember(string name, global::System.Reflection.BindingFlags invokeAttr, global::System.Reflection.Binder binder, object target, object[] args, global::System.Reflection.ParameterModifier[] modifiers, global::System.Globalization.CultureInfo culture, string[] namedParameters)
123             {
124                 throw new NotImplementedException();
125             }
126
127             public override bool IsDefined(Type attributeType, bool inherit)
128             {
129                 throw new NotImplementedException();
130             }
131
132             protected override global::System.Reflection.TypeAttributes GetAttributeFlagsImpl()
133             {
134                 throw new NotImplementedException();
135             }
136
137             protected override global::System.Reflection.ConstructorInfo GetConstructorImpl(global::System.Reflection.BindingFlags bindingAttr, global::System.Reflection.Binder binder, global::System.Reflection.CallingConventions callConvention, Type[] types, global::System.Reflection.ParameterModifier[] modifiers)
138             {
139                 throw new NotImplementedException();
140             }
141
142             protected override global::System.Reflection.MethodInfo GetMethodImpl(string name, global::System.Reflection.BindingFlags bindingAttr, global::System.Reflection.Binder binder, global::System.Reflection.CallingConventions callConvention, Type[] types, global::System.Reflection.ParameterModifier[] modifiers)
143             {
144                 throw new NotImplementedException();
145             }
146
147             protected override global::System.Reflection.PropertyInfo GetPropertyImpl(string name, global::System.Reflection.BindingFlags bindingAttr, global::System.Reflection.Binder binder, Type returnType, Type[] types, global::System.Reflection.ParameterModifier[] modifiers)
148             {
149                 throw new NotImplementedException();
150             }
151
152             protected override bool HasElementTypeImpl()
153             {
154                 throw new NotImplementedException();
155             }
156
157             protected override bool IsArrayImpl()
158             {
159                 throw new NotImplementedException();
160             }
161
162             protected override bool IsByRefImpl()
163             {
164                 throw new NotImplementedException();
165             }
166
167             protected override bool IsCOMObjectImpl()
168             {
169                 throw new NotImplementedException();
170             }
171
172             protected override bool IsPointerImpl()
173             {
174                 throw new NotImplementedException();
175             }
176
177             protected override bool IsPrimitiveImpl()
178             {
179                 throw new NotImplementedException();
180             }
181         }
182
183         [Test]
184         [Category("P1")]
185         [Description("ReflectionExtensions GetField")]
186         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.GetField M")]
187         [Property("SPEC_URL", "-")]
188         [Property("CRITERIA", "MR")]
189         public void ReflectionExtensionsGetField()
190         {
191             tlog.Debug(tag, $"ReflectionExtensionsGetField START");
192
193             try
194             {
195                 TypeImplement type = new TypeImplement();
196
197                 ReflectionExtensions.GetField(type, "myName");
198             }
199             catch (Exception e)
200             {
201                 tlog.Debug(tag, e.Message.ToString());
202                 tlog.Debug(tag, $"ReflectionExtensionsGetField END (OK)");
203                 Assert.Pass("Caught Exception : passed!");
204             }
205         }
206
207         [Test]
208         [Category("P1")]
209         [Description("ReflectionExtensions GetFields")]
210         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.GetFields M")]
211         [Property("SPEC_URL", "-")]
212         [Property("CRITERIA", "MR")]
213         public void ReflectionExtensionsGetFields()
214         {
215             tlog.Debug(tag, $"ReflectionExtensionsGetFields START");
216
217             try
218             {
219                 TypeImplement type = new TypeImplement();
220
221                 ReflectionExtensions.GetFields(type);
222             }
223             catch (Exception e)
224             {
225                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
226                 Assert.Fail("Caught Exception" + e.ToString());
227             }
228
229             tlog.Debug(tag, $"ReflectionExtensionsGetFields END (OK)");
230             Assert.Pass("ReflectionExtensionsGetFields");
231         }
232
233         [Test]
234         [Category("P1")]
235         [Description("ReflectionExtensions GetProperties")]
236         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.GetProperties M")]
237         [Property("SPEC_URL", "-")]
238         [Property("CRITERIA", "MR")]
239         public void ReflectionExtensionsGetProperties()
240         {
241             tlog.Debug(tag, $"ReflectionExtensionsGetProperties START");
242
243             try
244             {
245                 TypeImplement type = new TypeImplement();
246
247                 ReflectionExtensions.GetProperties(type);
248             }
249             catch (Exception e)
250             {
251                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
252                 Assert.Fail("Caught Exception" + e.ToString());
253             }
254
255             tlog.Debug(tag, $"ReflectionExtensionsGetProperties END (OK)");
256             Assert.Pass("ReflectionExtensionsGetProperties");
257         }
258
259         [Test]
260         [Category("P1")]
261         [Description("ReflectionExtensions GetProperty")]
262         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.GetProperty M")]
263         [Property("SPEC_URL", "-")]
264         [Property("CRITERIA", "MR")]
265         public void ReflectionExtensionsGetProperty()
266         {
267             tlog.Debug(tag, $"ReflectionExtensionsGetProperty START");
268
269             try
270             {
271                 TypeImplement type = new TypeImplement();
272
273                 ReflectionExtensions.GetProperty(type, "myName");
274             }
275             catch (Exception e)
276             {
277                 tlog.Debug(tag, e.Message.ToString());
278                 tlog.Debug(tag, $"ReflectionExtensionsGetProperty END (OK)");
279                 Assert.Pass("Caught Exception : passed!");
280             }
281         }
282
283         [Test]
284         [Category("P1")]
285         [Description("ReflectionExtensions IsAssignableFrom")]
286         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.IsAssignableFrom M")]
287         [Property("SPEC_URL", "-")]
288         [Property("CRITERIA", "MR")]
289         public void ReflectionExtensionsIsAssignableFrom()
290         {
291             tlog.Debug(tag, $"ReflectionExtensionsIsAssignableFrom START");
292
293             try
294             {
295                 TypeImplement type = new TypeImplement();
296                 TypeImplement c = new TypeImplement();
297
298                 ReflectionExtensions.IsAssignableFrom(type, c);
299             }
300             catch (Exception e)
301             {
302                 tlog.Debug(tag, e.Message.ToString());
303                 tlog.Debug(tag, $"ReflectionExtensionsIsAssignableFrom END (OK)");
304                 Assert.Pass("Caught Exception : passed!");
305             }
306         }
307
308         [Test]
309         [Category("P1")]
310         [Description("ReflectionExtensions IsInstanceOfType")]
311         [Property("SPEC", "Tizen.NUI.ReflectionExtensions.IsInstanceOfType M")]
312         [Property("SPEC_URL", "-")]
313         [Property("CRITERIA", "MR")]
314         public void ReflectionExtensionsIsInstanceOfType()
315         {
316             tlog.Debug(tag, $"ReflectionExtensionsIsInstanceOfType START");
317
318             try
319             {
320                 TypeImplement type = new TypeImplement();
321                 object o1 = new object();
322
323                 ReflectionExtensions.IsInstanceOfType(type, o1);
324             }
325             catch (Exception e)
326             {
327                 tlog.Debug(tag, e.Message.ToString());
328                 tlog.Debug(tag, $"ReflectionExtensionsIsInstanceOfType END (OK)");
329                 Assert.Pass("Caught Exception : passed!");
330             }
331         }
332     }
333 }