From: chleun.moon Date: Wed, 18 Jul 2018 00:58:05 +0000 (+0900) Subject: [Network][TCSACR-160] Add TCT for ForgetAPAsync X-Git-Tag: tct5.0_m2~119^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F08%2F184408%2F6;p=test%2Ftct%2Fcsharp%2Fapi.git [Network][TCSACR-160] Add TCT for ForgetAPAsync Change-Id: Icf660d1f9c9c1f5c83cbecde0c99468f07c060fc Signed-off-by: Cheoleun Moon --- diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs index e6141e3..80e58b0 100755 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs +++ b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs @@ -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", "-")]