From e9d5564189d09d149bddd6e9d5c15ed170c12734 Mon Sep 17 00:00:00 2001 From: Cheoleun Moon Date: Tue, 6 Aug 2019 18:44:48 +0900 Subject: [PATCH] [Nsd][Non-ACR][Add catch clauses for ArgumentExeption and NotSupportedException] Change-Id: I967829306fdb2fc8116b0ab71a3917c65bb25b78 Signed-off-by: Cheoleun Moon --- tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdBrowser.cs | 9 +++++++-- tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdService.cs | 13 +++++++++++-- tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpBrowser.cs | 9 +++++++-- tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpService.cs | 13 +++++++++++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdBrowser.cs b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdBrowser.cs index 29cefbf..a2936bd 100755 --- a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdBrowser.cs +++ b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdBrowser.cs @@ -62,19 +62,24 @@ namespace Tizen.Network.Nsd.Tests [Description("Checks to create DnssdBrowser object with null parameter")] [Property("SPEC", "Tizen.Network.Nsd.DnssdBrowser.DnssdBrowser C")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTN, CONSTX")] + [Property("CRITERIA", "CONSTN")] [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] public void DnssdBrowser_INIT_CHECK_EXCEPTION() { /* TEST CODE */ try { - Assert.Throws(() => new DnssdBrowser(null)); + var browser = new DnssdBrowser(null); + Assert.IsTrue(false, "ArgumentException or NotSupportedExceptin should be thrown"); } catch (NotSupportedException) { Assert.IsTrue(s_isDnssdSupported == false, "Invalid NotSupportedException"); } + catch (ArgumentException) + { + Assert.IsTrue(true, "ArgumentException is thrown"); + } } } } diff --git a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdService.cs b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdService.cs index df083e6..a48720f 100755 --- a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdService.cs +++ b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSDnssdService.cs @@ -63,19 +63,24 @@ namespace Tizen.Network.Nsd.Tests [Description("Checks to create DnssdService object with null parameter")] [Property("SPEC", "Tizen.Network.Nsd.DnssdService.DnssdService C")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTN, CONSTX")] + [Property("CRITERIA", "CONSTN")] [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] public void DnssdService_INIT_CHECK_EXCEPTION() { /* TEST CODE */ try { - Assert.Throws(() => new DnssdService(null)); + var service = new DnssdService(null); + Assert.IsTrue(false, "ArgumentException or NotSupportedExceptin should be thrown"); } catch (NotSupportedException) { Assert.IsTrue(s_isDnssdSupported == false, "Invalid NotSupportedException"); } + catch (ArgumentException) + { + Assert.IsTrue(true); + } } [Test] @@ -626,6 +631,10 @@ namespace Tizen.Network.Nsd.Tests Assert.IsNotNull(dnssdService, "PRECONDITION: Failed to get DnssdService for testing."); dnssdService.Dispose(); } + catch (NotSupportedException) + { + Assert.IsTrue(s_isDnssdSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.Fail("There should be no exception " + e.ToString()); diff --git a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpBrowser.cs b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpBrowser.cs index 0ce65f9..5315b8b 100755 --- a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpBrowser.cs +++ b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpBrowser.cs @@ -60,19 +60,24 @@ namespace Tizen.Network.Nsd.Tests [Description("Checks to create SsdpBrowser object with null parameter")] [Property("SPEC", "Tizen.Network.Nsd.SsdpBrowser.SsdpBrowser C")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTN, CONSTX")] + [Property("CRITERIA", "CONSTN")] [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] public void SsdpBrowser_INIT_CHECK_EXCEPTION() { /* TEST CODE */ try { - Assert.Throws(() => new SsdpBrowser(null)); + var browser = new SsdpBrowser(null); + Assert.IsTrue(false, "ArgumentException or NotSupportedExceptin should be thrown"); } catch (NotSupportedException) { Assert.IsTrue(s_isSsdpSupported == false, "Invalid NotSupportedException"); } + catch (ArgumentException) + { + Assert.IsTrue(true, "ArgumentException is thrown"); + } } } } diff --git a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpService.cs b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpService.cs index 5486046..1d032b0 100755 --- a/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpService.cs +++ b/tct-suite-vs/Tizen.Nsd.Tests/testcase/TSSsdpService.cs @@ -63,19 +63,24 @@ namespace Tizen.Network.Nsd.Tests [Description("Checks to create SsdpService object with null parameter")] [Property("SPEC", "Tizen.Network.Nsd.SsdpService.SsdpService C")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTN, CONSTX")] + [Property("CRITERIA", "CONSTN")] [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")] public void SsdpService_INIT_CHECK_EXCEPTION() { /* TEST CODE */ try { - Assert.Throws(() => new SsdpService(null)); + var service = new SsdpService(null); + Assert.IsTrue(false, "ArgumentException or NotSupportedExceptin should be thrown"); } catch (NotSupportedException) { Assert.IsTrue(s_isSsdpSupported == false, "Invalid NotSupportedException"); } + catch (ArgumentException) + { + Assert.IsTrue(true, "ArgumentException is thrown"); + } } [Test] @@ -435,6 +440,10 @@ namespace Tizen.Network.Nsd.Tests Assert.IsNotNull(ssdpService, "PRECONDITION: Failed to get SsdpService for testing."); ssdpService.Dispose(); } + catch (NotSupportedException) + { + Assert.IsTrue(s_isSsdpSupported == false, "Invalid NotSupportedException"); + } catch (Exception e) { Assert.Fail("There should be no exception " + e.ToString()); -- 2.7.4