[NUI] integration from DevelNUI to master (#3309)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / MarkupExtensions / TSReferenceExtension.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/ReferenceExtension")]
11     internal class PublicReferenceExtensionTest
12     {
13         private const string tag = "NUITEST";
14         private static ReferenceExtension r1;
15
16         [SetUp]
17         public void Init()
18         {
19             tlog.Info(tag, "Init() is called!");
20             r1 = new ReferenceExtension();
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             r1 = null;
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         [Test]
31         [Category("P1")]
32         [Description("ReferenceExtension Name")]
33         [Property("SPEC", "Tizen.NUI.ReferenceExtension.Name A")]
34         [Property("SPEC_URL", "-")]
35         [Property("CRITERIA", "PRW")]
36         public void ReferenceExtensionName()
37         {
38             tlog.Debug(tag, $"ReferenceExtensionName START");
39
40             try
41             {
42                 string tmp = r1.Name;
43                 r1.Name = tmp;
44             }
45             catch (Exception e)
46             {
47                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
48                 Assert.Fail("Caught Exception" + e.ToString());
49             }
50
51             tlog.Debug(tag, $"ReferenceExtensionName END (OK)");
52             Assert.Pass("ReferenceExtensionName");
53         }
54
55         private class IServiceProviderimplement : IServiceProvider
56         {
57             public object GetService(Type serviceType)
58             {
59                 return null;
60             }
61         }
62
63         [Test]
64         [Category("P1")]
65         [Description("ReferenceExtension ProvideValue")]
66         [Property("SPEC", "Tizen.NUI.ReferenceExtension.ProvideValue A")]
67         [Property("SPEC_URL", "-")]
68         [Property("CRITERIA", "PRW")]
69         public void ReferenceExtensionProvideValue()
70         {
71             tlog.Debug(tag, $"ReferenceExtensionProvideValue START");
72
73             try
74             {
75                 IServiceProviderimplement serviceProviderimplement = new IServiceProviderimplement();
76                 r1.ProvideValue(serviceProviderimplement);
77             }
78             catch (Exception e)
79             {
80                 tlog.Debug(tag, e.Message.ToString());
81                 tlog.Debug(tag, $"ReferenceExtensionProvideValue END (OK)");
82                 Assert.Pass("Caught Exception : passed!");
83             }
84         }
85     }
86 }