[Network][TCSACR-160] Add TCT for ForgetAPAsync 08/184408/6
authorchleun.moon <chleun.moon@samsung.com>
Wed, 18 Jul 2018 00:58:05 +0000 (09:58 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Tue, 7 Aug 2018 06:47:17 +0000 (15:47 +0900)
Change-Id: Icf660d1f9c9c1f5c83cbecde0c99468f07c060fc
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs

index e6141e3..80e58b0 100755 (executable)
@@ -477,6 +477,152 @@ namespace Tizen.Network.WiFi.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Forget AP. Check some information and state of this access point.")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ForgetAPAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task ForgetAPAsync_FORGET_AP()
+        {
+            WiFiAP _wifiAP = null;
+            try
+            {
+                // PRECONDITION
+                await SetUp();
+
+                // TEST CODE
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+                await _wifiAP.ForgetAPAsync();
+                Task.Delay(2000);
+                Assert.AreEqual(WiFiConnectionState.Disconnected.ToString(), WiFiManager.ConnectionState.ToString(), "ConnectionState of removed AP  should be is DISCONNECT");
+
+                Log.Info(Globals.LogTag, "Successfully done");
+
+                // POSTCONDITION
+                await SetUp();
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Forget AP. Check some information and state of this access point.")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ForgetAPAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task ForgetAPAsync_OBJECT_DISPOSED_EXCEPTION()
+        {
+            WiFiAP _wifiAP = null;
+            try
+            {
+                // PRECONDITION
+                await SetUp();
+
+                // TEST CODE
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+                _wifiAP.Dispose();
+                await _wifiAP.ForgetAPAsync();
+                Task.Delay(2000);
+                Assert.IsTrue(false, "ObjectDisposedException should be thrown");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (ObjectDisposedException ex)
+            {
+                Assert.IsTrue(true, "Exception occurs. Msg: " + ex.ToString());
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Forget AP. Check some information and state of this access point.")]
+        [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ForgetAPAsync M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")]
+        public static async Task ForgetAPAsync_INVALID_OPERATION_EXCEPTION()
+        {
+            WiFiAP _wifiAP = null;
+            try
+            {
+                // PRECONDITION
+                await SetUp();
+
+                // TEST CODE
+                _wifiAP = WiFiManager.GetConnectedAP();
+                Assert.IsNotNull(_wifiAP, "No WiFi connection");
+
+                await TearDown();
+                Task.Delay(2000);
+                await _wifiAP.ForgetAPAsync();
+                Task.Delay(2000);
+                Assert.IsTrue(false, "InvalidOperationException should be thrown");
+            }
+            catch (NotSupportedException)
+            {
+                Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException");
+            }
+            catch (TypeInitializationException e)
+            {
+                Assert.IsTrue(isWiFiSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException");
+            }
+            catch (InvalidOperationException ex)
+            {
+                Assert.IsTrue(true, "Exception occurs. Msg: " + ex.ToString());
+            }
+            catch (Exception ex)
+            {
+                Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
+            }
+            finally
+            {
+                if (_wifiAP != null)
+                {
+                    _wifiAP.Dispose();
+                }
+            }
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Update a WiFiAP")]
         [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.Update M")]
         [Property("SPEC_URL", "-")]