From: cheoleun moon Date: Wed, 17 Nov 2021 04:36:41 +0000 (+0900) Subject: [Connection][Non-ACR][Add postcondition] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F266669%2F1;p=test%2Ftct%2Fcsharp%2Fapi.git [Connection][Non-ACR][Add postcondition] Change-Id: Iee7db5e0d5c844411cd357109abcda384e083ffb Signed-off-by: cheoleun moon --- diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs index cac8765..7aba5ad 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs @@ -268,9 +268,6 @@ namespace Tizen.Network.Connection.Tests * TEST CODE **/ Assert.AreEqual(ConnectionState.Deactivated, ConnectionManager.WiFiState, "get WiFi_State_deactived is fail"); - - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -284,6 +281,11 @@ namespace Tizen.Network.Connection.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } + finally + { + // POSTCONDITION + await setUp(); + } } [Test] @@ -720,8 +722,6 @@ namespace Tizen.Network.Connection.Tests await Task.Delay(1500); ConnectionManager.ConnectionTypeChanged -= EventHandlerConnectionTypeChanged; Assert.IsTrue(_flag, "Event ChangeType is fail"); - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -735,6 +735,11 @@ namespace Tizen.Network.Connection.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } + finally + { + // POSTCONDITION + await setUp(); + } } public void EventHandlerConnectionTypeChanged(object sender, ConnectionTypeEventArgs e) @@ -787,6 +792,7 @@ namespace Tizen.Network.Connection.Tests } finally { + await setUp(); if (_wifiAP != null) { _wifiAP.Dispose(); @@ -825,8 +831,6 @@ namespace Tizen.Network.Connection.Tests Log.Info(Globals.LogTag, "GetProxy=" + ConnectionManager.GetProxy(AddressFamily.IPv4)); await networkSetup.ForgetCurrentAP(); ConnectionManager.ProxyAddressChanged -= EventHandlerProxyAddressChanged; - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -842,6 +846,9 @@ namespace Tizen.Network.Connection.Tests } finally { + // POSTCONDITION + await setUp(); + if (_wifiAP != null) { _wifiAP.Dispose(); @@ -880,8 +887,6 @@ namespace Tizen.Network.Connection.Tests Log.Info(Globals.LogTag, "ConnectionType=" + ConnectionManager.CurrentConnection.Type.ToString()); Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.CurrentConnection.State.ToString(), "CurrentConnection_STATE is fail"); Assert.AreEqual(ConnectionType.WiFi.ToString(), ConnectionManager.CurrentConnection.Type.ToString(), "CurrentConnection_STATE is fail"); - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -895,6 +900,11 @@ namespace Tizen.Network.Connection.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } + finally + { + // POSTCONDITION + await setUp(); + } } [Test] diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs index aa8caa0..956f87bc 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs @@ -364,9 +364,6 @@ namespace Tizen.Network.Connection.Tests Assert.AreEqual(new IPAddress(BitConverter.GetBytes(preIP)).ToString(), addInfor.IP.ToString(), "set IP is fail"); Assert.AreEqual(IPConfigType.Static.ToString(), addInfor.IPConfigType.ToString(), "set IpConfigType is fail"); - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - await setUp(); Log.Info(Globals.LogTag, "Finished"); } catch (NotSupportedException) @@ -383,6 +380,10 @@ namespace Tizen.Network.Connection.Tests } finally { + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); @@ -433,9 +434,6 @@ namespace Tizen.Network.Connection.Tests Assert.IsTrue(found, "Can't find IPv6 "); Assert.AreEqual(IPConfigType.Static.ToString(), addInfor.IPConfigType.ToString(), "set IpConfigType is fail"); - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - await setUp(); Log.Info(Globals.LogTag, "Finished"); } catch (NotSupportedException) @@ -452,6 +450,10 @@ namespace Tizen.Network.Connection.Tests } finally { + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); @@ -483,10 +485,6 @@ namespace Tizen.Network.Connection.Tests _connectionProfile.ProxyType = ProxyType.Manual; Assert.AreEqual(ProxyType.Manual.ToString(), _connectionProfile.ProxyType.ToString(), "Set ProxyType is fail"); - - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - await setUp(); } catch (NotSupportedException) { @@ -502,6 +500,10 @@ namespace Tizen.Network.Connection.Tests } finally { + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); @@ -534,10 +536,6 @@ namespace Tizen.Network.Connection.Tests var proxy = "192.168.1.100"; _connectionProfile.ProxyAddress = proxy; Assert.AreEqual(proxy, _connectionProfile.ProxyAddress.ToString(), "Set proxyAddress is fail"); - - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - await setUp(); } catch (NotSupportedException) { @@ -553,6 +551,10 @@ namespace Tizen.Network.Connection.Tests } finally { + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); @@ -602,8 +604,6 @@ namespace Tizen.Network.Connection.Tests Log.Info(Globals.LogTag, "_flag=" + _flag); Assert.IsTrue(_flag, "Profile State don't change"); _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -619,6 +619,9 @@ namespace Tizen.Network.Connection.Tests } finally { + // POSTCONDITION + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileManager.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileManager.cs index b1bec2e..b5a7fe6 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileManager.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileManager.cs @@ -359,9 +359,6 @@ namespace Tizen.Network.Connection.Tests p.Dispose(); } Assert.AreEqual(0, _numTask); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); } catch (NotSupportedException) { @@ -375,6 +372,12 @@ namespace Tizen.Network.Connection.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } + finally + { + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } } [Test] @@ -496,7 +499,6 @@ namespace Tizen.Network.Connection.Tests } Assert.IsTrue(flag, "RemoveProfile is fail"); - await setUp(); } catch (NotSupportedException) { @@ -512,6 +514,7 @@ namespace Tizen.Network.Connection.Tests } finally { + await setUp(); if (_wifiAP != null) { _wifiAP.Dispose(); @@ -672,6 +675,8 @@ namespace Tizen.Network.Connection.Tests } finally { + await setUp(); + if (_profile != null) { _profile.Dispose(); @@ -754,6 +759,8 @@ namespace Tizen.Network.Connection.Tests } finally { + await setUp(); + if (_currCP != null) { _currCP.Dispose(); @@ -806,7 +813,6 @@ namespace Tizen.Network.Connection.Tests await Task.Delay(1500); Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail"); Log.Info(Globals.LogTag, "DisconnectProfileAsync_DISCONNECT_AP finish"); - await setUp(); } catch (NotSupportedException) { @@ -822,6 +828,7 @@ namespace Tizen.Network.Connection.Tests } finally { + await setUp(); if (_profile != null) { _profile.Dispose(); diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs index b773e2f..756cb8b 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs @@ -79,8 +79,6 @@ namespace Tizen.Network.Connection.Tests await Task.Delay(1500); Assert.IsTrue(_flag, "Profile State don't change"); _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -96,6 +94,9 @@ namespace Tizen.Network.Connection.Tests } finally { + // POSTCONDITION + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionTypeEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionTypeEventArgs.cs index f3da2f7..c8bb21e 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionTypeEventArgs.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionTypeEventArgs.cs @@ -77,8 +77,6 @@ namespace Tizen.Network.Connection.Tests Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Disconnected"); Assert.IsTrue(_flag, "ConnectionType is not changed"); ConnectionManager.ConnectionTypeChanged -= ConnectionTypeChangedCB; - // POSTCONDITION - await setUp(); } } catch (NotSupportedException) @@ -93,6 +91,11 @@ namespace Tizen.Network.Connection.Tests { Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); } + finally + { + // POSTCONDITION + await setUp(); + } } public void ConnectionTypeChangedCB(object sender, ConnectionTypeEventArgs e) diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs index b3af315..76c5155 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs @@ -89,8 +89,6 @@ namespace Tizen.Network.Connection.Tests * POSTCONDITION * */ _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChangedCB; - // POSTCONDITION - await setUp(); } catch (NotSupportedException) { @@ -106,6 +104,9 @@ namespace Tizen.Network.Connection.Tests } finally { + // POSTCONDITION + await setUp(); + if (_connectionProfile != null) { _connectionProfile.Dispose(); diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs index 0cf6300..ca7f335 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs @@ -604,7 +604,7 @@ namespace Tizen.Network.Connection.Tests { Assert.IsTrue(isWiFiSupported == false, "Invalid NotSupportedException"); } - catch (ArgumentNullException ex) + catch (ArgumentNullException) { Assert.IsTrue(true, "Argument is null"); }