[NUI][NUI.Devel] Update nui line coverage TCs.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Xaml / TSXamlParseException.cs
index b7e0d25..7c6d3a9 100755 (executable)
@@ -9,52 +9,48 @@ namespace Tizen.NUI.Devel.Tests
 
     [TestFixture]
     [Description("public/xaml/XamlParseException ")]
-    internal class PublicXamlParseExceptionTest
+    public class PublicXamlParseExceptionTest
     {
         private const string tag = "NUITEST";
-        private XamlParseException xamlParseException;
+        private XamlParseException xamlParse;
+
+        internal class XmlLineInfoImpl : IXmlLineInfo
+        {
+            public int LineNumber => 0;
+            public int LinePosition => 0;
+            public bool HasLineInfo() => false;
+        }
+
         [SetUp]
         public void Init()
         {
             tlog.Info(tag, "Init() is called!");
-            xamlParseException = new XamlParseException("myMessage");
+            xamlParse = new XamlParseException("myMessage");
         }
 
         [TearDown]
         public void Destroy()
         {
-            xamlParseException = null;
+            xamlParse = null;
             tlog.Info(tag, "Destroy() is called!");
         }
 
-        private class XmlLineInfoImplent : IXmlLineInfo
-        {
-            public int LineNumber => throw new NotImplementedException();
-
-            public int LinePosition => throw new NotImplementedException();
-
-            public bool HasLineInfo()
-            {
-                throw new NotImplementedException();
-            }
-        }
-
         [Test]
         [Category("P1")]
         [Description("XamlParseException XamlParseException")]
         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "CONSTR")]
-        public void XamlParseExceptionConstructor1()
+        public void XamlParseExceptionConstructor()
         {
             tlog.Debug(tag, $"XamlParseExceptionConstructor START");
 
-            XamlParseException x1 = new XamlParseException("myMessage");
-
-            x1 = null;
-
-            tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
-            Assert.Pass("XamlParseExceptionConstructor");
+            var testingTarget = new XamlParseException();
+            Assert.IsNotNull(testingTarget, "null XamlParseException");
+            Assert.IsInstanceOf<XamlParseException>(testingTarget, "Should return XamlParseException instance.");
+            
+            testingTarget = null;
+            tlog.Debug(tag, $"XamlParseExceptionConstructor END");
         }
 
         [Test]
@@ -63,16 +59,16 @@ namespace Tizen.NUI.Devel.Tests
         [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "CONSTR")]
-        public void XamlParseExceptionConstructor2()
+        public void XamlParseExceptionConstructorWithMessage()
         {
-            tlog.Debug(tag, $"XamlParseExceptionConstructor START");
-
-            XamlParseException x2 = new XamlParseException();
+            tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage START");
 
-            x2 = null;
+            var testingTarget = new XamlParseException("myMessage", new Exception());
+            Assert.IsNotNull(testingTarget, "null XamlParseException");
+            Assert.IsInstanceOf<XamlParseException>(testingTarget, "Should return XamlParseException instance.");
 
-            tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
-            Assert.Pass("XamlParseExceptionConstructor");
+            testingTarget = null;
+            tlog.Debug(tag, $"XamlParseExceptionConstructorWithMessage END");
         }
 
         [Test]
@@ -87,30 +83,10 @@ namespace Tizen.NUI.Devel.Tests
 
             Exception e1 = new Exception();
             XamlParseException x3 = new XamlParseException("myMessage", e1);
-
+            Assert.IsNotNull(x3, "null XamlParseException");
+            Assert.IsInstanceOf<XamlParseException>(x3, "Should return XamlParseException instance.");
             x3 = null;
-            tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
-            Assert.Pass("XamlParseExceptionConstructor");
-        }
-
-        [Test]
-        [Category("P1")]
-        [Description("XamlParseException XamlParseException")]
-        [Property("SPEC", "Tizen.NUI.XamlParseException.XamlParseException C")]
-        [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "CONSTR")]
-        public void XamlParseExceptionConstructor4()
-        {
-            tlog.Debug(tag, $"XamlParseExceptionConstructor START");
-
-            Exception e1 = new Exception();
-            XmlLineInfoImplent xmlLineInfoImplent = new XmlLineInfoImplent();
-            XamlParseException x4 = new XamlParseException("myMessage", xmlLineInfoImplent, e1);
-
-            x4 = null;
-
-            tlog.Debug(tag, $"XamlParseExceptionConstructor END (OK)");
-            Assert.Pass("XamlParseExceptionConstructor");
+            tlog.Debug(tag, $"XamlParseExceptionConstructor END");
         }
 
         [Test]
@@ -122,17 +98,19 @@ namespace Tizen.NUI.Devel.Tests
         public void XamlParseExceptionXmlInfo()
         {
             tlog.Debug(tag, $"XamlParseExceptionXmlInfo START");
+
             try
             {
-                XmlLineInfoImplent xml1 = (XmlLineInfoImplent)xamlParseException.XmlInfo;
+                var result = (XmlLineInfoImpl)xamlParse.XmlInfo;
+                tlog.Debug(tag, "XmlInfo : " + result);
             }
             catch (Exception e)
             {
-                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
-                Assert.Fail("Caught Exception" + e.ToString());
+                tlog.Debug(tag, e.Message.ToString());
+                Assert.Fail("Caught Exception : Failed!");
             }
-            tlog.Debug(tag, $"XamlParseExceptionXmlInfo END (OK)");
-            Assert.Pass("XamlParseExceptionXmlInfo");
+
+            tlog.Debug(tag, $"XamlParseExceptionXmlInfo END");
         }
 
         [Test]
@@ -144,17 +122,19 @@ namespace Tizen.NUI.Devel.Tests
         public void XamlParseExceptionUnformattedMessage()
         {
             tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage START");
+
             try
             {
-                string s1 = xamlParseException.UnformattedMessage;
+                var result = xamlParse.UnformattedMessage;
+                tlog.Debug(tag, "UnformattedMessage : " + result);
             }
             catch (Exception e)
             {
-                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
-                Assert.Fail("Caught Exception" + e.ToString());
+                tlog.Debug(tag, e.Message.ToString());
+                Assert.Fail("Caught Exception : Failed!");
             }
-            tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END (OK)");
-            Assert.Pass("XamlParseExceptionUnformattedMessage");
+
+            tlog.Debug(tag, $"XamlParseExceptionUnformattedMessage END");
         }
     }
 }
\ No newline at end of file