[NUI] Update TCs of NUI.Devel.
[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 DynamicResourceExtension resExtension;
15
16         internal class IServiceProviderImpl : IServiceProvider
17         {
18             public object GetService(Type serviceType) { return null; }
19         }
20
21         [SetUp]
22         public void Init()
23         {
24             tlog.Info(tag, "Init() is called!");
25             resExtension = new DynamicResourceExtension();
26         }
27
28         [TearDown]
29         public void Destroy()
30         {
31             resExtension = null;
32             tlog.Info(tag, "Destroy() is called!");
33         }
34
35         [Test]
36         [Category("P1")]
37         [Description("DynamicResourceExtension Key")]
38         [Property("SPEC", "Tizen.NUI.DynamicResourceExtension.Key A")]
39         [Property("SPEC_URL", "-")]
40         [Property("CRITERIA", "PRW")]
41         public void DynamicResourceExtensionKey()
42         {
43             tlog.Debug(tag, $"DynamicResourceExtensionKey START");
44
45             try
46             {
47                 string key = resExtension.Key;
48                 resExtension.Key = key;
49                 Assert.AreEqual(key, resExtension.Key, "Should be equal");
50             }
51             catch (Exception e)
52             {
53                 tlog.Debug(tag, e.Message.ToString());
54                 Assert.Fail("Caught Exception : Failed!");
55             }
56
57             tlog.Debug(tag, $"DynamicResourceExtensionKey END");
58         }
59
60         [Test]
61         [Category("P1")]
62         [Description("DynamicResourceExtension Key")]
63         [Property("SPEC", "Tizen.NUI.DynamicResourceExtension.Key A")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "PRW")]
66         public void DynamicResourceExtensionProvideValue()
67         {
68             tlog.Debug(tag, $"DynamicResourceExtensionProvideValue START");
69
70             try
71             {
72                 resExtension.Key = "Key";
73                 resExtension.ProvideValue(new IServiceProviderImpl());
74             }
75             catch (Exception e)
76             {
77                 tlog.Debug(tag, e.Message.ToString());
78                 Assert.Fail("Caught Exception : Failed!");
79             }
80
81             tlog.Debug(tag, $"DynamicResourceExtensionProvideValue END");
82         }
83     }
84 }