[NUI] Update NUI.Devel to fix block and crash issues.
[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     internal class PublicXamlParseExceptionTest
13     {
14         private const string tag = "NUITEST";
15         private XamlParseException xamlParseException;
16         [SetUp]
17         public void Init()
18         {
19             tlog.Info(tag, "Init() is called!");
20             xamlParseException = new XamlParseException("Parse Exception!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             xamlParseException = null;
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         internal class XmlLineInfoImplement : IXmlLineInfo
31         {
32             public int LineNumber => 0;
33
34             public int LinePosition => 0;
35
36             public bool HasLineInfo() => false;
37         }
38
39         [Test]
40         [Category("P1")]
41         [Description("XamlParseException XamlParseException")]
42         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
43         [Property("SPEC_URL", "-")]
44         [Property("CRITERIA", "CONSTR")]
45         [Property("AUTHOR", "guowei.wang@samsung.com")]
46         public void XamlParseExceptionConstructor()
47         {
48             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
49
50             var testingTarget = new XamlParseException();
51             Assert.IsNotNull(testingTarget, "should be not null");
52             Assert.IsInstanceOf<XamlParseException>(testingTarget, "should be an instance of XamlParseException class!");
53
54             tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
55         }
56
57         [Test]
58         [Category("P1")]
59         [Description("XamlParseException constructor. With message.")]
60         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
61         [Property("SPEC_URL", "-")]
62         [Property("CRITERIA", "CONSTR")]
63         [Property("AUTHOR", "guowei.wang@samsung.com")]
64         public void XamlParseExceptionConstructorWithMessage()
65         {
66             tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage START");
67
68             var testingTarget = new XamlParseException("Xaml Parsed Failed!");
69             Assert.IsNotNull(testingTarget, "should be not null");
70             Assert.IsInstanceOf<XamlParseException>(testingTarget, "should be an instance of XamlParseException class!");
71
72             tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage END (OK)");
73         }
74
75         [Test]
76         [Category("P1")]
77         [Description("XamlParseException constructor. With innerException.")]
78         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
79         [Property("SPEC_URL", "-")]
80         [Property("CRITERIA", "CONSTR")]
81         [Property("AUTHOR", "guowei.wang@samsung.com")]
82         public void XamlParseExceptionConstructorWithInnerException()
83         {
84             tlog.Debug(tag, $"XamlParseExceptionConstructorWithInnerException START");
85
86             var testingTarget = new XamlParseException("myMessage", new Exception());
87             Assert.IsNotNull(testingTarget, "should be not null");
88             Assert.IsInstanceOf<XamlParseException>(testingTarget, "should be an instance of XamlParseException class!");
89
90             tlog.Debug(tag, $"XamlParseExceptionConstructorWithInnerException END (OK)");
91         }
92
93         [Test]
94         [Category("P1")]
95         [Description("XamlParseException constructor. With IXmlLineInfo.")]
96         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
97         [Property("SPEC_URL", "-")]
98         [Property("CRITERIA", "CONSTR")]
99         [Property("AUTHOR", "guowei.wang@samsung.com")]
100         public void XamlParseExceptionConstructorWithIXmlLineInfo()
101         {
102             tlog.Debug(tag, $"XamlParseExceptionConstructorWithIXmlLineInfo START");
103
104             var testingTarget = new XamlParseException("Xaml Parsed Failed!", new XmlLineInfoImplement(), new Exception());
105             Assert.IsNotNull(testingTarget, "should be not null");
106             Assert.IsInstanceOf<XamlParseException>(testingTarget, "should be an instance of XamlParseException class!");
107
108             tlog.Debug(tag, $"XamlParseExceptionConstructorWithIXmlLineInfo END (OK)");
109         }
110
111         [Test]
112         [Category("P1")]
113         [Description("XamlParseException XmlInfo ")]
114         [Property("SPEC", "Tizen.NUI.XamlParseException.XmlInfo A")]
115         [Property("SPEC_URL", "-")]
116         [Property("CRITERIA", "PRW")]
117         [Property("AUTHOR", "guowei.wang@samsung.com")]
118         public void XamlParseExceptionXmlInfo()
119         {
120             tlog.Debug(tag, $"XamlParseExceptionXmlInfo START");
121
122             try
123             {
124                 var result = xamlParseException.XmlInfo;
125                 tlog.Debug(tag, "XmlInfo :" + result);
126             }
127             catch (Exception e)
128             {
129                 tlog.Debug(tag, e.Message.ToString());
130                 Assert.Fail("Caught Exception" + e.ToString());
131             }
132
133             tlog.Debug(tag, $"XamlParseExceptionXmlInfo END (OK)");
134         }
135
136         [Test]
137         [Category("P1")]
138         [Description("XamlParseException UnformattedMessage ")]
139         [Property("SPEC", "Tizen.NUI.XamlParseException.UnformattedMessage A")]
140         [Property("SPEC_URL", "-")]
141         [Property("CRITERIA", "PRW")]
142         [Property("AUTHOR", "guowei.wang@samsung.com")]
143         public void XamlParseExceptionUnformattedMessage()
144         {
145             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage START");
146             
147             try
148             {
149                 var result = xamlParseException.UnformattedMessage;
150                 tlog.Debug(tag, "UnformattedMessage :" + result);
151             }
152             catch (Exception e)
153             {
154                 tlog.Debug(tag, e.Message.ToString());
155                 Assert.Fail("Caught Exception : Failed!");
156             }
157
158             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END (OK)");
159         }
160     }
161 }