b7e0d25d3be2f2e4b62807c9fd3c29ec76418598
[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("myMessage");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             xamlParseException = null;
27             tlog.Info(tag, "Destroy() is called!");
28         }
29
30         private class XmlLineInfoImplent : IXmlLineInfo
31         {
32             public int LineNumber => throw new NotImplementedException();
33
34             public int LinePosition => throw new NotImplementedException();
35
36             public bool HasLineInfo()
37             {
38                 throw new NotImplementedException();
39             }
40         }
41
42         [Test]
43         [Category("P1")]
44         [Description("XamlParseException XamlParseException")]
45         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
46         [Property("SPEC_URL", "-")]
47         [Property("CRITERIA", "CONSTR")]
48         public void XamlParseExceptionConstructor1()
49         {
50             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
51
52             XamlParseException x1 = new XamlParseException("myMessage");
53
54             x1 = null;
55
56             tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
57             Assert.Pass("XamlParseExceptionConstructor");
58         }
59
60         [Test]
61         [Category("P1")]
62         [Description("XamlParseException XamlParseException")]
63         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
64         [Property("SPEC_URL", "-")]
65         [Property("CRITERIA", "CONSTR")]
66         public void XamlParseExceptionConstructor2()
67         {
68             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
69
70             XamlParseException x2 = new XamlParseException();
71
72             x2 = null;
73
74             tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
75             Assert.Pass("XamlParseExceptionConstructor");
76         }
77
78         [Test]
79         [Category("P1")]
80         [Description("XamlParseException XamlParseException")]
81         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
82         [Property("SPEC_URL", "-")]
83         [Property("CRITERIA", "CONSTR")]
84         public void XamlParseExceptionConstructor3()
85         {
86             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
87
88             Exception e1 = new Exception();
89             XamlParseException x3 = new XamlParseException("myMessage", e1);
90
91             x3 = null;
92             tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
93             Assert.Pass("XamlParseExceptionConstructor");
94         }
95
96         [Test]
97         [Category("P1")]
98         [Description("XamlParseException XamlParseException")]
99         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
100         [Property("SPEC_URL", "-")]
101         [Property("CRITERIA", "CONSTR")]
102         public void XamlParseExceptionConstructor4()
103         {
104             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
105
106             Exception e1 = new Exception();
107             XmlLineInfoImplent xmlLineInfoImplent = new XmlLineInfoImplent();
108             XamlParseException x4 = new XamlParseException("myMessage", xmlLineInfoImplent, e1);
109
110             x4 = null;
111
112             tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
113             Assert.Pass("XamlParseExceptionConstructor");
114         }
115
116         [Test]
117         [Category("P1")]
118         [Description("XamlParseException XmlInfo ")]
119         [Property("SPEC", "Tizen.NUI.XamlParseException.XmlInfo A")]
120         [Property("SPEC_URL", "-")]
121         [Property("CRITERIA", "PRW")]
122         public void XamlParseExceptionXmlInfo()
123         {
124             tlog.Debug(tag, $"XamlParseExceptionXmlInfo START");
125             try
126             {
127                 XmlLineInfoImplent xml1 = (XmlLineInfoImplent)xamlParseException.XmlInfo;
128             }
129             catch (Exception e)
130             {
131                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
132                 Assert.Fail("Caught Exception" + e.ToString());
133             }
134             tlog.Debug(tag, $"XamlParseExceptionXmlInfo END (OK)");
135             Assert.Pass("XamlParseExceptionXmlInfo");
136         }
137
138         [Test]
139         [Category("P1")]
140         [Description("XamlParseException UnformattedMessage ")]
141         [Property("SPEC", "Tizen.NUI.XamlParseException.UnformattedMessage A")]
142         [Property("SPEC_URL", "-")]
143         [Property("CRITERIA", "PRW")]
144         public void XamlParseExceptionUnformattedMessage()
145         {
146             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage START");
147             try
148             {
149                 string s1 = xamlParseException.UnformattedMessage;
150             }
151             catch (Exception e)
152             {
153                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
154                 Assert.Fail("Caught Exception" + e.ToString());
155             }
156             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END (OK)");
157             Assert.Pass("XamlParseExceptionUnformattedMessage");
158         }
159     }
160 }