[NUI] Update TCs of NUI.Devel.
[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 TypeExtension tExtension;
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             tExtension = new TypeExtension();
26         }
27
28         [TearDown]
29         public void Destroy()
30         {
31             tExtension = null;
32             tlog.Info(tag, "Destroy() is called!");
33         }
34
35         [Test]
36         [Category("P1")]
37         [Description("TypeExtension TypeName")]
38         [Property("SPEC", "Tizen.NUI.TypeExtension.TypeName A")]
39         [Property("SPEC_URL", "-")]
40         [Property("CRITERIA", "PRW")]
41         public void TypeExtensionTypeName()
42         {
43             tlog.Debug(tag, $"TypeExtensionTypeName START");
44
45             try
46             {
47                 var name = tExtension.TypeName;
48                 tExtension.TypeName = name;
49                 Assert.AreEqual(name, tExtension.TypeName, "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, $"TypeExtensionTypeName END");
58         }
59
60         [Test]
61         [Category("P2")]
62         [Description("TypeExtension ProvideValue")]
63         [Property("SPEC", "Tizen.NUI.TypeExtension.ProvideValue M")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "MR")]
66         public void TypeExtensionProvideValue()
67         {
68             tlog.Debug(tag, $"TypeExtensionProvideValue START");
69
70             try
71             {
72                 tExtension.TypeName = this.GetType().ToString();
73                 var type = tExtension.ProvideValue(new IServiceProviderImpl());
74                 tlog.Error(tag, "Type : " + type);
75             }
76             catch (ArgumentException e)     // typeResolver is null
77             {
78                 tlog.Error(tag, e.Message.ToString());
79                 tlog.Debug(tag, $"TypeExtensionProvideValue END");
80                 Assert.Pass("Caught Exception : Passed!");
81             }
82         }
83     }
84 }