[Connection][Non-ACR][Add new test cases] 42/263142/2
authorNishant Chaprana <n.chaprana@samsung.com>
Thu, 26 Aug 2021 10:30:43 +0000 (16:00 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 7 Sep 2021 04:53:37 +0000 (10:23 +0530)
Change-Id: Iec4f510b798b18c0e7f5175a87a91e462c80c20f
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs
tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs
tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs

index f1bfcce..1684687 100755 (executable)
@@ -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<CellularAuthInformation>(cellularAuthInfo, "Expecting CellularAuthInformation object");
+
+                string userName = "userName";
+                cellularAuthInfo.UserName = userName;
+                var actualUserName = cellularAuthInfo.UserName;
+                Assert.IsNotNull(actualUserName, "actualUserName value is null");
+                Assert.IsInstanceOf<string>(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<CellularAuthInformation>(cellularAuthInfo, "Expecting CellularAuthInformation object");
+
+                string password = "password";
+                cellularAuthInfo.Password = password;
+                var actualPassword = cellularAuthInfo.Password;
+                Assert.IsNotNull(actualPassword, "actualPassword value is null");
+                Assert.IsInstanceOf<string>(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<CellularAuthInformation>(cellularAuthInfo, "Expecting CellularAuthInformation object");
+
+                cellularAuthInfo.AuthType = CellularAuthType.None;
+                var authType = cellularAuthInfo.AuthType;
+                Assert.IsNotNull(authType, "authType value is null");
+                Assert.IsInstanceOf<CellularAuthType>(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<CellularAuthType>(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<CellularAuthType>(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");
+            }
+        }
     }
 }
index e286e0e..8d1de37 100755 (executable)
@@ -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)
             {
index 6de5e36..0cf6300 100755 (executable)
@@ -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();
+                }
+            }
+        }
     }
 }