[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / TSXamlParseException.cs
1 using NUnit.Framework;
2 using System;
3 using System.Xml;
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/XamlParseException ")]
12     public class PublicXamlParseExceptionTest
13     {
14         private const string tag = "NUITEST";
15         private XamlParseException xamlParse;
16
17         internal class XmlLineInfoImpl : IXmlLineInfo
18         {
19             public int LineNumber => 0;
20             public int LinePosition => 0;
21             public bool HasLineInfo() => false;
22         }
23
24         [SetUp]
25         public void Init()
26         {
27             tlog.Info(tag, "Init() is called!");
28             xamlParse = new XamlParseException("myMessage");
29         }
30
31         [TearDown]
32         public void Destroy()
33         {
34             xamlParse = null;
35             tlog.Info(tag, "Destroy() is called!");
36         }
37
38         [Test]
39         [Category("P1")]
40         [Description("XamlParseException XamlParseException")]
41         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
42         [Property("SPEC_URL", "-")]
43         [Property("CRITERIA", "CONSTR")]
44         public void XamlParseExceptionConstructor()
45         {
46             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
47
48             var testingTarget = new XamlParseException();
49             Assert.IsNotNull(testingTarget, "null XamlParseException");
50             Assert.IsInstanceOf<XamlParseException>(testingTarget, "Should return XamlParseException instance.");
51             
52             testingTarget = null;
53             tlog.Debug(tag, $"XamlParseExceptionConstructor END");
54         }
55
56         [Test]
57         [Category("P1")]
58         [Description("XamlParseException XamlParseException")]
59         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
60         [Property("SPEC_URL", "-")]
61         [Property("CRITERIA", "CONSTR")]
62         public void XamlParseExceptionConstructorWithMessage()
63         {
64             tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage START");
65
66             var testingTarget = new XamlParseException("myMessage", new Exception());
67             Assert.IsNotNull(testingTarget, "null XamlParseException");
68             Assert.IsInstanceOf<XamlParseException>(testingTarget, "Should return XamlParseException instance.");
69
70             testingTarget = null;
71             tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage END");
72         }
73
74         [Test]
75         [Category("P1")]
76         [Description("XamlParseException XmlInfo ")]
77         [Property("SPEC", "Tizen.NUI.XamlParseException.XmlInfo A")]
78         [Property("SPEC_URL", "-")]
79         [Property("CRITERIA", "PRW")]
80         public void XamlParseExceptionXmlInfo()
81         {
82             tlog.Debug(tag, $"XamlParseExceptionXmlInfo START");
83
84             try
85             {
86                 var result = (XmlLineInfoImpl)xamlParse.XmlInfo;
87                 tlog.Debug(tag, "XmlInfo : " + result);
88             }
89             catch (Exception e)
90             {
91                 tlog.Debug(tag, e.Message.ToString());
92                 Assert.Fail("Caught Exception : Failed!");
93             }
94
95             tlog.Debug(tag, $"XamlParseExceptionXmlInfo END");
96         }
97
98         [Test]
99         [Category("P1")]
100         [Description("XamlParseException UnformattedMessage ")]
101         [Property("SPEC", "Tizen.NUI.XamlParseException.UnformattedMessage A")]
102         [Property("SPEC_URL", "-")]
103         [Property("CRITERIA", "PRW")]
104         public void XamlParseExceptionUnformattedMessage()
105         {
106             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage START");
107
108             try
109             {
110                 var result = xamlParse.UnformattedMessage;
111                 tlog.Debug(tag, "UnformattedMessage : " + result);
112             }
113             catch (Exception e)
114             {
115                 tlog.Debug(tag, e.Message.ToString());
116                 Assert.Fail("Caught Exception : Failed!");
117             }
118
119             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END");
120         }
121     }
122 }