[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / MarkupExtensions / TSReferenceExtension.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/xaml/MarkupExtensions/ReferenceExtension")]
13     public class PublicReferenceExtensionTest
14     {
15         private const string tag = "NUITEST";
16         private Tizen.NUI.Xaml.ReferenceExtension reference;
17
18         internal class IServiceProviderImpl : IServiceProvider
19         {
20             public object GetService(Type serviceType) { return null; }
21         }
22
23         [SetUp]
24         public void Init()
25         {
26             tlog.Info(tag, "Init() is called!");
27             reference = new Tizen.NUI.Xaml.ReferenceExtension();
28         }
29
30         [TearDown]
31         public void Destroy()
32         {
33             reference = null;
34             tlog.Info(tag, "Destroy() is called!");
35         }
36
37         [Test]
38         [Category("P1")]
39         [Description("ReferenceExtension Name")]
40         [Property("SPEC", "Tizen.NUI.ReferenceExtension.Name A")]
41         [Property("SPEC_URL", "-")]
42         [Property("CRITERIA", "PRW")]
43         public void ReferenceExtensionName()
44         {
45             tlog.Debug(tag, $"ReferenceExtensionName START");
46
47             try
48             {
49                 var name = reference.Name;
50                 reference.Name = name;
51                 Assert.AreEqual(name, reference.Name, "Should be equal");
52             }
53             catch (Exception e)
54             {
55                 tlog.Debug(tag, e.Message.ToString());
56                 Assert.Fail("Caught Exception : Failed!");
57             }
58
59             tlog.Debug(tag, $"ReferenceExtensionName END");
60         }
61
62         [Test]
63         [Category("P2")]
64         [Description("ReferenceExtension ProvideValue")]
65         [Property("SPEC", "Tizen.NUI.ReferenceExtension.ProvideValue M")]
66         [Property("SPEC_URL", "-")]
67         [Property("CRITERIA", "MR")]
68         public void ReferenceExtensionProvideValue()
69         {
70             tlog.Debug(tag, $"ReferenceExtensionProvideValue START");
71
72             try
73             {
74                 reference.ProvideValue(new IServiceProviderImpl()); // serviceProvider is null
75             }
76             catch (ArgumentException e)
77             {
78                 tlog.Debug(tag, e.Message.ToString());
79                 tlog.Debug(tag, $"ReferenceExtensionProvideValue END");
80                 Assert.Pass("Caught ArgumentException : Passed!");
81             }
82
83             
84         }
85     }
86 }