3078497367c2cee6b12237757a0abb45ca281502
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / MarkupExtensions / TSDynamicResourceExtension.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/DynamicResourceExtension")]
11     public class PublicDynamicResourceExtensionTest
12     {
13         private const string tag = "NUITEST";
14         private static DynamicResourceExtension d1;
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             d1 = new DynamicResourceExtension();
29         }
30
31         [TearDown]
32         public void Destroy()
33         {
34             d1 = null;
35             tlog.Info(tag, "Destroy() is called!");
36         }
37
38         [Test]
39         [Category("P1")]
40         [Description("DynamicResourceExtension Key")]
41         [Property("SPEC", "Tizen.NUI.DynamicResourceExtension.Key A")]
42         [Property("SPEC_URL", "-")]
43         [Property("CRITERIA", "PRW")]
44         public void DynamicResourceExtensionKey()
45         {
46             tlog.Debug(tag, $"DynamicResourceExtensionKey START");
47
48             try
49             {
50                 string tmp = d1.Key;
51                 d1.Key = tmp;
52             }
53             catch (Exception e)
54             {
55                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
56                 Assert.Fail("Caught Exception" + e.ToString());
57             }
58
59             tlog.Debug(tag, $"DynamicResourceExtensionKey END (OK)");
60             Assert.Pass("DynamicResourceExtensionKey");
61         }
62
63         [Test]
64         [Category("P1")]
65         [Description("DynamicResourceExtension Key")]
66         [Property("SPEC", "Tizen.NUI.DynamicResourceExtension.Key A")]
67         [Property("SPEC_URL", "-")]
68         [Property("CRITERIA", "PRW")]
69         public void DynamicResourceExtensionProvideValue()
70         {
71             tlog.Debug(tag, $"DynamicResourceExtensionProvideValue START");
72
73             try
74             {
75                 IServiceProviderimplement serviceProviderimplement = new IServiceProviderimplement();
76                 d1.Key = "myKey";
77                 d1.ProvideValue(serviceProviderimplement);
78             }
79             catch (Exception e)
80             {
81                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
82                 Assert.Fail("Caught Exception" + e.ToString());
83             }
84
85             tlog.Debug(tag, $"DynamicResourceExtensionProvideValue END (OK)");
86             Assert.Pass("DynamicResourceExtensionProvideValue");
87         }
88     }
89 }