WiFiAP _wifiAP = null;
try
{
- await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await setUp();
ConnectionManager.ProxyAddressChanged += EventHandlerProxyAddressChanged;
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
_wifiAP.NetworkInformation.ProxyType = WiFiProxyType.Manual;
_wifiAP.NetworkInformation.ProxyAddress = "192.168.1.6:8080";
- await Task.Delay(5000);
+ await Task.Delay(3000);
Log.Info(Globals.LogTag, "GetMacAddress=" + ConnectionManager.GetMacAddress(ConnectionType.WiFi));
Log.Info(Globals.LogTag, "GetIpAddress=" + ConnectionManager.GetIPAddress(AddressFamily.IPv4));
Log.Info(Globals.LogTag, "GetProxy=" + ConnectionManager.GetProxy(AddressFamily.IPv4));
- await tearDown();
+ networkSetup.ForgetCurrentAP();
ConnectionManager.ProxyAddressChanged -= EventHandlerProxyAddressChanged;
// POSTCONDITION
await setUp();
await Task.Delay(3000);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- await Task.Delay(2000);
- }
-
[Test]
[Category("P1")]
[Description("get Id of a connection profile exist")]
* turn on a Public WiFi
* */
await setUp();
- /*TEST CODE */
+
+ /* TEST CODE */
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
Log.Info(Globals.LogTag, "GetCurrentProfile done");
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");
- await tearDown();
+ /* POSTCONDITION */
+ networkSetup.ForgetCurrentAP();
await setUp();
Log.Info(Globals.LogTag, "Finished");
}
* */
await setUp();
- /*TEST CODE */
+ /* TEST CODE */
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
var addInfor = _connectionProfile.IPv6Settings;
Assert.IsTrue(found, "Can't find IPv6 ");
Assert.AreEqual(IPConfigType.Static.ToString(), addInfor.IPConfigType.ToString(), "set IpConfigType is fail");
- await tearDown();
+ /* POSTCONDITION */
+ networkSetup.ForgetCurrentAP();
await setUp();
Log.Info(Globals.LogTag, "Finished");
}
* turn on a Public WiFi
* */
await setUp();
- /*TEST CODE */
+
+ /* TEST CODE */
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
_connectionProfile.ProxyType = ProxyType.Manual;
Assert.AreEqual(ProxyType.Manual.ToString(), _connectionProfile.ProxyType.ToString(), "Set ProxyType is fail");
- /**
- * POST CONDITION
- */
- await tearDown();
+
+ /* POSTCONDITION */
+ networkSetup.ForgetCurrentAP();
await setUp();
}
catch (NotSupportedException)
* turn on a Public WiFi
* */
await setUp();
- /*TEST CODE */
+
+ /* TEST CODE */
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
var proxy = "192.168.1.100";
_connectionProfile.ProxyAddress = proxy;
Assert.AreEqual(proxy, _connectionProfile.ProxyAddress.ToString(), "Set proxyAddress is fail");
- /**
- * POST CONDITION
- */
- await tearDown();
- await setUp();
+ /* POSTCONDITION */
+ networkSetup.ForgetCurrentAP();
+ await setUp();
}
catch (NotSupportedException)
{
return;
}
- if (isWiFiSupported && WiFiManager.IsActive)
- {
- await networkSetup.DeactivateWiFi();
- }
-
/* TEST CODE */
_currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.MMS);
Assert.IsNotNull(_currCP, "Object should be not NULL");
await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- }
-
public static void EventHandlerProfileStateChanged(object sender, EventArgs e)
{
_flag = true;
await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- }
-
private static void EventHandlerConnectionStateChangedCBState(object sender, EventArgs e)
{
if (WiFiManager.ConnectionState.ToString() == ((ConnectionStateChangedEventArgs)e).State.ToString())
*/
WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBState;
await Task.Delay(3000);
- await tearDown();
+ networkSetup.ForgetCurrentAP();
await Task.Delay(3000);
Assert.IsTrue(_flag, "Flag should be true after checking");
*/
await setUp();
_wifiAP1 = WiFiManager.GetConnectedAP();
- if (WiFiManager.IsActive)
- await tearDown();
+ networkSetup.ForgetCurrentAP();
Assert.IsFalse(_flag, "Flag should be fail before checking");
/*
await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- }
-
[Test]
[Category("P1")]
[Description("Get State of Profile")]
await setUp();
await Task.Delay(3000);
Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Connected");
- await tearDown();
+ networkSetup.ForgetCurrentAP();
await Task.Delay(2000);
Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Disconnected");
Assert.IsTrue(_flag, "ConnectionType is not changed");
await Task.Delay(3000);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- await Task.Delay(2000);
- }
-
private static void EventHandlerProfileStateChangedCB(object sender, EventArgs e)
{
_flag = true;
Assert.IsNotNull(_connectionProfile, "No Profile Found");
_connectionProfile.ProfileStateChanged += EventHandlerProfileStateChangedCB;
await Task.Delay(3000);
- await tearDown();
+ networkSetup.ForgetCurrentAP();
Log.Info(Globals.LogTag, "ConnectionProfile3=" + _connectionProfile.GetState(AddressFamily.IPv4).ToString());
await Task.Delay(3000);
Log.Info(Globals.LogTag, "ConnectionProfile5=" + _connectionProfile.GetState(AddressFamily.IPv4).ToString());
await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
- public static async Task tearDown()
- {
- await networkSetup.DeactivateWiFi();
- }
-
private static void EventHandlerRssiLevelChangedCB(object sender, EventArgs e)
{
_flag = true;
*/
WiFiManager.RssiLevelChanged += EventHandlerRssiLevelChangedCB;
await Task.Delay(3000);
- await tearDown();
+ networkSetup.ForgetCurrentAP();
await Task.Delay(3000);
await setUp();
await Task.Delay(3000);
Log.Info(Globals.LogTag, "Postconditions for each TEST");
}
- public static async Task SetUp()
+ public static async Task setUp()
{
await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
/* Precondition
* Setup WiFi type public
* */
- await SetUp();
+ await setUp();
/**
* TEST CODE
Log.Info(Globals.LogTag, "Successfully done");
// POSTCONDITION
- await SetUp();
+ await setUp();
}
catch (NotSupportedException)
{
/**
* PRE CONDITION
* */
- await SetUp();
+ await setUp();
/** TEST CODE **/
Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not connected");
_wifiAP = WiFiManager.GetConnectedAP();
/*
* PRECONDITION
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
Log.Info(Globals.LogTag, "Successfully done");
- /**
- * POSTCONDITION
- * Turn off WiFi
- * */
- await WiFiManager.DeactivateAsync();
- await Task.Delay(5000);
- // POSTCONDITION
- await SetUp();
+ /* POSTCONDITION */
+ await setUp();
}
catch (NotSupportedException)
{
try
{
// PRECONDITION
- await SetUp();
+ await setUp();
// TEST CODE
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
await _wifiAP.ForgetAPAsync();
- Task.Delay(2000);
+ await 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();
+ await setUp();
}
catch (NotSupportedException)
{
try
{
// PRECONDITION
- await SetUp();
+ await setUp();
// TEST CODE
_wifiAP = WiFiManager.GetConnectedAP();
try
{
// PRECONDITION
- await SetUp();
+ await setUp();
// TEST CODE
_wifiAP = WiFiManager.GetConnectedAP();
try
{
Log.Info(Globals.LogTag, "Update_UPDATE start");
- await SetUp();
+ await setUp();
/* TEST CODE */
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
Assert.IsTrue(task.IsCanceled, "ConnectWpsWithoutSsidAsync() isn't cancelled");
// Postcondition
- await SetUp();
+ await setUp();
}
catch (NotSupportedException)
{
Assert.IsTrue(false, "InvalidOperationException must be thrown");
// Postcondition
- await SetUp();
+ await setUp();
}
catch (InvalidOperationException ex)
{
{
try
{
- /**
- * PRE CONDITION
- * turn off WiFi
- * */
- if (WiFiManager.IsActive)
- await tearDown();
-
/** TEST CODE **/
var count = 0;
- await WiFiManager.ActivateAsync();
- await Task.Delay(5000);
+ if (!WiFiManager.IsActive)
+ {
+ await WiFiManager.ActivateAsync();
+ await Task.Delay(3000);
+ }
await WiFiManager.ScanSpecificAPAsync(networkParameter.wnPRIVATE);
var listApp = WiFiManager.GetFoundSpecificAPs();
- await Task.Delay(5000);
+ await Task.Delay(3000);
foreach (var item in listApp)
count++;
Assert.Greater(count, 0, "GetFoundSpecificAps is fail");
if (WiFiManager.IsActive)
{
Log.Info(Globals.LogTag, "WiFi is activated");
- await tearDown();
+ networkSetup.ForgetCurrentAP();
}
await setUp();
Assert.True(_flag, "Event RssiLevelChanged hasn't been call.");
/** TEST CODE */
Assert.AreEqual((int)(WiFiConnectionState.Connected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return connected after connect to WiFiAp");
- await tearDown();
+ networkSetup.ForgetCurrentAP();
Assert.AreEqual((int)(WiFiConnectionState.Disconnected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return disconnected after discnnect");
Log.Info(Globals.LogTag, "Successfully done");
* PRECONDITION
*/
if (WiFiManager.IsActive)
- await tearDown();
+ networkSetup.ForgetCurrentAP();
Assert.IsFalse(_flag, "Flag should be fail before checking");
/*