1 using NUnit.Framework;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("public/xaml/XamlParseException ")]
12 internal class PublicXamlParseExceptionTest
14 private const string tag = "NUITEST";
15 private XamlParseException xamlParseException;
19 tlog.Info(tag, "Init() is called!");
20 xamlParseException = new XamlParseException("Parse Exception!");
26 xamlParseException = null;
27 tlog.Info(tag, "Destroy() is called!");
30 internal class XmlLineInfoImplement : IXmlLineInfo
32 public int LineNumber => 0;
34 public int LinePosition => 0;
36 public bool HasLineInfo() => false;
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()
48 tlog.Debug(tag, $"XamlParseExceptionConstructor START");
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!");
54 tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
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()
66 tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage START");
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!");
72 tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage END (OK)");
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()
84 tlog.Debug(tag, $"XamlParseExceptionConstructorWithInnerException START");
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!");
90 tlog.Debug(tag, $"XamlParseExceptionConstructorWithInnerException END (OK)");
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()
102 tlog.Debug(tag, $"XamlParseExceptionConstructorWithIXmlLineInfo START");
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!");
108 tlog.Debug(tag, $"XamlParseExceptionConstructorWithIXmlLineInfo END (OK)");
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()
120 tlog.Debug(tag, $"XamlParseExceptionXmlInfo START");
124 var result = xamlParseException.XmlInfo;
125 tlog.Debug(tag, "XmlInfo :" + result);
129 tlog.Debug(tag, e.Message.ToString());
130 Assert.Fail("Caught Exception" + e.ToString());
133 tlog.Debug(tag, $"XamlParseExceptionXmlInfo END (OK)");
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()
145 tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage START");
149 var result = xamlParseException.UnformattedMessage;
150 tlog.Debug(tag, "UnformattedMessage :" + result);
154 tlog.Debug(tag, e.Message.ToString());
155 Assert.Fail("Caught Exception : Failed!");
158 tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END (OK)");