From d9657309256eb250715f0d9b8a2c32bb49a0b82a Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Thu, 26 Aug 2021 16:00:43 +0530 Subject: [PATCH] [Connection][Non-ACR][Add new test cases] Change-Id: Iec4f510b798b18c0e7f5175a87a91e462c80c20f Signed-off-by: Nishant Chaprana --- .../testcase/TSCellularAuthInformation.cs | 99 +++++++++++++++++++++- .../testcase/TSIAddressInformation.cs | 10 ++- .../testcase/TSWiFiProfile.cs | 45 ++++++++++ 3 files changed, 150 insertions(+), 4 deletions(-) diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs index f1bfcce..1684687 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs @@ -6,9 +6,9 @@ using Tizen.System; namespace Tizen.Network.Connection.Tests { /* ***********************************************************************/ - // ** Scenario + // ** Scenario // ** CellularAuthInformation test - // ** + // ** /* ***********************************************************************/ [TestFixture] @@ -206,5 +206,100 @@ namespace Tizen.Network.Connection.Tests Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } } + + [Test] + [Category("P1")] + [Description("Check Property UserName is readable and writable")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.UserName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nishant Chaprana, n.chaprana@samsung.com")] + public void UserName_PROPERTY_SET_GET() + { + try + { + /* Test Case */ + var cellularAuthInfo = new CellularAuthInformation(); + Assert.IsInstanceOf(cellularAuthInfo, "Expecting CellularAuthInformation object"); + + string userName = "userName"; + cellularAuthInfo.UserName = userName; + var actualUserName = cellularAuthInfo.UserName; + Assert.IsNotNull(actualUserName, "actualUserName value is null"); + Assert.IsInstanceOf(actualUserName, "actualUserName value is not of type string"); + Assert.AreEqual(userName, actualUserName, "actualUserName property read is not successful"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + } + + [Test] + [Category("P1")] + [Description("Check Property Password is readable and writable")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.Password A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nishant Chaprana, n.chaprana@samsung.com")] + public void Password_PROPERTY_SET_GET() + { + try + { + /* Test Case */ + var cellularAuthInfo = new CellularAuthInformation(); + Assert.IsInstanceOf(cellularAuthInfo, "Expecting CellularAuthInformation object"); + + string password = "password"; + cellularAuthInfo.Password = password; + var actualPassword = cellularAuthInfo.Password; + Assert.IsNotNull(actualPassword, "actualPassword value is null"); + Assert.IsInstanceOf(actualPassword, "actualPassword value is not of type string"); + Assert.AreEqual(password, actualPassword, "actualPassword property read is not successful"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + } + + [Test] + [Category("P1")] + [Description("Check Property AuthType is readable and writable")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.AuthType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nishant Chaprana, n.chaprana@samsung.com")] + public void AuthType_PROPERTY_SET_GET() + { + try + { + /* Test Case */ + var cellularAuthInfo = new CellularAuthInformation(); + Assert.IsInstanceOf(cellularAuthInfo, "Expecting CellularAuthInformation object"); + + cellularAuthInfo.AuthType = CellularAuthType.None; + var authType = cellularAuthInfo.AuthType; + Assert.IsNotNull(authType, "authType value is null"); + Assert.IsInstanceOf(authType, "authType value is not of type string"); + Assert.AreEqual(CellularAuthType.None.ToString(), cellularAuthInfo.AuthType.ToString(), "None Type of Auth can't set"); + + cellularAuthInfo.AuthType = CellularAuthType.Pap; + authType = cellularAuthInfo.AuthType; + Assert.IsNotNull(authType, "authType value is null"); + Assert.IsInstanceOf(authType, "authType value is not of type string"); + Assert.AreEqual(CellularAuthType.Pap.ToString(), cellularAuthInfo.AuthType.ToString(), "Pap Type of Auth can't set"); + + cellularAuthInfo.AuthType = CellularAuthType.Chap; + authType = cellularAuthInfo.AuthType; + Assert.IsNotNull(authType, "authType value is null"); + Assert.IsInstanceOf(authType, "authType value is not of type CellularAuthType"); + Assert.AreEqual(CellularAuthType.Chap.ToString(), cellularAuthInfo.AuthType.ToString(), "Chap Type of Auth can't set"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + } } } diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs index e286e0e..8d1de37 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs @@ -63,8 +63,11 @@ namespace Tizen.Network.Connection.Tests /* * TEST CODE */ - var getDns1 = iAddressInformation.Dns2; - Assert.IsTrue(!getDns1.Equals(""), "Dns1 is empty"); + var getDns1 = iAddressInformation.Dns1; + iAddressInformation.Dns1 = IPAddress.Parse("8.8.8.8"); + Assert.IsNotNull(getDns1.ToString(), "Dns1 is NULL"); + Assert.AreEqual(iAddressInformation.Dns1.ToString(), "8.8.8.8", "Dns1 read and write failed"); + iAddressInformation.Dns1 = getDns1; } catch (NotSupportedException) { @@ -113,7 +116,10 @@ namespace Tizen.Network.Connection.Tests * TEST CODE */ var getDns2 = iAddressInformation.Dns2; + iAddressInformation.Dns2 = IPAddress.Parse("8.8.8.8"); Assert.IsNotNull(getDns2.ToString(), "Dns2 is NULL"); + Assert.AreEqual(iAddressInformation.Dns2.ToString(), "8.8.8.8", "Dns2 read and write failed"); + iAddressInformation.Dns2 = getDns2; } catch (NotSupportedException) { diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs index 6de5e36..0cf6300 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs @@ -575,5 +575,50 @@ namespace Tizen.Network.Connection.Tests } } } + + [Test] + [Category("P1")] + [Description("Test SetPassphrase method Exception when argument is null")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.SetPassphrase M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Nishant Chaprana, n.chaprana@samsung.com")] + public async Task SetPassphrase_CHECK_EXCEPTION_WHEN_ARG_IS_NULL() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + */ + _wiFiProfile.SetPassphrase(null); + } + catch (NotSupportedException) + { + Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException"); + } + catch (ArgumentNullException ex) + { + Assert.IsTrue(true, "Argument is null"); + } + finally + { + if (_wiFiAp != null) + { + _wiFiAp.Dispose(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } } } -- 2.7.4