0e79af7a7a354cc6e58b6caee557de910fc140fd
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / MarkupExtensions / TSArrayExtension.cs
1 using NUnit.Framework;
2 using System;
3 using System.Collections;
4 using Tizen.NUI.Xaml;
5
6 namespace Tizen.NUI.Devel.Tests
7 {
8     using tlog = Tizen.Log;
9
10     [TestFixture]
11     [Description("public/xaml/MarkupExtensions/ArrayExtension")]
12     public class PublicArrayExtensionTest
13     {
14         private const string tag = "NUITEST";
15         private ArrayExtension array;
16
17         internal class IServiceProviderImpl : IServiceProvider
18         {
19             public object GetService(Type serviceType) { return null; }
20         }
21
22         [SetUp]
23         public void Init()
24         {
25             tlog.Info(tag, "Init() is called!");
26             array = new ArrayExtension();
27         }
28
29         [TearDown]
30         public void Destroy()
31         {
32             array = null;
33             tlog.Info(tag, "Destroy() is called!");
34         }
35
36         [Test]
37         [Category("P1")]
38         [Description("ArrayExtension Items")]
39         [Property("SPEC", "Tizen.NUI.ArrayExtension.Items A")]
40         [Property("SPEC_URL", "-")]
41         [Property("CRITERIA", "PRW")]
42         public void ArrayExtensionItems()
43         {
44             tlog.Debug(tag, $"ArrayExtensionItems START");
45
46             try
47             {
48                 var item = array.Items;
49                 tlog.Debug(tag, "Items : " + item);
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, $"ArrayExtensionItems END");
58         }
59
60         [Test]
61         [Category("P1")]
62         [Description("ArrayExtension Type")]
63         [Property("SPEC", "Tizen.NUI.ArrayExtension.Type A")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "PRW")]
66         public void ArrayExtensionType()
67         {
68             tlog.Debug(tag, $"ArrayExtensionType START");
69
70             try
71             {
72                 var type = array.Type;
73                 array.Type = type;
74                 Assert.AreEqual(type, array.Type, "Should be equal");
75             }
76             catch (Exception e)
77             {
78                 tlog.Debug(tag, e.Message.ToString());
79                 Assert.Fail("Caught Exception : Failed!");
80             }
81
82             tlog.Debug(tag, $"ArrayExtensionType END");
83         }
84
85         [Test]
86         [Category("P1")]
87         [Description("ArrayExtension ProvideValue")]
88         [Property("SPEC", "Tizen.NUI.ArrayExtension.ProvideValue A")]
89         [Property("SPEC_URL", "-")]
90         [Property("CRITERIA", "PRW")]
91         public void ArrayExtensionProvideValue()
92         {
93             tlog.Debug(tag, $"ArrayExtensionProvideValue START");
94
95             try
96             {
97                 array.Type = typeof(string);
98                 array.ProvideValue(new IServiceProviderImpl());
99             }
100             catch (Exception e)
101             {
102                 tlog.Debug(tag, e.Message.ToString());
103                 Assert.Fail("Caught Exception : Failed!");
104             }
105
106             tlog.Debug(tag, $"ArrayExtensionProvideValue END");
107         }
108     }
109 }