c23daa844f7ac81b46117ea3881521bd721fb01d
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / MarkupExtensions / TSTypeExtension.cs
1 using NUnit.Framework;
2 using System;
3 using Tizen.NUI.Xaml;
4
5 namespace Tizen.NUI.Devel.Tests
6 {
7     using tlog = Tizen.Log;
8
9     [TestFixture]
10     [Description("public/xaml/MarkupExtensions/TypeExtension")]
11     public class PublicTypeExtensionTest
12     {
13         private const string tag = "NUITEST";
14         private static TypeExtension t1;
15
16         internal class IServiceProviderimplement : IServiceProvider
17         {
18             public object GetService(Type serviceType)
19             {
20                 return null;
21             }
22         }
23
24         [SetUp]
25         public void Init()
26         {
27             tlog.Info(tag, "Init() is called!");
28             t1 = new TypeExtension();
29         }
30
31         [TearDown]
32         public void Destroy()
33         {
34             tlog.Info(tag, "Destroy() is called!");
35         }
36
37         [Test]
38         [Category("P1")]
39         [Description("TypeExtension TypeName")]
40         [Property("SPEC", "Tizen.NUI.TypeExtension.TypeName A")]
41         [Property("SPEC_URL", "-")]
42         [Property("CRITERIA", "PRW")]
43         public void TypeExtensionTypeName()
44         {
45             tlog.Debug(tag, $"TypeExtensionTypeName START");
46
47             try
48             {
49                 string tmp = t1.TypeName;
50                 t1.TypeName = tmp;
51             }
52             catch (Exception e)
53             {
54                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
55                 Assert.Fail("Caught Exception" + e.ToString());
56             }
57
58             tlog.Debug(tag, $"TypeExtensionTypeName END (OK)");
59             Assert.Pass("TypeExtensionTypeName");
60         }
61
62         [Test]
63         [Category("P1")]
64         [Description("TypeExtension ProvideValue")]
65         [Property("SPEC", "Tizen.NUI.TypeExtension.ProvideValue A")]
66         [Property("SPEC_URL", "-")]
67         [Property("CRITERIA", "PRW")]
68         public void TypeExtensionProvideValue()
69         {
70             tlog.Debug(tag, $"TypeExtensionProvideValue START");
71
72             try
73             {
74                 IServiceProviderimplement serviceProviderimplement = new IServiceProviderimplement();
75                 t1.TypeName = "myTypeName";
76                 t1.ProvideValue(serviceProviderimplement);
77             }
78             catch (Exception e)
79             {
80                 tlog.Debug(tag, e.Message.ToString());
81                 tlog.Debug(tag, $"TypeExtensionProvideValue END (OK)");
82                 Assert.Pass("Caught Exception : passed!");
83             }
84         }
85     }
86 }