[NUI][NUI.Devel] Update nui line coverage TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / EXaml / Action / TSGetValueAction.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("internal/EXaml/Action/GetValueAction")]
13     public class InternalGetValueActionTest
14     {
15         private const string tag = "NUITEST";
16
17         internal class MyAction : Tizen.NUI.EXaml.Action
18         {
19             public void Init() { }
20
21             public void OnActive() { }
22
23             EXaml.Action EXaml.Action.DealChar(char c)
24             {
25                 return this;
26             }
27         }
28
29         [SetUp]
30         public void Init()
31         {
32             tlog.Info(tag, "Init() is called!");
33         }
34
35         [TearDown]
36         public void Destroy()
37         {
38             tlog.Info(tag, "Destroy() is called!");
39         }
40
41         [Test]
42         [Category("P1")]
43         [Description("GetValueAction constructor.")]
44         [Property("SPEC", "Tizen.NUI.EXaml.GetValueAction.GetValueAction C")]
45         [Property("SPEC_URL", "-")]
46         [Property("CRITERIA", "CONSTR")]
47         [Property("AUTHOR", "guowei.wang@samsung.com")]
48         public void EXamlGetValueActionConstructor()
49         {
50             tlog.Debug(tag, $"EXamlGetValueActionConstructor START");
51
52             var testingTarget = new Tizen.NUI.EXaml.GetValueAction(')', new MyAction());
53             Assert.IsNotNull(testingTarget, "Can't create success object GetValueAction");
54             Assert.IsInstanceOf<Tizen.NUI.EXaml.GetValueAction>(testingTarget, "Should be an instance of GetValueAction type.");
55
56             tlog.Debug(tag, $"EXamlGetValueActionConstructor END (OK)");
57         }
58
59         [Test]
60         [Category("P1")]
61         [Description("GetValueAction Init.")]
62         [Property("SPEC", "Tizen.NUI.EXaml.GetValueAction.Init M")]
63         [Property("SPEC_URL", "-")]
64         [Property("CRITERIA", "MR")]
65         [Property("AUTHOR", "guowei.wang@samsung.com")]
66         public void EXamlGetValueActionInit()
67         {
68             tlog.Debug(tag, $"EXamlGetValueActionInit START");
69
70             var testingTarget = new Tizen.NUI.EXaml.GetValueAction(')', new MyAction());
71             Assert.IsNotNull(testingTarget, "Can't create success object GetValueAction");
72             Assert.IsInstanceOf<Tizen.NUI.EXaml.GetValueAction>(testingTarget, "Should be an instance of GetValueAction type.");
73
74             try
75             {
76                 testingTarget.Init();
77             }
78             catch (Exception e)
79             {
80                 tlog.Debug(tag, e.Message.ToString());
81                 Assert.Fail("Caught Exception : Failed!");
82             }
83
84             tlog.Debug(tag, $"EXamlGetValueActionInit END (OK)");
85         }
86
87         [Test]
88         [Category("P1")]
89         [Description("GetValueAction DealChar.")]
90         [Property("SPEC", "Tizen.NUI.EXaml.GetValueAction.DealChar M")]
91         [Property("SPEC_URL", "-")]
92         [Property("CRITERIA", "MR")]
93         [Property("AUTHOR", "guowei.wang@samsung.com")]
94         public void EXamlGetValueActionDealChar()
95         {
96             tlog.Debug(tag, $"EXamlGetValueActionDealChar START");
97
98             var testingTarget = new Tizen.NUI.EXaml.GetValueAction('\"', new MyAction());
99             Assert.IsNotNull(testingTarget, "Can't create success object GetValueAction");
100             Assert.IsInstanceOf<Tizen.NUI.EXaml.GetValueAction>(testingTarget, "Should be an instance of GetValueAction type.");
101
102             try
103             {
104                 testingTarget.DealChar('\"');
105             }
106             catch (Exception e)
107             {
108                 tlog.Error(tag, e.Message.ToString());
109                 Assert.Fail("Caught Exception : Failed!");
110             }
111
112             var testingTarget1 = new Tizen.NUI.EXaml.GetValueAction('y', new MyAction());
113             try
114             {
115                 testingTarget1.DealChar('y');
116             }
117             catch (Exception e)
118             {
119                 tlog.Error(tag, e.Message.ToString());
120                 Assert.Fail("Caught Exception : Failed!");
121             }
122
123             var testingTarget2 = new Tizen.NUI.EXaml.GetValueAction('z', new MyAction());
124             try
125             {
126                 testingTarget2.DealChar('z');
127             }
128             catch (Exception e)
129             {
130                 tlog.Error(tag, e.Message.ToString());
131                 Assert.Fail("Caught Exception : Failed!");
132             }
133
134             var testingTarget3 = new Tizen.NUI.EXaml.GetValueAction('m', new MyAction());
135             try
136             {
137                 testingTarget3.DealChar('3');
138             }
139             catch (Exception e)
140             {
141                 tlog.Info(tag, e.Message.ToString());
142                 Assert.Fail("Caught Exception : Failed!");
143             }
144
145             tlog.Debug(tag, $"EXamlGetValueActionDealChar END (OK)");
146         }
147
148         [Test]
149         [Category("P1")]
150         [Description("GetValueAction DealChar, ('\"' != sign)")]
151         [Property("SPEC", "Tizen.NUI.EXaml.GetValueAction.DealChar M")]
152         [Property("SPEC_URL", "-")]
153         [Property("CRITERIA", "MR")]
154         [Property("AUTHOR", "guowei.wang@samsung.com")]
155         public void EXamlGetValueActionDealChar2()
156         {
157             tlog.Debug(tag, $"EXamlGetValueActionDealChar2 START");
158
159             var testingTarget = new Tizen.NUI.EXaml.GetValueAction('\'', new MyAction());
160             Assert.IsNotNull(testingTarget, "Can't create success object GetValueAction");
161             Assert.IsInstanceOf<Tizen.NUI.EXaml.GetValueAction>(testingTarget, "Should be an instance of GetValueAction type.");
162
163             try
164             {
165                 testingTarget.DealChar(' ');
166             }
167             catch (Exception e)
168             {
169                 tlog.Error(tag, e.Message.ToString());
170                 Assert.Fail("Caught Exception : Failed!");
171             }
172
173             try
174             {
175                 testingTarget.DealChar('(');
176             }
177             catch (Exception e)
178             {
179                 tlog.Error(tag, e.Message.ToString());
180                 Assert.Fail("Caught Exception : Failed!");
181             }
182
183             tlog.Debug(tag, $"EXamlGetValueActionDealChar2 END (OK)");
184         }
185     }
186 }