From: Cheoleun Moon Date: Mon, 28 Jan 2019 06:03:23 +0000 (+0900) Subject: [Connection/WiFi][Non-ACR][Split Network TCTs into Connection/WiFi] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ba558a24fabe4a3fb653d31f23ae8c21506fdcc;p=test%2Ftct%2Fcsharp%2Fapi.git [Connection/WiFi][Non-ACR][Split Network TCTs into Connection/WiFi] Change-Id: I691f0554d2eedf73b1f2e272e126bcbfa69b3bee Signed-off-by: Cheoleun Moon --- diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.Connection.Manual.Tests/Program.cs new file mode 100755 index 000000000..9f326eff2 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/Program.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnit.Framework; +using Xamarin.Forms; + +namespace XamarinApplication.Tizen +{ + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private Application _app; + protected override void OnCreate() + { + Console.WriteLine("TCT : OnCreate()"); + base.OnCreate(); + if (ManualTest.IsWearable()) + { + _app = new WearableTemplate.MainPage(); + } + else + { + _app = new ManualTemplate.MainPage(); + } + LoadApplication(_app); + } + + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.csproj b/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.csproj new file mode 100755 index 000000000..a171ef771 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.sln b/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.sln new file mode 100755 index 000000000..82f20dbc3 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/Tizen.Connection.Manual.Tests.sln @@ -0,0 +1,92 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Connection.Manual.Tests", "Tizen.Connection.Manual.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/shared/res/Tizen.Connection.Manual.Tests.png b/tct-suite-vs/Tizen.Connection.Manual.Tests/shared/res/Tizen.Connection.Manual.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.Connection.Manual.Tests/shared/res/Tizen.Connection.Manual.Tests.png differ diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSConnectionManager.cs b/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSConnectionManager.cs new file mode 100755 index 000000000..37b9387ea --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSConnectionManager.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Xamarin.Forms; +using Tizen.System; +using Tizen.Network.Connection; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionManager Tests")] + public class ConnectionManagerTests + { + bool isEthernetSupported = false; + private bool _flag = false; + private bool s_isEmulator = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + String model; + Information.TryGetValue("tizen.org/system/model_name", out model); + s_isEmulator = model.Equals("Emulator"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Listen Ethernet Cable State changed")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetCableStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "This should be tested using real device not emulator since unplugging ethernet cable is not supported in emulator")] + [Precondition(2, "Plug an ethernet cable into your test device")] + [Step(1, "Tap the Run button")] + [Step(2, "Unplug the ethernet cable")] + [Step(3, "Testcase will pass automatically if the EthernetCableStateChanged callback is invoked. Otherwise, it will fail")] + [Postcondition(1, "Plug an ethernet cable into your test device")] + public async Task EthernetCableStateChanged_EVENT() + { + if (s_isEmulator) + { + ManualTest.DisplayLabel("EthernetCableStateChanged_EVENT cannot be run on emulator. Please press pass"); + await ManualTest.WaitForConfirm(); + return; + } + if (isEthernetSupported == false) + { + Assert.IsTrue(true, "Cannot test cases about EthernetCableStateChanged events"); + return; + } + try + { + ConnectionManager.EthernetCableStateChanged += EventHandlerEthernetCableStateChanged; + await Task.Delay(5000); + ConnectionManager.EthernetCableStateChanged -= EventHandlerEthernetCableStateChanged; + Assert.IsTrue(_flag, "EthernetCableStateChanged event is not occurred"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + public void EventHandlerEthernetCableStateChanged(object sender, EventArgs e) + { + _flag = true; + } + } + +} diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs b/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs new file mode 100755 index 000000000..f0d7298eb --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Xamarin.Forms; +using Tizen.System; +using Tizen.Network.Connection; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.EthernetCableStateEventArgs Tests")] + public class EthernetCableStateEventArgsTests + { + public EthernetCableState _state; + public bool _event; + bool isEthernetSupported = false; + private bool s_isEmulator = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + _event = false; + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + String model; + Information.TryGetValue("tizen.org/system/model_name", out model); + s_isEmulator = model.Equals("Emulator"); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + public void EventHandlerEthernetCableStateChanged(object sender, EventArgs e) + { + _event = true; + _state = ((EthernetCableStateEventArgs)e).EthernetCableState; + } + + [Test] + [Category("P1")] + [Description("Get State of Ethernet Cable State")] + [Property("SPEC", "Tizen.Network.Connection.EthernetCableStateEventArgs.EthernetCableState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "This should be tested using real device not emulator since unplugging ethernet cable is not supported in emulator")] + [Precondition(2, "Plug an ethernet cable into your test device")] + [Step(1, "Tap the Run button")] + [Step(2, "Unplug the ethernet cable")] + [Step(3, "Testcase will pass automatically if the EthernetCableStateChanged callback is invoked and EthernetCable state is DETACHED. Otherwise, it will fail")] + [Postcondition(1, "Plug an ethernet cable into your test device")] + public async Task EthernetCableState_GET() + { + if (s_isEmulator) + { + ManualTest.DisplayLabel("EthernetCableState_GET cannot be run on emulator.Please press pass"); + await ManualTest.WaitForConfirm(); + return; + } + if (isEthernetSupported == false) + { + Assert.IsTrue(true, "Cannot test cases about EthernetCableStateChanged events"); + return; + } + try + { + ConnectionManager.EthernetCableStateChanged += EventHandlerEthernetCableStateChanged; + await Task.Delay(5000); + Assert.IsTrue(_event, "No EthernetCableStateChanged Event"); + Assert.IsTrue(_state == EthernetCableState.Detached, "Invalid EthernetCableState"); + ConnectionManager.EthernetCableStateChanged -= EventHandlerEthernetCableStateChanged; + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Connection.Manual.Tests/tizen-manifest.xml new file mode 100755 index 000000000..7ed3a3950 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Manual.Tests/tizen-manifest.xml @@ -0,0 +1,19 @@ + + + + + Tizen.Connection.Manual.Tests.png + + + + http://tizen.org/privilege/network.get + http://tizen.org/privilege/network.set + http://tizen.org/privilege/network.profile + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.Connection.Tests/Program.cs b/tct-suite-vs/Tizen.Connection.Tests/Program.cs new file mode 100755 index 000000000..87d9f975a --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/Program.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnitLite.TUnit; +using AutoTemplate; + +namespace XamarinForTizen.Tizen +{ + + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private static App _app; + protected override void OnCreate() + { + base.OnCreate(); + + Console.WriteLine("TCT : OnCreate()"); + _app = new App(); + LoadApplication(_app); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + public static App getApp() + { + return _app; + } + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.csproj b/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.csproj new file mode 100755 index 000000000..1c4ad04fc --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.sln b/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.sln new file mode 100755 index 000000000..c2d5b19cc --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/Tizen.Connection.Tests.sln @@ -0,0 +1,78 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Connection.Tests", "Tizen.Connection.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.Connection.Tests/shared/res/Tizen.Connection.Tests.png b/tct-suite-vs/Tizen.Connection.Tests/shared/res/Tizen.Connection.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.Connection.Tests/shared/res/Tizen.Connection.Tests.png differ diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSAddressEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSAddressEventArgs.cs new file mode 100755 index 000000000..6e198396e --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSAddressEventArgs.cs @@ -0,0 +1,153 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.AddressEventArgs Tests")] + public class AddressEventArgsTests + { + public bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + Log.Info(Globals.LogTag, "InitFixture"); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + _flag = false; + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + _flag = false; + } + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + [Test] + [Category("P1")] + [Description("Get State of Connection")] + [Property("SPEC", "Tizen.Network.Connection.AddressEventArgs.IPv4Address A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task IPv4Address_GET() + { + /**PRE CONDITION + * Connect to wifi AP + * */ + try + { + Log.Info(Globals.LogTag, "Ipv4Address_GET start"); + await setUp(); + + Assert.IsFalse(_flag, "_flag should be false before checking"); + ConnectionManager.IPAddressChanged += Ipv4AddressChangedCallBack; + await Task.Delay(1500); + + Log.Info(Globals.LogTag, "Ipv4AddressChanged Event subscribed"); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + await setUp(); + Log.Info(Globals.LogTag, "Network is connected"); + await Task.Delay(1500); + + Assert.IsTrue(_flag, "Ipv4Address is not changed"); + ConnectionManager.IPAddressChanged -= Ipv4AddressChangedCallBack; + } + 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()); + } + } + + public void Ipv4AddressChangedCallBack(object sender, EventArgs e) + { + Log.Info(Globals.LogTag, "IPAddress is changed"); + AddressEventArgs eventArgs = (AddressEventArgs)e; + string ipv4 = eventArgs.IPv4Address; + Log.Info(Globals.LogTag, "new IPv4Address is " + ipv4); + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Get State of Connection")] + [Property("SPEC", "Tizen.Network.Connection.AddressEventArgs.IPv6Address A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task IPv6Address_GET() + { + /**PRE CONDITION + * Connect to wifi AP + * */ + try + { + Log.Info(Globals.LogTag, "Ipv6Address_GET start"); + await setUp(); + + ConnectionManager.IPAddressChanged += Ipv6AddressChangedCallBack; + await Task.Delay(1500); + Log.Info(Globals.LogTag, "Ipv6Address_GET Ipv6AddressChanged Event subscribed"); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + await setUp(); + Log.Info(Globals.LogTag, "Network is connected"); + await Task.Delay(1500); + + Assert.IsTrue(_flag, "Ipv6Address is not changed"); + /** + * Disconnect WifiAP + * */ + ConnectionManager.IPAddressChanged -= Ipv6AddressChangedCallBack; + } + 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()); + } + } + + public void Ipv6AddressChangedCallBack(object sender, EventArgs e) + { + Log.Info(Globals.LogTag, "IPAddress is changed"); + AddressEventArgs eventArgs = (AddressEventArgs)e; + string ipv6 = eventArgs.IPv6Address; + Log.Info(Globals.LogTag, "new IPv6Address is " + ipv6); + _flag = true; + } + + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs new file mode 100755 index 000000000..f1bfcce9c --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularAuthInformation.cs @@ -0,0 +1,210 @@ +using System; +using NUnit.Framework; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + /* ***********************************************************************/ + // ** Scenario + // ** CellularAuthInformation test + // ** + /* ***********************************************************************/ + + [TestFixture] + [Description("Tizen.Network.Connection.CellularAuthInformation Tests")] + public class CellularAuthInformationTests + { + private CellularAuthInformation _cellularAuthInformation; + bool isTelephonySupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + _cellularAuthInformation = null; + } + + [Test] + [Category("P1")] + [Description("Create a CellularAuthInformation")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.CellularAuthInformation C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void CellularAuthInformation_INIT() + { + Log.Info(Globals.LogTag, "CellularAuthInformation_INIT start"); + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + CellularAuthInformation info = new CellularAuthInformation(); + Assert.IsInstanceOf(info, "Creating CellularAuthInformation is failed"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (TypeInitializationException e) + { + Assert.IsTrue(isTelephonySupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test: The authentication type.")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.AuthType M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void AuthType_SET_GET() + { + Log.Info(Globals.LogTag, "AuthType_SET_GET start"); + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + Log.Info(Globals.LogTag, "Cellular enabled"); + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + Log.Info(Globals.LogTag, "Successfully to get DefaultCellularProfile"); + _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; + Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); + Log.Info(Globals.LogTag, "Successfully to get CellularAuthInfo"); + var autherType = _cellularAuthInformation.AuthType; + Assert.IsNotNull(autherType, "AuthType is NULL"); + Log.Info(Globals.LogTag, "Successfully to get AuthType"); + _cellularAuthInformation.AuthType = CellularAuthType.Chap; + Assert.AreEqual(CellularAuthType.Chap.ToString(), _cellularAuthInformation.AuthType.ToString(), "Chap Type of Auther can't set"); + _cellularAuthInformation.AuthType = CellularAuthType.None; + Assert.AreEqual(CellularAuthType.None.ToString(), _cellularAuthInformation.AuthType.ToString(), "None Type of Auther can't set"); + _cellularAuthInformation.AuthType = CellularAuthType.Pap; + Assert.AreEqual(CellularAuthType.Pap.ToString(), _cellularAuthInformation.AuthType.ToString(), "Pap Type of Auther can't set"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test: The password")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.Password M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void Password_SET_GET() + { + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; + Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); + var autherType = _cellularAuthInformation.AuthType; + Assert.IsNotNull(autherType, "AuthType is NULL"); + if (autherType == CellularAuthType.None) + { + Assert.AreEqual("", _cellularAuthInformation.Password, "Password is not empty"); + _cellularAuthInformation.Password = "abc13579"; + Assert.AreEqual("abc13579", _cellularAuthInformation.Password, "Can't set Pass"); + } + else + { + Assert.AreNotEqual(null, _cellularAuthInformation.Password, "Password is NULL"); + _cellularAuthInformation.Password = "abc13579"; + Assert.AreEqual("abc13579", _cellularAuthInformation.Password, "Can't set Pass"); + } + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test: The UserName")] + [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.UserName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void UserName_SET_GET() + { + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; + Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); + var autherType = _cellularAuthInformation.AuthType; + Assert.IsNotNull(autherType, "AuthType is NULL"); + var userName = "TestCell"; + if (autherType == CellularAuthType.None) + { + Assert.AreEqual("", _cellularAuthInformation.UserName, "UserName is not empty"); + _cellularAuthInformation.UserName = userName; + Assert.AreEqual(userName, _cellularAuthInformation.UserName, "UserName is not equal"); + } + else + { + Assert.AreNotEqual(null, _cellularAuthInformation.UserName, "UserName is NULL"); + _cellularAuthInformation.UserName = userName; + Assert.AreEqual(userName, _cellularAuthInformation.UserName, "UserName is not equal"); + } + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularProfile.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularProfile.cs new file mode 100755 index 000000000..ed9b366e7 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSCellularProfile.cs @@ -0,0 +1,489 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + /* ***********************************************************************/ + // ** Scenario - Create/get/dispose an AP. + // ** + // ** create a public AP + // ** create a hidden AP + // ** connect to that AP + // ** get network information from that AP + // ** refesh AP + // ** + /* ***********************************************************************/ + + [TestFixture] + [Description("Tizen.Network.Connection.CellularProfile Tests")] + public class CellularProfileTests + { + + bool isTelephonySupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test: Set and get a access point name")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Apn A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void Apn_SET_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "Apn_SET_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var apnName = "TestAPN"; + Assert.AreNotEqual(apnName, _cellularProfile.Apn.ToString(), "Apn is same"); + _cellularProfile.Apn = apnName; + Assert.AreEqual(apnName, _cellularProfile.Apn.ToString(), "Apn is different"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test: Set and get a HomeUri")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.HomeUri A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void HomeUri_SET_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "HomeUri_SET_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var homeUri = "192.168.333"; + Assert.AreNotEqual(homeUri, _cellularProfile.HomeUri.ToString(), "HomeUri is same"); + _cellularProfile.HomeUri = homeUri; + Assert.AreEqual(homeUri, _cellularProfile.HomeUri.ToString(), "HomeUri is different"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + + [Test] + [Category("P1")] + [Description("Test: Set and get a service type")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.ServiceType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void ServiceType_SET_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "ServiceType_SET_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Log.Info(Globals.LogTag, "ServiceType_SET_GET out of service"); + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Log.Info(Globals.LogTag, "ServiceType_SET_GET GetDefaultCellularProfile"); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var serviceType = CellularServiceType.MMS; + Assert.AreNotEqual(serviceType.ToString(), _cellularProfile.ServiceType.ToString(), "ServiceType is same"); + _cellularProfile.ServiceType = serviceType; + Log.Info(Globals.LogTag, "ServiceType_SET_GET Set ServiceType to MMS"); + Assert.AreEqual(serviceType.ToString(), _cellularProfile.ServiceType.ToString(), "ServiceType is different"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test: Set and get a PdnType")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.PdnType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void PdnType_SET_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "PdnType_SET_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var pdnType = CellularPdnType.IPv4; + Assert.AreNotEqual(pdnType, _cellularProfile.PdnType, "PdnType is same"); + _cellularProfile.PdnType = pdnType; + Assert.AreEqual(pdnType, _cellularProfile.PdnType, "PdnType is different"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test: Set and get a RoamingPdnType")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.RoamingPdnType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void RoamingPdnType_SET_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "RoamingPdnType_SET_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var roamingPdnType = CellularPdnType.IPv4; + Assert.AreNotEqual(roamingPdnType, _cellularProfile.RoamingPdnType, "RoamingPdnType is same"); + _cellularProfile.RoamingPdnType = roamingPdnType; + Assert.AreEqual(roamingPdnType, _cellularProfile.RoamingPdnType, "RoamingPdnType is different"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test:Checks whether the profile is hidden.")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.IsRoaming A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void IsRoaming_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "IsRoaming_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.IsTrue(true, "Out of service"); + return; + } + Log.Info(Globals.LogTag, "Try to GetDefaultCellularProfile"); + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Fail to get a ConnectionProfile"); + Log.Info(Globals.LogTag, "Get default cellular profile"); + _cellularProfile = (CellularProfile)connection; + Assert.IsFalse(_cellularProfile.IsRoaming, "IsRoaming is true"); + Log.Info(Globals.LogTag, "IsRoaming_GET done"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets cellular Authentification Information.")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.CellularAuthInfo A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void CellularAuthInfo_GET_SET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "CellularAuthInfo_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + var info = _cellularProfile.CellularAuthInfo; + Assert.IsNotNull(info, "CellularAuthInfo is NULL"); + CellularAuthInformation newInfo = new CellularAuthInformation(); + newInfo.UserName = info.UserName; + newInfo.Password = info.Password; + newInfo.AuthType = info.AuthType; + _cellularProfile.CellularAuthInfo = newInfo; + Assert.AreEqual(_cellularProfile.CellularAuthInfo, newInfo, "It is failed to set CellularAuthInfo"); + Assert.True(true, "set CellularAuthInfo"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + + [Test] + [Category("P1")] + [Description("Test: Checks whether the profile is default.")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.IsDefault A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task IsDefault_GET() + { + CellularProfile _cellularProfile = null; + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + Log.Info(Globals.LogTag, "IsDefault_GET start"); + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + Log.Info(Globals.LogTag, "IsDefault_GET GetDefaultCellularProfile"); + await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.Internet, connection); + Log.Info(Globals.LogTag, "IsDefault_GET SetDefaultCellularProfile"); + connection = null; + connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + Assert.IsTrue(_cellularProfile.IsDefault, "CellularProfile don't must default"); + Log.Info(Globals.LogTag, "IsDefault_GET Done"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test:Checks whether the profile is hidden.")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Hidden A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void Hidden_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "Hidden_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.IsTrue(true, "Out of service"); + return; + } + Log.Info(Globals.LogTag, "Hidden_GET try to GetDefaultCellularProfile"); + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + Log.Info(Globals.LogTag, "Hidden_GET Get default cellular profile"); + _cellularProfile = (CellularProfile)connection; + Assert.IsFalse(_cellularProfile.Hidden, "Hidden is true"); + Log.Info(Globals.LogTag, "Hidden_GET done"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test:Checks whether the profile is editable.")] + [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Editable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void Editable_GET() + { + CellularProfile _cellularProfile = null; + try + { + Log.Info(Globals.LogTag, "Editable_GET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Log.Info(Globals.LogTag, "Out of service"); + Assert.IsTrue(true, "Out of service"); + return; + } + Log.Info(Globals.LogTag, "After if"); + var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); + _cellularProfile = (CellularProfile)connection; + Assert.IsTrue(_cellularProfile.Editable, "Editable is fail"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.Fail("Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_cellularProfile != null) + { + _cellularProfile.Dispose(); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionItem.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionItem.cs new file mode 100755 index 000000000..ef385fc5a --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionItem.cs @@ -0,0 +1,127 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionItem Tests")] + public class ConnectionItemTests + { + bool isWiFiSupported = false; + bool isEthernetSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + /* + if (!WiFiManager.IsActive) + await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + */ + } + + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("Get Type of CurrrentConnection")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionItem.Type A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task ConnectionItem_Type_GET() + { + Log.Info(Globals.LogTag, "ConnectionItem_Type_GET start"); + try + { + /** + * PRE CONDITION + */ + + await setUp(); + + /** + * TEST CODE + */ + + Assert.AreEqual(ConnectionType.WiFi, ConnectionManager.CurrentConnection.Type, "ConnectionItem_Type_GET is fail"); + + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Get State of CurrrentConnection")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionItem.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task ConnectionItem_State_GET() + { + try + { + /** + * PRE CONDITION + */ + Log.Info(Globals.LogTag, "ConnectionItem_State_GET start"); + + await setUp(); + + /** + * TEST CODE + */ + Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.CurrentConnection.State.ToString(), "CurrentConnction_STATE is fail"); + + /** + * POST CONDITION + */ + } + 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()); + } + } + } // end class +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs new file mode 100755 index 000000000..6244599ce --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionManager.cs @@ -0,0 +1,1076 @@ +using System; +using System.Net; +using Tizen.Network.WiFi; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + /* ***********************************************************************/ + // ** Scenario - Manage all connection info of mobile. + // ** + // ** connect to an AP before run this class: example: "WiFi_public" + // ** setup an AP: name/securetype is "WiFi_public"/public, connect to it mannually first + // ** get IP, MAC, proxy of connected AP + // ** caught events + // ** + /* ***********************************************************************/ + + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionManager Tests")] + public class ConnectionManagerTests + { + private string _nameWiFi; + private string _getted; + private bool _flag = false; + bool isWiFiSupported = false; + bool isTelephonySupported = false; + bool isBTTetheringSupported = false; + bool isEthernetSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _getted = null; + _nameWiFi = null; + _flag = false; + + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); + Information.TryGetValue("http://tizen.org/feature/network.tethering.bluetooth", out isBTTetheringSupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + _nameWiFi = networkParameter.wnPRIVATE; + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + public async Task tearDown() + { + _nameWiFi = null; + await networkSetup.DeactivateWiFi(); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("Get bluetoothState")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.BluetoothState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public void BluetoothState_DEACIVATED_STATE() + { + try + { + /** + * PRECONDITION: + * turn off bluettooth + * */ + Log.Info(Globals.LogTag, "BluetoothState_DEACIVATED_STATE start"); + /** + * TEST CODE + **/ + Log.Info(Globals.LogTag, "BluetoothState_DEACIVATED_STATE ConnectionManager is created"); + Assert.AreEqual(ConnectionState.Deactivated, ConnectionManager.BluetoothState, "get BluetoothState is fail"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isBTTetheringSupported == false, "Invalid NotSupportedException"); + } + catch (TypeInitializationException e) + { + Assert.IsTrue(isBTTetheringSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + + [Test] + [Category("P1")] + [Description("Get CellularState with ")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CellularState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task CellularState_CONNECTED_STATE() + { + /** + * PRECONDITION: + * close WiFi Connection + */ + Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE start"); + Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE ConnectionManager created"); + if (isWiFiSupported && WiFiManager.IsActive) + await tearDown(); + await Task.Delay(10000); + + Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE WiFi is disconnected"); + /** + * TEST CODE + **/ + try + { + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + + Assert.AreEqual(CellularState.Connected, ConnectionManager.CellularState, "get Cellular_Connected_State is fail"); + + // POSTCONDITION + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + } + + [Test] + [Category("P1")] + [Description("Get WiFiState with connected type")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task WiFiState_CONNECTED_STATE() + { + try + { + /** + * PRECONDITION: + * open WiFi Private + * */ + Log.Info(Globals.LogTag, "WiFiState_CONNECTED_STATE start"); + await setUp(); + + /** + * TEST CODE + **/ + Log.Info(Globals.LogTag, "WiFiState: " + ConnectionManager.WiFiState.ToString()); + Assert.AreEqual(ConnectionState.Connected, ConnectionManager.WiFiState, "Invalid WiFiState"); + } + 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) + { + if (isWiFiSupported == false) + Assert.IsInstanceOf(ex, "NotSupportedException should be thrown for not supported sensor"); + else + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + + [Test] + [Category("P1")] + [Description("Get WiFiState with disconnected type")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task WiFiState_DISCONNECTED_STATE() + { + WiFiAP _wifiAP = null; + try + { + /** + * PRECONDITION: + * turn off WiFi + * */ + Log.Info(Globals.LogTag, "WiFiState_DISCONNECTED_STATE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + await _wifiAP.ForgetAPAsync(); + await Task.Delay(1500); + + /** + * TEST CODE + **/ + Log.Info(Globals.LogTag, "WiFiState: " + ConnectionManager.WiFiState.ToString()); + Assert.AreEqual(ConnectionState.Disconnected, ConnectionManager.WiFiState, "get WiFi_State_disconnected is fail"); + + 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("P1")] + [Description("Get WiFiState with deactivated type")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task WiFiState_DEACTIVATED_STATE() + { + try + { + /** + * PRECONDITION: + * turn off WiFi + * */ + Log.Info(Globals.LogTag, "WiFiState_DEACTIVATED_STATE start"); + if (WiFiManager.IsActive) + await tearDown(); + + /** + * TEST CODE + **/ + Assert.AreEqual(ConnectionState.Deactivated, ConnectionManager.WiFiState, "get WiFi_State_deactived is fail"); + + // 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()); + } + } + + [Test] + [Category("P1")] + [Description("Get WiFiState with deactivated type")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public void EthernetState_DEACTIVATED_STATE() + { + try + { + Log.Info(Globals.LogTag, "EthernetState_DEACTIVATED_STATE start"); + /** + * TEST CODE + **/ + Assert.IsTrue((ConnectionState.Deactivated == ConnectionManager.EthernetState) || + (ConnectionState.Disconnected == ConnectionManager.EthernetState) || + (ConnectionState.Connected == ConnectionManager.EthernetState), "get EthernetState_State_deactivated is fail"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isEthernetSupported == false, "Invalid NotSupportedException"); + } + catch (TypeInitializationException e) + { + Assert.IsTrue(isEthernetSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Get EthernetCableState")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetCableState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public void EthernetCableState_GET() + { + try + { + Log.Info(Globals.LogTag, "EthernetCableState_GET start"); + /** + * TEST CODE + **/ + Assert.IsTrue((EthernetCableState.Detached == ConnectionManager.EthernetCableState) || + (EthernetCableState.Attached == ConnectionManager.EthernetCableState), "get EthernetCableState_State_detached is fail"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isEthernetSupported == false, "Invalid NotSupportedException"); + } + catch (TypeInitializationException e) + { + Assert.IsTrue(isEthernetSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Get CurrentConnection with WiFi item")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CurrentConnection A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task CurrentConnection_WiFi_ITEM() + { + Log.Info(Globals.LogTag, "CurrentConnection_WiFi_ITEM start"); + try + { + /** + * PRE CONDITION + * create a connection to WiFi public/private + * */ + await setUp(); + + /** + * TEST CODE + * */ + Assert.AreEqual(ConnectionState.Connected, ConnectionManager.CurrentConnection.State, "CurrentConnection_WiFi_ITEM is fail"); + Assert.AreEqual(ConnectionType.WiFi, ConnectionManager.CurrentConnection.Type, "CurrentConnection_WiFi_ITEM is fail"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Get Ipv4 of device: dynamic")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetIPAddress M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task GetIPAddress_DYNAMIC_IPV4() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Get connect AP + */ + Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 start"); + await setUp(); + Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 WiFi Connected"); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 BEFORE=" + _wifiAP.NetworkInformation.IPv4Setting.IP); + + /* TEST CODE */ + _getted = ConnectionManager.GetIPAddress(AddressFamily.IPv4).ToString(); + Log.Info(Globals.LogTag, "GetIpAddress AFTER=" + _getted); + Assert.IsNotNull(_getted, "Ipv4 get from manager should be not null"); + Assert.AreEqual((string)_getted, _wifiAP.NetworkInformation.IPv4Setting.IP.ToString(), "Ipv4 get from manager and from connected AP should be equal"); + } + 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("P1")] + [Description("Get all IPv6 addresses of device: dynamic")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetAllIPv6Addresses M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetAllIPv6Addresses_WIFI_PROFILE() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Get connect AP + */ + Log.Info(Globals.LogTag, "GetAllIPv6Addresses_ALL_TYPE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); + + /* TEST CODE */ + var list = ConnectionManager.GetAllIPv6Addresses(ConnectionType.WiFi); + Assert.IsNotNull(list, "GetAllIPv6Address fails"); + } + 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("P1")] + [Description("Get proxy of device")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetProxy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task GetProxy_RETURN_VALUE_IPV4_IPV6() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * Connect to WiFi Public/Private AP + */ + Log.Info(Globals.LogTag, "GetProxy_RETURN_VALUE_IPV4_IPV6 start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); + /** + * TEST CODE + * */ + _getted = ConnectionManager.GetProxy(AddressFamily.IPv4); + Assert.IsNotNull(_getted, "Ipv4 get from manager should be not null"); + _getted = ConnectionManager.GetProxy(AddressFamily.IPv6); + Assert.IsNotNull(_getted, "Ipv6 get from manager should be not null"); + } + 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("P1")] + [Description("Get mac address of device")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetMacAddress M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task GetMacAddress_ALL_CONNECTION_TYPE() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Bluetooth, SIM card inserted. + */ + Log.Info(Globals.LogTag, "GetMacAddress_ALL_CONNECTION_TYPE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); + + /* TEST CODE */ + /*--------------------WiFi mac address------------------*/ + _getted = ConnectionManager.GetMacAddress(ConnectionType.WiFi); + Assert.IsNotNull((string)_getted, "MacAddress of WiFi get from manager should be not null"); + /*compare to WiFimanager*/ + var getted = WiFiManager.MacAddress; + Console.WriteLine("HYUKIN _getted:" + _getted); + Console.WriteLine("HYUKIN getted:" + getted); + Assert.AreEqual(_getted, getted, "MacAddress get from WiFiManager and from manager should be equal"); + } + 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("P1")] + [Description("Get statistics")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetStatistics M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR, MAE")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetStatistics_ALL_STATISTICS_TYPE() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Bluetooth, SIM card inserted. + */ + Log.Info(Globals.LogTag, "GetStatistics_ALL_CONNECTION_TYPE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); + + /* TEST CODE */ + var data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData); + Log.Info(Globals.LogTag, "LastReceivedData: " + data); + Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); + data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData); + Log.Info(Globals.LogTag, "LastSentData: " + data); + Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); + data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData); + Log.Info(Globals.LogTag, "TotalReceivedData: " + data); + Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); + data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData); + Log.Info(Globals.LogTag, "TotalSentData: " + data); + Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); + } + 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("P1")] + [Description("Reset statistics")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ResetStatistics M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR, MAE, MCST")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task ResetStatistics_ALL_STATISTICS_TYPE() + { + try + { + Log.Info(Globals.LogTag, "ResetStatistics_ALL_CONNECTION_TYPE start"); + await tearDown(); + + ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData); + Log.Info(Globals.LogTag, "Reset LastReceivedData"); + Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData), "Reset LastReceivedData failed"); + ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData); + Log.Info(Globals.LogTag, "Reset LastSentData"); + Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData), "Reset LastSentData failed"); + ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData); + Log.Info(Globals.LogTag, "Reset TotalReceivedData"); + Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData), "Reset TotalReceivedData failed"); + ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData); + Log.Info(Globals.LogTag, "Reset TotalSentData"); + Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData), "Reset TotalSentData failed"); + + // 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()); + } + } + + [Test] + [Category("P1")] + [Description("Listen connection type changed event")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ConnectionTypeChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task ConnectionTypeChanged_EVENT() + { + try + { + /** + * PRE CONDITION + * create a connection to WiFi public/private AP + * */ + Log.Info(Globals.LogTag, "ConnectionTypeChanged_EVENT start"); + await setUp(); + /** + * TEST CODE + * */ + ConnectionManager.ConnectionTypeChanged += EventHandlerConnectionTypeChanged; + await Task.Delay(1500); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + ConnectionManager.ConnectionTypeChanged -= EventHandlerConnectionTypeChanged; + Assert.IsTrue(_flag, "Event ChangeType is fail"); + // 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()); + } + } + + public void EventHandlerConnectionTypeChanged(object sender, ConnectionTypeEventArgs e) + { + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Listen IpAddess changed")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.IPAddressChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task IPAddressChanged_EVENT() + { + WiFiAP _wifiAP = null; + try + { + /** + * PRE CONDITION + * create a connection to WiFi public/private + * */ + Log.Info(Globals.LogTag, "IpAddressChanged_EVENT start"); + ConnectionManager.IPAddressChanged += EventHandlerIpAddressChanged; + await Task.Delay(1500); + await setUp(); + /** + * TEST CODE + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + await _wifiAP.ForgetAPAsync(); + await Task.Delay(1500); + await setUp(); + ConnectionManager.IPAddressChanged -= EventHandlerIpAddressChanged; + Assert.IsTrue(_flag, "Event ChangeType is fail"); + } + 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(); + } + } + } + + public void EventHandlerIpAddressChanged(object sender, AddressEventArgs e) + { + Log.Info(Globals.LogTag, "IP is changed: " + e.IPv4Address); + _flag = true; + } + + [Test] + [Category("P1")] + [Description("listen ProxyAddressChanged event")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ProxyAddressChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task ProxyAddressChanged_EVENT() + { + Log.Info(Globals.LogTag, "ProxyAddressChanged_EVENT start"); + WiFiAP _wifiAP = null; + try + { + 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(1500); + 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 networkSetup.ForgetCurrentAP(); + ConnectionManager.ProxyAddressChanged -= EventHandlerProxyAddressChanged; + // 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(); + } + } + } + + public void EventHandlerProxyAddressChanged(object sender, AddressEventArgs e) + { + Log.Info(Globals.LogTag, "Proxy is changed: " + e.IPv4Address); + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Get CurrentConnection with WiFi item")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CurrentConnection A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Thao, nguyen.thao@samsung.com")] + public async Task CurrentConnection_Get_Connected_State_WiFi() + { + Log.Info(Globals.LogTag, "CurrentConnection_Get_Connected_State_WiFi start"); + try + { + /** + * PRE CONDITION + * create a connection to WiFi public + * */ + await setUp(); + Log.Info(Globals.LogTag, "Connected to public AP"); + /** + * TEST CODE + * */ + Log.Info(Globals.LogTag, "ConnectionState=" + ConnectionManager.CurrentConnection.State.ToString()); + 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) + { + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test CreateRequestProfile method with Cellular type")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CreateCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + public void CreateCellularProfile_CELLULAR() + { + try + { + Log.Info(Globals.LogTag, "CreateCellularProfile_CELLULAR start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + CellularProfile rCP = null; + string _key = "RequestCellularProfile"; + rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, _key); + Assert.IsNotNull(rCP, "object should not be null after INIT"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (TypeInitializationException e) + { + Assert.IsTrue(isTelephonySupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); + } + catch (Exception ex) + { + Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test AddRoute Method")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.AddRoute M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task AddRoute_WiFi() + { + try + { + Log.Info(Globals.LogTag, "AddRoute_WiFi start"); + + await setUp(); + var hostAddress = IPAddress.Parse("1.1.1.1"); + var gateway = IPAddress.Parse("192.168.0.1"); + ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); + Assert.True(true, "AddRoute"); + } + 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.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Test if AddRoute method throws ArgumentNullException")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.AddRoute M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task AddRoute_ARGUMENTNULLEXCEPTION() + { + try + { + Log.Info(Globals.LogTag, "AddRoute_ARGUMENTNULLEXCEPTION start"); + + await setUp(); + ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", null, null); + Assert.True(false, "Should throw ArgumentNullException"); + } + 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 (ArgumentNullException) + { + Assert.True(true, "AddRoute fails"); + } + catch (Exception ex) + { + Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("Test RemoveRoute Method")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.RemoveRoute M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task RemoveRoute_WiFi() + { + try + { + Log.Info(Globals.LogTag, "RemoveRoute_WiFi start"); + + await setUp(); + var hostAddress = IPAddress.Parse("1.1.1.1"); + var gateway = IPAddress.Parse("192.168.0.1"); + ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); + ConnectionManager.RemoveRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); + Assert.True(true, "RemoveRoute"); + } + 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.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P2")] + [Description("Test if RemoveRoute method throws ArgumentNullException")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.RemoveRoute M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task RemoveRoute_ARGUMENTNULLEXCEPTION() + { + try + { + Log.Info(Globals.LogTag, "RemoveRoute_ARGUMENTNULLEXCEPTION start"); + + await setUp(); + var hostAddress = IPAddress.Parse("1.1.1.1"); + var gateway = IPAddress.Parse("192.168.0.1"); + ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); + ConnectionManager.RemoveRoute(AddressFamily.IPv4, "wlan0", null, null); + Assert.True(false, "Should throw ArgumentNullException"); + } + 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 (ArgumentNullException) + { + Assert.True(true, "RemoveRoute fails"); + } + catch (Exception ex) + { + Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + } // end class +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs new file mode 100755 index 000000000..aa8caa09a --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfile.cs @@ -0,0 +1,629 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using System.Net; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionProfile Tests")] + public class ConnectionProfileTests + { + public bool _flag; + bool isWiFiSupported = false; + bool isEthernetSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("get Id of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Id A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task Id_GET() + { + Log.Info(Globals.LogTag, "Id_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.IsNotNull((string)_connectionProfile.Id, "ID is null"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("get InterfaceName of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.InterfaceName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task InterfaceName_GET() + { + Log.Info(Globals.LogTag, "InterfaceName_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.IsNotNull((string)_connectionProfile.InterfaceName, "InterfaceName is null"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("get ProfileState of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.GetState M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetState_IPV4() + { + Log.Info(Globals.LogTag, "GetState_IPV4 start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.AreEqual(ProfileState.Connected.ToString(), _connectionProfile.GetState(AddressFamily.IPv4).ToString(), "get state is fail"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("refresh profile informations")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Refresh M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task Refresh_REFRESH() + { + Log.Info(Globals.LogTag, "Refresh_REFRESH start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + _connectionProfile.Refresh(); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("get Name of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Name A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task Name_GET() + { + Log.Info(Globals.LogTag, "Name_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) + { + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.IsTrue(_connectionProfile.Name.Contains("eth"), "get name is fail"); + } + else + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.AreEqual((string)networkParameter.wnPRIVATE, (string)_connectionProfile.Name, "get name is fail"); + } + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("get Type of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Type A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task Type_GET() + { + Log.Info(Globals.LogTag, "Type_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) + { + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.AreEqual(ConnectionProfileType.Ethernet, _connectionProfile.Type, "get Type is fail"); + } + else + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Assert.AreEqual(ConnectionProfileType.WiFi, _connectionProfile.Type, "get Type is fail"); + } + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("set and get a IPV4 of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.IPv4Settings A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task IPv4Settings_SET_GET() + { + Log.Info(Globals.LogTag, "IPv4Settings_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + Log.Info(Globals.LogTag, "GetCurrentProfile done"); + Log.Info(Globals.LogTag, "Get IPv4 information"); + var addInfor = _connectionProfile.IPv4Settings; + var preIP = 3456; + var preSubnet = "255.255.0.0"; + var preGateway = 234567; + Assert.IsNotNull(addInfor, "Ipv4Settings is NULL"); + addInfor.IPConfigType = IPConfigType.Static; + Log.Info(Globals.LogTag, "Set IPv4 information " + new IPAddress(preIP).ToString()); + addInfor.IP = new IPAddress(preIP); + Log.Info(Globals.LogTag, "addInfor.IP " + addInfor.IP.ToString()); + addInfor.SubnetMask = IPAddress.Parse(preSubnet); + addInfor.Gateway = new IPAddress(preGateway); + ConnectionProfileManager.UpdateProfile(_connectionProfile); + Assert.AreEqual(new IPAddress(BitConverter.GetBytes(preGateway)).ToString(), addInfor.Gateway.ToString(), "set Gateway is fail"); + 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) + { + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("set and get a IPV6 of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.IPv6Settings A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task IPv6Settings_SET_GET() + { + Log.Info(Globals.LogTag, "IPv6Settings_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var addInfor = _connectionProfile.IPv6Settings; + Assert.IsNotNull(addInfor, "Ipv4Settings is NULL"); + var preIP = "fe80::202:b3ff:fe1e:8329"; + addInfor.IPConfigType = IPConfigType.Static; + addInfor.IP = IPAddress.Parse(preIP); + ConnectionProfileManager.UpdateProfile(_connectionProfile); + await Task.Delay(3000); + + bool found = false; + var IPList = ConnectionManager.GetAllIPv6Addresses(ConnectionType.WiFi); + foreach (IPAddress item in IPList) + { + Log.Info(Globals.LogTag, "IPv6 Address: " + item.ToString()); + if (item.ToString().Equals(preIP)) + { + found = true; + break; + } + } + 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) + { + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("set and get a ProxyType of a connection profile exist")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProxyType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ProxyType_SET_GET() + { + Log.Info(Globals.LogTag, "ProxyType_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + + _connectionProfile.ProxyType = ProxyType.Manual; + Assert.AreEqual(ProxyType.Manual.ToString(), _connectionProfile.ProxyType.ToString(), "Set ProxyType is fail"); + + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test ProxyAddress property of a connection profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProxyAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ProxyAddress_SET_GET() + { + Log.Info(Globals.LogTag, "ProxyAddress_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + + /* 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"); + + /* POSTCONDITION */ + await networkSetup.ForgetCurrentAP(); + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + public void EventHandlerProfileStateChanged(object sender, ProfileStateEventArgs e) + { + _flag = true; + Log.Info(Globals.LogTag, "ProfileState" + e.State); + } + + [Test] + [Category("P1")] + [Description("Check ProfileStateChanged event action")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProfileStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ProfileStateChanged_CHECK_EVENT() + { + Log.Info(Globals.LogTag, "ProfileStateChanged_CHECK_EVENT start"); + ConnectionProfile _connectionProfile = null; + Log.Info(Globals.LogTag, "ProfileStateChanged_CHECK_EVENT start"); + try + { + await setUp(); + var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPRIVATE) + { + Log.Info(Globals.LogTag, "Find " + networkParameter.wnPRIVATE); + _connectionProfile = i; + break; + } + i.Dispose(); + } + + Assert.IsNotNull(_connectionProfile, "No Profile Found"); + _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged; + await Task.Delay(1500); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + Log.Info(Globals.LogTag, "_flag=" + _flag); + Assert.IsTrue(_flag, "Profile State don't change"); + _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; + // 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 (_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 new file mode 100755 index 000000000..b1bec2e46 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileManager.cs @@ -0,0 +1,984 @@ +using System; +using Tizen.Network.Connection; +using Tizen.Network.WiFi; +using System.Collections.Generic; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + /* ***********************************************************************/ + // ** Scenario - Manage all connection info of mobile. + // ** + // ** connect to an AP before run this class: example: "WiFi_public" + // ** setup an AP: name/securetype is "WiFi_public"/public, connect to it mannually first + // ** get IP, MAC, proxy of connected AP + // ** caught events + // ** + /* ***********************************************************************/ + + [TestFixture] + [Description("Tizen.Network.ConnectionProfileManager Tests")] + public class ConnectionProfileManagerTests + { + IEnumerable _list; + private int _numTask; + bool isWiFiSupported = false; + bool isTelephonySupported = false; + bool isBTTetheringSupported = false; + bool isEthernetSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); + Information.TryGetValue("http://tizen.org/feature/network.tethering.bluetooth", out isBTTetheringSupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + public async Task tearDown() + { + await networkSetup.DeactivateWiFi(); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("Get a DefaultCellularProfile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public void GetDefaultCellularProfile_TYPE_INTERNET() + { + try + { + Log.Info(Globals.LogTag, "GetDefaultCellularProfile_TYPE_INTERNET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + /* + * Preconditions: + * Insert Simcard in devices and turn off WiFi + */ + /* TEST CODE */ + var currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(currCP, "GetDefaultCellularProfile is fail"); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test]/*FIXME: this function: GetDefaultCellularProfile_TYPE_MMS does not work in this binary*/ + [Category("P1")] + [Description("get a default Cellular Profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetDefaultCellularProfile_TYPE_MMS() + { + try + { + Log.Info(Globals.LogTag, "GetDefaultCellularProfile_TYPE_MMS start"); + /* + * Preconditions: + * Insert Simcard in devices and turn off WiFi + */ + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + + if (isWiFiSupported && WiFiManager.IsActive) + await tearDown(); + + /* TEST CODE */ + var connectProfile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(connectProfile, "Can't get current profile"); + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test]/*FIXME: this function: SetDefaultCellularProfile_TYPE_MMS does not work in this binary*/ //hangon + [Category("P1")] + [Description("set a default Cellular Profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.SetDefaultCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task SetDefaultCellularProfile_TYPE_MMS() + { + try + { + Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_MMS start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + + if (isWiFiSupported && WiFiManager.IsActive) + await tearDown(); + + var connectProfile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.MMS); + Assert.IsNotNull(connectProfile, "getCellular is Null"); + await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.MMS, connectProfile); + Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_MMS Finish"); + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + } + + [Test] + [Category("P1")] + [Description("GetDefaultCellularProfile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task GetDefaultCellularProfile_SIM_INSERTED() + { + ConnectionProfile _currCP = null; + + try + { + /* + * Preconditions: + * Insert Simcard in devices and turn off WiFi + */ + Log.Info(Globals.LogTag, "GetDefaultCellularProfile_SIM_INSERTED start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + + /* TEST CODE */ + _currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.MMS); + Assert.IsNotNull(_currCP, "Object should be not NULL"); + _currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Assert.IsNotNull(_currCP, "Object should be not NULL"); + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_currCP != null) + { + _currCP.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Get list of profile, which is Registered on mobile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync ME")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Tan, nguyen.vtan@samsung.com")] + public async Task GetProfileListAsync_REGISTERED() + { + try + { + /* + * Preconditions: + * -your mobile connected to some APs before, + * -WiFi turn on, + * -your mobile connected to an AP now + * -bluetooth turn on, + * -SIM card inserted + * + * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time + */ + Log.Info(Globals.LogTag, "GetProfileListAsync_REGISTERED start"); + await setUp(); + + /* TEST CODE*/ + _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + _numTask = 0; + foreach (var p in _list) + { + //Console.WriteLine("Profilexx:" + p.Name); + _numTask++; + p.Dispose(); + } + Assert.Greater(_numTask, 0, "GetProfileListAsync is fail"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Get list of profile, which is type Connnected")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetProfileListAsync_PROFILE_TYPE_CONNECTED() + { + try + { + /* + * Preconditions: + * WiFi turn on, + * your mobile connected to an AP now, + * + * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time + */ + Log.Info(Globals.LogTag, "GetProfileListAsync_PROFILE_TYPE_CONNECTED start"); + await setUp(); + + /*TEST CODE*/ + _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); + _numTask = 0; + foreach (var p in _list) + { + if (p.Type == ConnectionProfileType.WiFi) + _numTask++; + p.Dispose(); + } + Assert.AreEqual(1, _numTask); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Get list of profile, which is type Connnected")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetProfileListAsync_PROFILE_TYPE_CONNECTED_NONE() + { + try + { + /* + * Preconditions: + * WiFi turn off, + * your mobile do not connect to any AP now, + * + * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time + */ + Log.Info(Globals.LogTag, "GetProfileListAsync_PROFILE_TYPE_CONNECTED_NONE start"); + if (isWiFiSupported && WiFiManager.IsActive) + await tearDown(); + + /*TEST CODE*/ + _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); + _numTask = 0; + foreach (var p in _list) + { + if (p.Type == ConnectionProfileType.WiFi) + _numTask++; + p.Dispose(); + } + Assert.AreEqual(0, _numTask); + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + 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()); + } + } + + [Test] + [Category("P1")] + [Description("get Current profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetCurrentProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetCurrentProfile_RETURN_VALUE() + { + ConnectionProfile _currCP = null; + WiFiAP _wifiAP = null; + Log.Info(Globals.LogTag, "GetCurrentProfile_RETURN_VALUE start"); + try + { + if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) + { + Log.Info(Globals.LogTag, "Ethernet is connected"); + _currCP = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_currCP); + Assert.IsTrue(_currCP.Name.Contains("eth"), "get name is fail"); + } + else + { + /* + * Preconditions: + * WiFi turn on, + * your mobile connected to an AP: example: "WiFi_public" now, + * + * GetCurrentProfile: return current profiles which your mobile connected at that time + */ + await setUp(); + /*Connect to an online AP*/ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + + /* TEST CODE + * Get current profile + */ + _currCP = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_currCP); + Assert.AreEqual(_wifiAP.NetworkInformation.Essid.ToString(), _currCP.Name.ToString(), "WiFi manager should get right current profile"); + } + } + 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 (_currCP != null) + { + _currCP.Dispose(); + } + if (_wifiAP != null) + { + _wifiAP.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Remove a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.RemoveProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task RemoveProfile_REMOVE() + { + WiFiAP _wifiAP = null; + ConnectionProfile _profile = null; + try + { + /* + * Preconditions: + * WiFi turn on, + * your mobile connected to an AP: example: "WiFi_private" now, + * + * GetCurrentProfile: return current profiles which your mobile connected at that time + */ + Log.Info(Globals.LogTag, "RemoveProfile_REMOVE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + + /* TEST CODE */ + var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); + foreach (var item in list) + { + if (item.Name == networkParameter.wnPRIVATE) + { + _profile = item; + break; + } + item.Dispose(); + } + + ConnectionProfileManager.RemoveProfile(_profile); + list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); + bool flag = true; + foreach (var item in list) + { + if (item.Name == networkParameter.wnPRIVATE) + { + flag = false; + break; + } + item.Dispose(); + } + + Assert.IsTrue(flag, "RemoveProfile is fail"); + 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(); + } + if (_profile != null) + { + _profile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Remove a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.RemoveProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task RemoveProfile_REMOVE_TYPE_CELLULAR() + { + try + { + /** + * PRECONDITION + * turn off WiFi + * */ + Log.Info(Globals.LogTag, "RemoveProfile_REMOVE_TYPE_CELLULAR start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Log.Info(Globals.LogTag, "Out of service"); + Assert.IsTrue(true, "Out of service"); + return; + } + if (isWiFiSupported && WiFiManager.IsActive) + { + await tearDown(); + Log.Info(Globals.LogTag, "WiFi deactivated"); + } + //TEST CODE + CellularProfile rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, "TestCellular"); + rCP.ServiceType = CellularServiceType.Internet; + ConnectionProfileManager.AddCellularProfile(rCP); + Log.Info(Globals.LogTag, "AddCellularProfile is completed"); + //check new profile exits + var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + bool mFlag = false; + foreach (var item in list) + { + Log.Info(Globals.LogTag, "profile: " + item.Name); + if (item.Name == "TestCellular") + { + mFlag = true; + Log.Info(Globals.LogTag, "RemoveProfile " + item.Name); + ConnectionProfileManager.RemoveProfile(item); + Log.Info(Globals.LogTag, "RemoveProfile is completed"); + } + item.Dispose(); + } + Log.Info(Globals.LogTag, "Profile is removed"); + Assert.IsTrue(mFlag, "Add profile is not success"); + ConnectionProfile mConnectionProfile = null; + mConnectionProfile = null; + list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var item in list) + { + Log.Info(Globals.LogTag, "profile: " + item.Name); + if (item.Name == "TestRemoveProfile") + { + mConnectionProfile = item; + break; + } + item.Dispose(); + } + Assert.IsNull(mConnectionProfile, "RemoveProfile is fail"); + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); + } + } + + /* + * Scenario: + * get current AP profile + * remove it + * connect to it using: ConnectProfileAsync + * compare name + * */ + [Test] + [Category("P1")] + [Description("Connect to a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.ConnectProfileAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT() + { + ConnectionProfile _profile = null; + try + { + /* + * Preconditions: + * WiFi turn on, + * your mobile connected to an AP: example: "WiFi_public" now, + * get current AP profile + * remove it + * connect to it using: ConnectProfileAsync + * compare name + * + * GetCurrentProfile: return current profiles which your mobile connected at that time + */ + Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT start"); + await setUp(); + + /* TEST CODE */ + var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPRIVATE) + { + Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); + _profile = i; + break; + } + i.Dispose(); + } + Assert.IsNotNull(_profile, "Profile is Null"); + await ConnectionProfileManager.DisconnectProfileAsync(_profile); + Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail"); + await Task.Delay(1500); + await ConnectionProfileManager.ConnectProfileAsync(_profile); + Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.WiFiState.ToString(), "ConnectProfileAsync is fail"); + Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT Finish"); + } + 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 (_profile != null) + { + _profile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Connect to a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.ConnectProfileAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task ConnectProfileAsync_CONNECT_TO_NEW_POINT() + { + ConnectionProfile _currCP = null; + ConnectionProfile _currCP1 = null; + try + { + /* + * Precondition: + * get all current AP profile + * remove it + * connect to new point using: ConnectProfileAsync + * compare name + * */ + Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_TO_NEW_POINT start"); + await setUp(); + Log.Info(Globals.LogTag, "wifi is connected"); + + _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPRIVATE) + { + Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); + _currCP = i; + break; + } + i.Dispose(); + } + /*Disconnect AP*/ + await ConnectionProfileManager.DisconnectProfileAsync(_currCP); + await Task.Delay(1500); + Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail"); + Log.Info(Globals.LogTag, "wifi is disconnected"); + + /* TEST CODE */ + /* connect to a WANTED AP */ + _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + ConnectionProfile mP = null; + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPUBLIC) + { + Log.Info(Globals.LogTag, "Found " + networkParameter.wnPUBLIC); + mP = i; + break; + } + i.Dispose(); + } + await ConnectionProfileManager.ConnectProfileAsync(mP); + Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.WiFiState.ToString(), "ConnectProfileAsync is fail"); + Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_TO_NEW_POINT Finish"); + } + 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 (_currCP != null) + { + _currCP.Dispose(); + } + if (_currCP1 != null) + { + _currCP1.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("DisConnect to a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.DisconnectProfileAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task DisconnectProfileAsync_DISCONNECT_AP() + { + ConnectionProfile _profile = null; + try + { + /* + * Preconditions: + * -your mobile connected to some APs before, + * -WiFi turn on, + * -your mobile connected to an AP now + */ + Log.Info(Globals.LogTag, "DisconnectProfileAsync_DISCONNECT_AP start"); + if (WiFiManager.GetConnectedAP() == null) + { + await Task.Delay(1500); + } + await setUp(); + /* TEST CODE */ + var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPRIVATE) + { + Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); + _profile = i; + break; + } + i.Dispose(); + } + await ConnectionProfileManager.DisconnectProfileAsync(_profile); + 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) + { + 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 (_profile != null) + { + _profile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Add a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.AddCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Hyukin, hyukin.kwon@samsung.com")] + public async Task AddCellularProfile_ADD_A_NEW() + { + try + { + Log.Info(Globals.LogTag, "AddCellularProfile_ADD_A_NEW start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + await setUp(); + CellularProfile rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, "TestCellular"); + rCP.ServiceType = CellularServiceType.Internet; + ConnectionProfileManager.AddCellularProfile(rCP); + Log.Info(Globals.LogTag, "AddCellularProfile is finished"); + var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + ConnectionProfile mConnectionProfile = null; + foreach (var item in list) + { + if (item.Name.ToString() == "TestCellular") + { + mConnectionProfile = item; + break; + } + item.Dispose(); + } + Assert.IsNotNull(mConnectionProfile, "Add profile is not success"); + /**POST CONDITION + * Rome profile, which's just addition + * turn off WiFi + **/ + list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var item in list) + { + if (item.Name.ToString() == "TestCellular") + { + ConnectionProfileManager.RemoveProfile(item); + } + item.Dispose(); + } + } + catch (NotSupportedException) + { + Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); + } + } + + [Test] + [Category("P1")] + [Description("set a default Cellular Profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.SetDefaultCellularProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Hyukin, hyukin.kwon@samsung.com")] + public async Task SetDefaultCellularProfile_TYPE_INTERNET() + { + try + { + /* + * Preconditions: + * 1. Add Profile. + * 2. Get Profile. + */ + Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_INTERNET start"); + if (ConnectionManager.CellularState == CellularState.OutOfService) + { + Assert.True(true, "Out of service"); + return; + } + + if (isWiFiSupported && WiFiManager.IsActive) + await tearDown(); + + /* TEST CODE */ + var profile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); + Log.Info(Globals.LogTag, "Get current default cellular profile: " + profile.Name); + Log.Info(Globals.LogTag, "Set current default cellular profile: " + profile.Name); + await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.Internet, profile); + Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_INTERNET finished"); + + // POSTCONDITION + if (isWiFiSupported && !WiFiManager.IsActive) + await setUp(); + } + catch (NotSupportedException) + { + Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); + } + } + + [Test] + [Category("P1")] + [Description("Update a profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.UpdateProfile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task UpdateProfile_UPDATE_A_PROFILE() + { + try + { + /* + * Preconditions: + * -your mobile connected to some APs before, + * -WiFi turn on, + * -your mobile connected to an AP now + */ + Log.Info(Globals.LogTag, "UpdateProfile_UPDATE_A_PROFILE start"); + await setUp(); + /* TEST CODE */ + var currentProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(currentProfile); + ConnectionProfileManager.UpdateProfile(currentProfile); + Log.Info(Globals.LogTag, "UpdateProfile_UPDATE_A_PROFILE Finish"); + } + 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()); + } + } + } // end class +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs new file mode 100755 index 000000000..b773e2ff6 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionProfileStateEventArgs.cs @@ -0,0 +1,107 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionProfileStateEventArgs Tests")] + public class ConnectionProfileStateEventArgsTests + { + public bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + public void EventHandlerProfileStateChanged(object sender, ProfileStateEventArgs e) + { + if (e.State == ProfileState.Disconnected) + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Get State of Profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileStateEventArgs.ConnectionProfileState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task ConnectionProfileState_GET() + { + _flag = false; + ConnectionProfile _connectionProfile = null; + Log.Info(Globals.LogTag, "Start ConnectionProfileState_GET"); + try + { + await setUp(); + var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var i in _list) + { + Log.Info(Globals.LogTag, "Find Profile " + i.Name); + if (i.Name == networkParameter.wnPRIVATE) + { + Log.Info(Globals.LogTag, "Find " + networkParameter.wnPRIVATE); + _connectionProfile = i; + break; + } + i.Dispose(); + } + + Assert.IsNotNull(_connectionProfile, "No Profile Found"); + _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged; + await Task.Delay(1500); + Log.Info(Globals.LogTag, "Event subscripted"); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + Assert.IsTrue(_flag, "Profile State don't change"); + _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; + // 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 (_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 new file mode 100755 index 000000000..f3da2f7eb --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSConnectionTypeEventArgs.cs @@ -0,0 +1,105 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ConnectionTypeEventArgs Tests")] + public class ConnectionTypeEventArgsTests + { + public bool _flag; + bool isWiFiSupported = false; + bool isEthernetSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + _flag = false; + } + /*setup using for connecting to a PRIVATE AP*/ + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("Get State of Profile")] + [Property("SPEC", "Tizen.Network.Connection.ConnectionTypeEventArgs.ConnectionType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] + public async Task ConnectionType_GET() + { + try + { + if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) + { + /* always connected to ethernet */ + } + else + { + /**PRE CONDITION + * Connect to wifi AP + * */ + Log.Info(Globals.LogTag, "ConnectionType_GET start"); + await networkSetup.ForgetCurrentAP(); + Assert.IsFalse(_flag, "Flag should be fail before check"); + + /** TEST CODE */ + ConnectionManager.ConnectionTypeChanged += ConnectionTypeChangedCB; + await Task.Delay(1500); + Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged Event subsribed"); + await setUp(); + Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Connected"); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Disconnected"); + Assert.IsTrue(_flag, "ConnectionType is not changed"); + ConnectionManager.ConnectionTypeChanged -= ConnectionTypeChangedCB; + // 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()); + } + } + + public void ConnectionTypeChangedCB(object sender, ConnectionTypeEventArgs e) + { + if (e.ConnectionType == ConnectionType.WiFi || e.ConnectionType == ConnectionType.Disconnected) + _flag = true; + } + } +} + diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs new file mode 100755 index 000000000..e286e0e04 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSIAddressInformation.cs @@ -0,0 +1,538 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using System.Net; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.IAddressInformation test")] + public class IAddressInformationTests + { + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + [Test] + [Category("P1")] + [Description("Test Dns1 property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Dns1 A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Dns1_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + var getDns1 = iAddressInformation.Dns2; + Assert.IsTrue(!getDns1.Equals(""), "Dns1 is empty"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Dns2 property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Dns2 A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Dns2_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + var getDns2 = iAddressInformation.Dns2; + Assert.IsNotNull(getDns2.ToString(), "Dns2 is NULL"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Gateway property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Gateway A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Gateway_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + var getGateway = iAddressInformation.Gateway; + Assert.IsNotNull(getGateway.ToString(), "gateway is NULL"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test SubnetMask property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.SubnetMask A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SubnetMask_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + var subnetMask = "255.255.255.0"; + iAddressInformation.SubnetMask = IPAddress.Parse(subnetMask); + var getSubnetMask = iAddressInformation.SubnetMask; + Assert.AreEqual(subnetMask.ToString(), getSubnetMask.ToString(), "SubnetMask of IAddressInformation get should be same set"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Ip property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.IP A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IP_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + var getIp = iAddressInformation.IP; + Assert.IsNotNull(getIp.ToString(), "IP is NULL"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test IpConfigType property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.IPConfigType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IPConfigType_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Connect to wifi private + */ + await setUp(); + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + /* + * TEST CODE + */ + iAddressInformation.IPConfigType = IPConfigType.Dynamic; + Assert.AreEqual((int)(IPConfigType.Dynamic), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Dynamic after setting"); + iAddressInformation.IPConfigType = IPConfigType.Fixed; + Assert.AreEqual((int)(IPConfigType.Fixed), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Fixed after setting"); + iAddressInformation.IPConfigType = IPConfigType.Static; + Assert.AreEqual((int)(IPConfigType.Static), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return after setting"); + iAddressInformation.IPConfigType = IPConfigType.Auto; + Assert.AreEqual((int)(IPConfigType.Auto), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Auto after setting"); + iAddressInformation.IPConfigType = IPConfigType.None; + Assert.AreEqual((int)(IPConfigType.None), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return None after setting"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test PrefixLength property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.PrefixLength A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task PrefixLength_PROPERTY() + { + Log.Info(Globals.LogTag, "PrefixLength_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + /*TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + int prefix = 24; + iAddressInformation.PrefixLength = prefix; + Assert.AreEqual(prefix, iAddressInformation.PrefixLength, "Set PrefixLength is fail"); +} + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test DnsConfigType property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DnsConfigType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task DnsConfigType_PROPERTY() + { + Log.Info(Globals.LogTag, "DnsConfigType_SET_GET start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + /*TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + DnsConfigType type = DnsConfigType.Static; + iAddressInformation.DnsConfigType = type; + Assert.AreEqual(type, iAddressInformation.DnsConfigType, "Set DnsConfigType is fail"); +} + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test DhcpServerAddress property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DhcpServerAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task DhcpServerAddress_PROPERTY() + { + Log.Info(Globals.LogTag, "DhcpServerAddress_PROPERTY start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + * */ + await setUp(); + /*TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + var dhcp = iAddressInformation.DhcpServerAddress; + Assert.IsInstanceOf(dhcp, "Invalid property value"); + Assert.NotNull(dhcp, "DhcpServerAddress should not be NULL"); +} + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test DhcpLeaseDuration property of IAddressInformation")] + [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DhcpLeaseDuration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] + public async Task DhcpLeaseDuration_PROPERTY() + { + Log.Info(Globals.LogTag, "DhcpLeaseDuration_PROPERTY start"); + ConnectionProfile _connectionProfile = null; + try + { + /** PRECONDITION + * turn on a Public WiFi + **/ + await setUp(); + + /* TEST CODE */ + _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); + Assert.IsNotNull(_connectionProfile); + var iAddressInformation = _connectionProfile.IPv4Settings; + Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); + + var duration = iAddressInformation.DhcpLeaseDuration; + Assert.IsTrue(duration >= 0, "Invalid dhcp lease duration"); + } + 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 (_connectionProfile != null) + { + _connectionProfile.Dispose(); + } + } + + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs new file mode 100755 index 000000000..b3af315ad --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSProfileStateEventArgs.cs @@ -0,0 +1,117 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.ProfileStateEventArgs Test")] + public class ProfileStateEventArgsTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + private void EventHandlerProfileStateChangedCB(object sender, ProfileStateEventArgs e) + { + if (e.State == ProfileState.Disconnected) + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Test State property of ProfileStateEventArgs")] + [Property("SPEC", "Tizen.Network.Connection.ProfileStateEventArgs.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task State_PROPERTY() + { + ConnectionProfile _connectionProfile = null; + try + { + /* + * PRECONDITION + * Activate WiFi then connect to an AP. + */ + await setUp(); + Assert.IsFalse(_flag, "Flag should be fail before check"); + + var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); + foreach (var item in list) + { + if (item.Name == networkParameter.wnPRIVATE) + { + _connectionProfile = item; + break; + } + item.Dispose(); + } + + /* + * TEST CODE + */ + Assert.IsNotNull(_connectionProfile, "No Profile Found"); + _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChangedCB; + await Task.Delay(1500); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + Assert.IsTrue(_flag, "Flag should be true before check"); + + /** + * POSTCONDITION + * */ + _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChangedCB; + // 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 (_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 new file mode 100755 index 000000000..bbdf63524 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/TSWiFiProfile.cs @@ -0,0 +1,583 @@ +using System; +using NUnit.Framework; +using Tizen.Network.WiFi; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.Connection.Tests +{ + [TestFixture] + [Description("Tizen.Network.Connection.WiFiProfile Tests")] + class WiFiProfileTests + { + private ConnectionProfile _connectionProfile; + private WiFiAP _wiFiAp; + private WiFiNetwork _wiFiNetwork; + private WiFiProfile _wiFiProfile; + private WiFiSecurity _wiFiSecurity; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _connectionProfile = null; + _wiFiAp = null; + _wiFiNetwork = null; + _wiFiSecurity = null; + _wiFiProfile = null; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + + _connectionProfile = null; + _wiFiAp = null; + _wiFiNetwork = null; + _wiFiSecurity = null; + _wiFiProfile = null; + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + _wiFiAp = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wiFiAp, "No WiFi connection"); + _wiFiNetwork = _wiFiAp.NetworkInformation; + _wiFiSecurity = _wiFiAp.SecurityInformation; + var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); + foreach (var item in list) + { + _connectionProfile = item; + break; + } + _wiFiProfile = (WiFiProfile)_connectionProfile; + } + + [Test] + [Category("P1")] + [Description("Test Essid property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Essid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Essid_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare Essid property between two object WiFiNetwork and WiFiProfile + */ + var essid = _wiFiProfile.Essid; + Log.Info(Globals.LogTag, "Essid_PROPERTY essid: " + essid); + Assert.AreEqual(essid, _wiFiNetwork.Essid, "Essid doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Bssid property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Bssid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Bssid_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare Bssid property between two object WiFiNetwork and WiFiProfile + */ + var bssid = _wiFiProfile.Bssid; + Assert.AreEqual(bssid, _wiFiNetwork.Bssid, "Bssid doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Rssi property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Rssi A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Rssi_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Get Rssi of WiFi + * Disconnected WiFi + * Connected to that WiFi + * Then get again Rssi of WiFi + * Compare Rssi between two times get + */ + var rssid1 = _wiFiProfile.Rssi; + Assert.IsNotNull(rssid1, "RSSI is NULL"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test Frequency property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Frequency A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Frequency_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare Frequency property between two object WiFiNetwork and WiFiProfile + */ + var frequency = _wiFiProfile.Frequency; + Assert.AreEqual(frequency, _wiFiNetwork.Frequency, "Frequency doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test MaxSpeed property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.MaxSpeed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task MaxSpeed_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare MaxSpeed property between two object WiFiNetwork and WiFiProfile + */ + int _maxSpeed = _wiFiProfile.MaxSpeed; + Log.Info(Globals.LogTag, "_wiFiProfile.MaxSpeed: " + _maxSpeed); + Log.Info(Globals.LogTag, "_wiFiNetwork.MaxSpeed: " + _wiFiNetwork.MaxSpeed); + Assert.AreEqual(_maxSpeed, _wiFiNetwork.MaxSpeed, "MaxSpeed doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test SecureType property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.SecurityType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SecurityType_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare SecureType property between two object WiFiSecurity and WiFiProfile + */ + var secureType = _wiFiProfile.SecurityType; + Assert.AreEqual(secureType.ToString(), _wiFiSecurity.SecurityType.ToString(), "SecurityType doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test EncryptionType property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.EncryptionType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task EncryptionType_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare EncryptionType property between two object WiFiSecurity and WiFiProfile + */ + var encryptionType = _wiFiProfile.EncryptionType; + Assert.AreEqual(encryptionType.ToString(), _wiFiSecurity.EncryptionType.ToString(), "EncryptionType doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test PassphraseRequired property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.PassphraseRequired A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task PassphraseRequired_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare PassphraseRequired property between two object WiFiSecurity and WiFiProfile + */ + var passphraseRequired = _wiFiProfile.PassphraseRequired; + Assert.AreEqual(passphraseRequired.ToString(), _wiFiSecurity.IsPassphraseRequired.ToString(), "PassphraseRequired doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test WpsSupported property")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.WpsSupported A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WpsSupported_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + * Compare PassphraseRequired property between two object WiFiSecurity and WiFiProfile + */ + var wpsSupported = _wiFiProfile.WpsSupported; + Assert.AreEqual(wpsSupported.ToString(), _wiFiSecurity.IsWpsSupported.ToString(), "WpsSupported doesn't get successful"); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test SetPassphrase method")] + [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.SetPassphrase M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SetPassphrase_CHECK_STATUS() + { + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiSecurity object + * Create a WiFiProfile object + */ + await setUp(); + + /* + * TEST CODE + */ + var passphrase = "pass12345"; + + _wiFiProfile.SetPassphrase(passphrase); + } + 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(); + } + if (_wiFiProfile != null) + { + _wiFiProfile.Dispose(); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkParameter.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkParameter.cs new file mode 100755 index 000000000..2b36edf82 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkParameter.cs @@ -0,0 +1,115 @@ +using System; +using System.IO; + +namespace networkUtils +{ + /* ***********************************************************************/ + // ** + // ** Setup: name/securetype for an AP, using as precondition for testing + // ** + /* ***********************************************************************/ + public class networkParameter + { + public enum wType + { + wPublic = 0, + wPrivate = 1, + } + + /*----------Setup belowing APs for testing:-----------*/ + + /*SQE configuration*/ + public static string wnPUBLIC = null; + public static string wnPRIVATE = null; + public static string wPASS = null; + /*This password string should be not exceeded 8 characters as API's description, so pls replace "happy12345" by "abc13579"*/ + /*This password string "wPASS = "abc13579" should be using for all of 2 private APs "DPT_Part01" and "DPT_Part02", because it was configured inside Testing code + *If you wanna change wPASS string, pls modified related TCs also*/ + + /*svmc setup*/ + //public static string wnPUBLIC = "SVMC_12F_LAP_TEST_IPTIME24"; + public static void SetPrecondition() + { + int index = 0; + string result = RequestGET("/opt/usr/home/owner/share/tct/preconfigure.json"); + if (result == null) + { + Tizen.Log.Error(Globals.LogTag, "RequestGET failed"); + return; + } + string[] resultArray = ResultParser(result); + if (resultArray == null) + { + Tizen.Log.Error(Globals.LogTag, "ResultParser failed"); + return; + } + Tizen.Log.Info(Globals.LogTag, "========== Precondition =========="); + foreach (string item in resultArray) + { + switch (item) + { + case "PUBLIC_AP": + wnPUBLIC = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "PUBLIC AP : " + wnPUBLIC); + break; + case "PRIVATE_AP": + wnPRIVATE = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "PRIVATE AP : " + wnPRIVATE); + break; + case "PASSWORD_FOR_ALL_PRIVATE_AP": + wPASS = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "PASSWORD : " + wPASS); + break; + default: + break; + } + index++; + } + } + + private static string RequestGET(string path) + { + string result = null; + string url = path; + StreamReader reader = null; + + Tizen.Log.Info(Globals.LogTag, "RequestGET url: " + url); + + try + { + reader = File.OpenText(path); + result = reader.ReadToEnd(); + Tizen.Log.Info(Globals.LogTag, "RequestGET Result: " + result); + } + catch (Exception e) + { + Tizen.Log.Info(Globals.LogTag, "RequestGET error: " + e.Message); + } + finally + { + if (reader != null) + { + reader.Dispose(); + } + } + + return result; + } + private static string[] ResultParser(string TCID) + { + string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; + string[] stringPieces = null; + + try + { + stringPieces = TCID.Split(delimiter, StringSplitOptions.None); + } + catch (Exception e) + { + Tizen.Log.Info(Globals.LogTag, "ResultParser error: " + e.Message); + } + + return stringPieces; + } + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs new file mode 100755 index 000000000..a037eaaa3 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs @@ -0,0 +1,137 @@ +using Tizen.Network.WiFi; +using System.Threading.Tasks; + +namespace networkUtils +{ + /* ***********************************************************************/ + // ** + // ** Common library for connect/disconnect to/from WiFi: hidden, private, eap, public + // ** + /* ***********************************************************************/ + static internal class Globals + { + internal const string LogTag = "NetworkTC"; + } + + public class networkSetup + { + private static int MAX_SCAN_TRY = 3; + + private networkSetup() + { + } + + public static async Task ForgetCurrentAP() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.ForgetCurrentAP"); + WiFiAP ap = WiFiManager.GetConnectedAP(); + if (ap != null) + { + Tizen.Log.Info(Globals.LogTag, "Forget AP " + ap.NetworkInformation.Essid); + await ap.ForgetAPAsync(); + ap.Dispose(); + } + } + + public static async Task ActivateWiFi() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.ActivateWiFi"); + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + await Task.Delay(1500); + } + Tizen.Log.Info(Globals.LogTag, "WiFi is Activated"); + } + + public static async Task DeactivateWiFi() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.DeactivateWiFi"); + if (WiFiManager.IsActive) + { + await ForgetCurrentAP(); + await WiFiManager.DeactivateAsync(); + Tizen.Log.Info(Globals.LogTag, "Deactivated"); + } + } + + + private static WiFiAP FindAP(string WiFiName) + { + Tizen.Log.Info(Globals.LogTag, "Find AP " + WiFiName + " from scan results"); + var list = WiFiManager.GetFoundAPs(); + + foreach (WiFiAP item in list) + { + if (item.NetworkInformation.Essid == WiFiName) + { + Tizen.Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString()); + return item; + } + item.Dispose(); + } + return null; + } + + /* Connect to a WANTED AP */ + public static async Task ConnectWiFi(string WiFiName, networkParameter.wType type, string WiFiPass) + { + Tizen.Log.Info(Globals.LogTag, "ConnectWiFi (AP: " + WiFiName + ", Password: " + WiFiPass + ")"); + + await ActivateWiFi(); + + WiFiAP ap = WiFiManager.GetConnectedAP(); + // Already connected + if (ap != null && ap.NetworkInformation.Essid == WiFiName) + { + return; + } + + /** + * Connected to another AP + * We need to forget it + */ + if (ap != null) + { + Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid); + await ForgetCurrentAP(); + ap = WiFiManager.GetConnectedAP(); + if (ap != null) + { + Tizen.Log.Error(Globals.LogTag, "AP must be null"); + return; + } + } + Tizen.Log.Info(Globals.LogTag, "No connected AP"); + + /** + * Find AP from scan results + * If it fails, scan Wi-Fi APs maximum three times + */ + ap = FindAP(WiFiName); + for (int i = 0; i < MAX_SCAN_TRY && ap == null; i++) + { + await Task.Delay(1000); + await WiFiManager.ScanAsync(); + ap = FindAP(WiFiName); + } + + // Scan Failure + if (ap == null) + { + Tizen.Log.Error(Globals.LogTag, "AP " + WiFiName + " is not found"); + return; + } + + // Connect to AP + if (type != networkParameter.wType.wPublic) + { + Tizen.Log.Info(Globals.LogTag, "Set passphrase " + WiFiPass); + ap.SecurityInformation.SetPassphrase(WiFiPass); + } + + await ap.ConnectAsync(); + Tizen.Log.Info(Globals.LogTag, "Connected"); + } // ConnectWiFi() + } +} diff --git a/tct-suite-vs/Tizen.Connection.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Connection.Tests/tizen-manifest.xml new file mode 100755 index 000000000..42d27dff2 --- /dev/null +++ b/tct-suite-vs/Tizen.Connection.Tests/tizen-manifest.xml @@ -0,0 +1,19 @@ + + + + + Tizen.Connection.Tests.png + + + + http://tizen.org/privilege/network.get + http://tizen.org/privilege/network.set + http://tizen.org/privilege/network.profile + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.Network.Manual.Tests/Program.cs deleted file mode 100755 index 4010ccf8b..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/Program.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -using System; -using NUnit.Framework; -using Xamarin.Forms; - -namespace XamarinApplication.Tizen -{ - class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication - { - private Application _app; - protected override void OnCreate() - { - Console.WriteLine("TCT : OnCreate()"); - base.OnCreate(); - if (ManualTest.IsWearable()) - { - _app = new WearableTemplate.MainPage(); - } - else - { - _app = new ManualTemplate.MainPage(); - } - LoadApplication(_app); - } - - static void Main(string[] args) - { - Console.WriteLine("TCT : Main()"); - var app = new Program(); - global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); - app.Run(args); - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.csproj b/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.csproj deleted file mode 100644 index 428d804d9..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Exe - tizen60 - - - - - true - - - - portable - - - None - - - - - - - - - - - Runtime - - - - - - - - - - diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.sln b/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.sln deleted file mode 100755 index 0ec78d15e..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/Tizen.Network.Manual.Tests.sln +++ /dev/null @@ -1,80 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.15 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Manual.Tests", "Tizen.Network.Manual.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.ActiveCfg = Debug|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.NUI|Any CPU.Build.0 = Debug|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.ActiveCfg = Debug|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.NUI|Any CPU.Build.0 = Debug|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} - EndGlobalSection -EndGlobal diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/shared/res/Tizen.Network.Manual.Tests.png b/tct-suite-vs/Tizen.Network.Manual.Tests/shared/res/Tizen.Network.Manual.Tests.png deleted file mode 100755 index 9765b1bda..000000000 Binary files a/tct-suite-vs/Tizen.Network.Manual.Tests/shared/res/Tizen.Network.Manual.Tests.png and /dev/null differ diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSConnectionManager.cs b/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSConnectionManager.cs deleted file mode 100755 index b5709143b..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSConnectionManager.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Xamarin.Forms; -using Tizen.System; -using Tizen.Network.Connection; -using networkUtils; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionManager Tests")] - public class ConnectionManagerTests - { - bool isEthernetSupported = false; - private bool _flag = false; - private bool s_isEmulator = false; - - [SetUp] - public void Init() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - String model; - Information.TryGetValue("tizen.org/system/model_name", out model); - s_isEmulator = model.Equals("Emulator"); - } - - [TearDown] - public void Destroy() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Listen Ethernet Cable State changed")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetCableStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "This should be tested using real device not emulator since unplugging ethernet cable is not supported in emulator")] - [Precondition(2, "Plug an ethernet cable into your test device")] - [Step(1, "Tap the Run button")] - [Step(2, "Unplug the ethernet cable")] - [Step(3, "Testcase will pass automatically if the EthernetCableStateChanged callback is invoked. Otherwise, it will fail")] - [Postcondition(1, "Plug an ethernet cable into your test device")] - public async Task EthernetCableStateChanged_EVENT() - { - if (s_isEmulator) - { - ManualTest.DisplayLabel("EthernetCableStateChanged_EVENT cannot be run on emulator. Please press pass"); - await ManualTest.WaitForConfirm(); - return; - } - if (isEthernetSupported == false) - { - Assert.IsTrue(true, "Cannot test cases about EthernetCableStateChanged events"); - return; - } - try - { - ConnectionManager.EthernetCableStateChanged += EventHandlerEthernetCableStateChanged; - await Task.Delay(5000); - ConnectionManager.EthernetCableStateChanged -= EventHandlerEthernetCableStateChanged; - Assert.IsTrue(_flag, "EthernetCableStateChanged event is not occurred"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - public void EventHandlerEthernetCableStateChanged(object sender, EventArgs e) - { - _flag = true; - } - } - -} diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs b/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs deleted file mode 100755 index fb3c2f88b..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSEthernetCableStateEventArgs.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Xamarin.Forms; -using Tizen.System; -using Tizen.Network.Connection; -using networkUtils; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.EthernetCableStateEventArgs Tests")] - public class EthernetCableStateEventArgsTests - { - public EthernetCableState _state; - public bool _event; - bool isEthernetSupported = false; - private bool s_isEmulator = false; - - [SetUp] - public void Init() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - _event = false; - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - String model; - Information.TryGetValue("tizen.org/system/model_name", out model); - s_isEmulator = model.Equals("Emulator"); - } - - [TearDown] - public void Destroy() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); - } - - public void EventHandlerEthernetCableStateChanged(object sender, EventArgs e) - { - _event = true; - _state = ((EthernetCableStateEventArgs)e).EthernetCableState; - } - - [Test] - [Category("P1")] - [Description("Get State of Ethernet Cable State")] - [Property("SPEC", "Tizen.Network.Connection.EthernetCableStateEventArgs.EthernetCableState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "This should be tested using real device not emulator since unplugging ethernet cable is not supported in emulator")] - [Precondition(2, "Plug an ethernet cable into your test device")] - [Step(1, "Tap the Run button")] - [Step(2, "Unplug the ethernet cable")] - [Step(3, "Testcase will pass automatically if the EthernetCableStateChanged callback is invoked and EthernetCable state is DETACHED. Otherwise, it will fail")] - [Postcondition(1, "Plug an ethernet cable into your test device")] - public async Task EthernetCableState_GET() - { - if (s_isEmulator) - { - ManualTest.DisplayLabel("EthernetCableState_GET cannot be run on emulator.Please press pass"); - await ManualTest.WaitForConfirm(); - return; - } - if (isEthernetSupported == false) - { - Assert.IsTrue(true, "Cannot test cases about EthernetCableStateChanged events"); - return; - } - try - { - ConnectionManager.EthernetCableStateChanged += EventHandlerEthernetCableStateChanged; - await Task.Delay(5000); - Assert.IsTrue(_event, "No EthernetCableStateChanged Event"); - Assert.IsTrue(_state == EthernetCableState.Detached, "Invalid EthernetCableState"); - ConnectionManager.EthernetCableStateChanged -= EventHandlerEthernetCableStateChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSWiFiAP.cs b/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSWiFiAP.cs deleted file mode 100755 index 0007b4e13..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/TSWiFiAP.cs +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -using System; -using System.Threading.Tasks; -using NUnit.Framework; -using NUnit.Framework.TUnit; -using Xamarin.Forms; -using Tizen.System; -using Tizen.Network.WiFi; -using networkUtils; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiAP Tests")] - public class WiFiAPTests - { - bool isWiFiSupported = false; - private bool _flag = false; - - [SetUp] - public void Init() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - PreconditionUtils.SetPrecondition(); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test a connection to a WpsPbs WiFi")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "Prepare a WiFi AP with WPS PBC support")] - [Precondition(2, "Activate WiFi")] - [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] - [Precondition(4, "Check if your WPS PBC support AP is scanned")] - [Step(1, "Tap the Run button")] - [Step(2, "Go to the AP and push the PBC button")] - [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] - [Postcondition(1, "Forget the connected AP")] - [Postcondition(2, "Deactivate WiFi")] - public async Task ConnectWpsAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON() - { - WiFiAP ap = null; - try - { - /** - * PRE CONDITION - * turn off WiFi - * */ - - /** TEST CODE */ - var list = WiFiManager.GetFoundAPs(); - foreach (var item in list) - { - if (item.NetworkInformation.Essid.ToString() == PreconditionUtils.WPS_PBC_AP) - { - Log.Info(Globals.LogTag, "Find " + item.NetworkInformation.Essid.ToString()); - ap = item; - break; - } - } - - Assert.IsNotNull(ap, "Can't find a WiFi AP"); - WpsInfo info = new WpsPbcInfo(); - await ap.ConnectWpsAsync(info); - Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't turn on"); - Log.Info(Globals.LogTag, "Successfully done"); - - /** - * POST CONDITION - * */ - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Check a connection to a WiFi, which has a password")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsAsync M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "Prepare a WiFi AP with WPS PIN support")] - [Precondition(2, "Activate WiFi")] - [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] - [Precondition(4, "Check if your WPS PIN support AP is scanned")] - [Step(1, "Tap the Run button")] - [Step(2, "Go to the AP and input the WPS PIN number")] - [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] - [Postcondition(1, "Forget the connected AP")] - [Postcondition(2, "Deactivate WiFi")] - public async Task ConnectWpsAsync_CONNECT_TO_A_AP_SUPPORTED_PIN() - { - WiFiAP ap = null; - try - { - /** TEST CODE */ - var list = WiFiManager.GetFoundAPs(); - Log.Info(Globals.LogTag, "WPS PIN AP: " + PreconditionUtils.WPS_PIN_AP); - foreach (var item in list) - { - Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString()); - if (item.NetworkInformation.Essid.ToString() == PreconditionUtils.WPS_PIN_AP) - { - Log.Info(Globals.LogTag, "Find " + item.NetworkInformation.Essid.ToString()); - ap = item; - break; - } - } - - Assert.IsNotNull(ap, "Can't find a WiFi AP"); - WpsInfo info = new WpsPinInfo(PreconditionUtils.PIN_NUMBER_OF_WPS_PIN_AP); - await ap.ConnectWpsAsync(info); - Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't turn on"); - Log.Info(Globals.LogTag, "Successfully done"); - - /** - * POST CONDITION - * */ - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test a connection to a WpsPbs WiFi")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsWithoutSsidAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "Prepare a WiFi AP with WPS PBC support")] - [Precondition(2, "Activate WiFi")] - [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] - [Precondition(4, "Check if your WPS PBC support AP is scanned")] - [Step(1, "Tap the Run button")] - [Step(2, "Go to the AP and push the PBC button")] - [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] - [Postcondition(1, "Forget the connected AP")] - [Postcondition(2, "Deactivate WiFi")] - public async Task ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON() - { - try - { - Log.Info(Globals.LogTag, "ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON"); - - WpsInfo info = new WpsPbcInfo(); - var connectedAP = await WiFiAP.ConnectWpsWithoutSsidAsync(info); - Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); - Assert.IsNotNull(connectedAP, "There is no connected AP"); - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't connect"); - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Check a connection to a WiFi, which has a password")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsWithoutSsidAsync M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - [Precondition(1, "Prepare a WiFi AP with WPS PIN support")] - [Precondition(2, "Activate WiFi")] - [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] - [Precondition(4, "Check if your WPS PIN support AP is scanned")] - [Step(1, "Tap the Run button")] - [Step(2, "Go to the AP and input the WPS PIN number")] - [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] - [Postcondition(1, "Forget the connected AP")] - [Postcondition(2, "Deactivate WiFi")] - public async Task ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PIN() - { - try - { - Log.Info(Globals.LogTag, "ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PIN"); - - WpsInfo info = new WpsPinInfo(PreconditionUtils.PIN_NUMBER_OF_WPS_PIN_AP); - var connectedAP = await WiFiAP.ConnectWpsWithoutSsidAsync(info); - Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); - Assert.IsNotNull(connectedAP, "There is no connected AP"); - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't connect"); - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - } -} - - - diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/support/PreconditionUtils.cs b/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/support/PreconditionUtils.cs deleted file mode 100755 index 4a6d8678d..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/testcase/support/PreconditionUtils.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* -* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the License); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an AS IS BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -using NUnit.Framework.TUnit; -using System; -using System.IO; - -namespace networkUtils -{ - static internal class Globals - { - internal const string LogTag = "NetworkTC"; - } - - public class PreconditionUtils - { - public static string WPS_PBC_AP = null; - public static string WPS_PIN_AP = null; - public static string PIN_NUMBER_OF_WPS_PIN_AP = null; - public static void SetPrecondition() - { - int index = 0; - string result = ReadFile("/opt/usr/home/owner/share/tct/preconfigure.json"); - if (result == null) - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ReadFile failed"); - return; - } - string[] resultArray = StringParser(result); - if (resultArray == null) - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "StringParser failed " + result); - return; - } - foreach (string item in resultArray) - { - switch (item) - { - case "WPS_PBC_AP": - // Remove backslash - resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); - WPS_PBC_AP = resultArray[index + 1]; - break; - case "WPS_PIN_AP": - // Remove backslash - resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); - WPS_PIN_AP = resultArray[index + 1]; - break; - case "PIN_NUMBER_OF_WPS_PIN_AP": - // Remove backslash - resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); - PIN_NUMBER_OF_WPS_PIN_AP = resultArray[index + 1]; - break; - default: - break; - } - index++; - } - } - - private static string ReadFile(string path) - { - string result = null; - string url = path; - StreamReader reader = null; - - try - { - reader = File.OpenText(path); - result = reader.ReadToEnd(); - } - catch (Exception e) - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "File read error : " + e.Message); - } - finally - { - if (reader != null) - { - reader.Dispose(); - } - } - - return result; - } - private static string[] StringParser(string TCID) - { - string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; - string[] stringPieces = null; - - try - { - stringPieces = TCID.Split(delimiter, StringSplitOptions.None); - } - catch (Exception e) - { - LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ResultParser : " + e.Message); - } - - return stringPieces; - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Network.Manual.Tests/tizen-manifest.xml deleted file mode 100644 index 1b61ba4cd..000000000 --- a/tct-suite-vs/Tizen.Network.Manual.Tests/tizen-manifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Tizen.Network.Manual.Tests.png - - - - http://tizen.org/privilege/network.get - http://tizen.org/privilege/network.set - http://tizen.org/privilege/network.profile - http://tizen.org/privilege/appmanager.launch - - \ No newline at end of file diff --git a/tct-suite-vs/Tizen.Network.Tests/Program.cs b/tct-suite-vs/Tizen.Network.Tests/Program.cs deleted file mode 100755 index aa1ff4c08..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/Program.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -using System; -using NUnitLite.TUnit; -using AutoTemplate; - -namespace XamarinForTizen.Tizen -{ - - class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication - { - private static App _app; - protected override void OnCreate() - { - base.OnCreate(); - - Console.WriteLine("TCT : OnCreate()"); - _app = new App(); - LoadApplication(_app); - - TRunner t = new TRunner(); - t.LoadTestsuite(); - t.Execute(); - } - - public static App getApp() - { - return _app; - } - static void Main(string[] args) - { - Console.WriteLine("TCT : Main()"); - var app = new Program(); - global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); - app.Run(args); - } - } -} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.csproj b/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.csproj deleted file mode 100644 index 6f861d834..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - Exe - tizen60 - - - - - true - - - - portable - - - None - - - - - - - - - - - Runtime - - - - - - - - - - diff --git a/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.sln b/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.sln deleted file mode 100755 index d9862b072..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/Tizen.Network.Tests.sln +++ /dev/null @@ -1,78 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.15 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Tests", "Tizen.Network.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU - {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU - {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU - {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU - {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} - EndGlobalSection -EndGlobal diff --git a/tct-suite-vs/Tizen.Network.Tests/res/preconfigure.json b/tct-suite-vs/Tizen.Network.Tests/res/preconfigure.json deleted file mode 100755 index 54a469fd3..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/res/preconfigure.json +++ /dev/null @@ -1 +0,0 @@ -[{"PASSWORD_FOR_ALL_PRIVATE_AP":"conv0909","PRIVATE_AP_2_2":"iptime_private_2","HIDDEN_AP":"iptime_hidden","PRIVATE_AP_1_2":"iptime_private_1","PUBLIC_AP":"setup"}] \ No newline at end of file diff --git a/tct-suite-vs/Tizen.Network.Tests/shared/res/Tizen.Network.Tests.png b/tct-suite-vs/Tizen.Network.Tests/shared/res/Tizen.Network.Tests.png deleted file mode 100755 index 9765b1bda..000000000 Binary files a/tct-suite-vs/Tizen.Network.Tests/shared/res/Tizen.Network.Tests.png and /dev/null differ diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSAddressEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSAddressEventArgs.cs deleted file mode 100755 index 6e198396e..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSAddressEventArgs.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.AddressEventArgs Tests")] - public class AddressEventArgsTests - { - public bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - Log.Info(Globals.LogTag, "InitFixture"); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - _flag = false; - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - _flag = false; - } - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - [Test] - [Category("P1")] - [Description("Get State of Connection")] - [Property("SPEC", "Tizen.Network.Connection.AddressEventArgs.IPv4Address A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task IPv4Address_GET() - { - /**PRE CONDITION - * Connect to wifi AP - * */ - try - { - Log.Info(Globals.LogTag, "Ipv4Address_GET start"); - await setUp(); - - Assert.IsFalse(_flag, "_flag should be false before checking"); - ConnectionManager.IPAddressChanged += Ipv4AddressChangedCallBack; - await Task.Delay(1500); - - Log.Info(Globals.LogTag, "Ipv4AddressChanged Event subscribed"); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - await setUp(); - Log.Info(Globals.LogTag, "Network is connected"); - await Task.Delay(1500); - - Assert.IsTrue(_flag, "Ipv4Address is not changed"); - ConnectionManager.IPAddressChanged -= Ipv4AddressChangedCallBack; - } - 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()); - } - } - - public void Ipv4AddressChangedCallBack(object sender, EventArgs e) - { - Log.Info(Globals.LogTag, "IPAddress is changed"); - AddressEventArgs eventArgs = (AddressEventArgs)e; - string ipv4 = eventArgs.IPv4Address; - Log.Info(Globals.LogTag, "new IPv4Address is " + ipv4); - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Get State of Connection")] - [Property("SPEC", "Tizen.Network.Connection.AddressEventArgs.IPv6Address A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task IPv6Address_GET() - { - /**PRE CONDITION - * Connect to wifi AP - * */ - try - { - Log.Info(Globals.LogTag, "Ipv6Address_GET start"); - await setUp(); - - ConnectionManager.IPAddressChanged += Ipv6AddressChangedCallBack; - await Task.Delay(1500); - Log.Info(Globals.LogTag, "Ipv6Address_GET Ipv6AddressChanged Event subscribed"); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - await setUp(); - Log.Info(Globals.LogTag, "Network is connected"); - await Task.Delay(1500); - - Assert.IsTrue(_flag, "Ipv6Address is not changed"); - /** - * Disconnect WifiAP - * */ - ConnectionManager.IPAddressChanged -= Ipv6AddressChangedCallBack; - } - 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()); - } - } - - public void Ipv6AddressChangedCallBack(object sender, EventArgs e) - { - Log.Info(Globals.LogTag, "IPAddress is changed"); - AddressEventArgs eventArgs = (AddressEventArgs)e; - string ipv6 = eventArgs.IPv6Address; - Log.Info(Globals.LogTag, "new IPv6Address is " + ipv6); - _flag = true; - } - - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularAuthInformation.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularAuthInformation.cs deleted file mode 100755 index f1bfcce9c..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularAuthInformation.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using NUnit.Framework; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - /* ***********************************************************************/ - // ** Scenario - // ** CellularAuthInformation test - // ** - /* ***********************************************************************/ - - [TestFixture] - [Description("Tizen.Network.Connection.CellularAuthInformation Tests")] - public class CellularAuthInformationTests - { - private CellularAuthInformation _cellularAuthInformation; - bool isTelephonySupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - _cellularAuthInformation = null; - } - - [Test] - [Category("P1")] - [Description("Create a CellularAuthInformation")] - [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.CellularAuthInformation C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void CellularAuthInformation_INIT() - { - Log.Info(Globals.LogTag, "CellularAuthInformation_INIT start"); - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - CellularAuthInformation info = new CellularAuthInformation(); - Assert.IsInstanceOf(info, "Creating CellularAuthInformation is failed"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (TypeInitializationException e) - { - Assert.IsTrue(isTelephonySupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test: The authentication type.")] - [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.AuthType M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void AuthType_SET_GET() - { - Log.Info(Globals.LogTag, "AuthType_SET_GET start"); - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - Log.Info(Globals.LogTag, "Cellular enabled"); - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - Log.Info(Globals.LogTag, "Successfully to get DefaultCellularProfile"); - _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; - Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); - Log.Info(Globals.LogTag, "Successfully to get CellularAuthInfo"); - var autherType = _cellularAuthInformation.AuthType; - Assert.IsNotNull(autherType, "AuthType is NULL"); - Log.Info(Globals.LogTag, "Successfully to get AuthType"); - _cellularAuthInformation.AuthType = CellularAuthType.Chap; - Assert.AreEqual(CellularAuthType.Chap.ToString(), _cellularAuthInformation.AuthType.ToString(), "Chap Type of Auther can't set"); - _cellularAuthInformation.AuthType = CellularAuthType.None; - Assert.AreEqual(CellularAuthType.None.ToString(), _cellularAuthInformation.AuthType.ToString(), "None Type of Auther can't set"); - _cellularAuthInformation.AuthType = CellularAuthType.Pap; - Assert.AreEqual(CellularAuthType.Pap.ToString(), _cellularAuthInformation.AuthType.ToString(), "Pap Type of Auther can't set"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test: The password")] - [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.Password M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void Password_SET_GET() - { - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; - Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); - var autherType = _cellularAuthInformation.AuthType; - Assert.IsNotNull(autherType, "AuthType is NULL"); - if (autherType == CellularAuthType.None) - { - Assert.AreEqual("", _cellularAuthInformation.Password, "Password is not empty"); - _cellularAuthInformation.Password = "abc13579"; - Assert.AreEqual("abc13579", _cellularAuthInformation.Password, "Can't set Pass"); - } - else - { - Assert.AreNotEqual(null, _cellularAuthInformation.Password, "Password is NULL"); - _cellularAuthInformation.Password = "abc13579"; - Assert.AreEqual("abc13579", _cellularAuthInformation.Password, "Can't set Pass"); - } - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test: The UserName")] - [Property("SPEC", "Tizen.Network.Connection.CellularAuthInformation.UserName M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void UserName_SET_GET() - { - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularAuthInformation = ((CellularProfile)connection).CellularAuthInfo; - Assert.IsNotNull(_cellularAuthInformation, "Don't get a CellularAuthInfo"); - var autherType = _cellularAuthInformation.AuthType; - Assert.IsNotNull(autherType, "AuthType is NULL"); - var userName = "TestCell"; - if (autherType == CellularAuthType.None) - { - Assert.AreEqual("", _cellularAuthInformation.UserName, "UserName is not empty"); - _cellularAuthInformation.UserName = userName; - Assert.AreEqual(userName, _cellularAuthInformation.UserName, "UserName is not equal"); - } - else - { - Assert.AreNotEqual(null, _cellularAuthInformation.UserName, "UserName is NULL"); - _cellularAuthInformation.UserName = userName; - Assert.AreEqual(userName, _cellularAuthInformation.UserName, "UserName is not equal"); - } - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularProfile.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularProfile.cs deleted file mode 100755 index ed9b366e7..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSCellularProfile.cs +++ /dev/null @@ -1,489 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - /* ***********************************************************************/ - // ** Scenario - Create/get/dispose an AP. - // ** - // ** create a public AP - // ** create a hidden AP - // ** connect to that AP - // ** get network information from that AP - // ** refesh AP - // ** - /* ***********************************************************************/ - - [TestFixture] - [Description("Tizen.Network.Connection.CellularProfile Tests")] - public class CellularProfileTests - { - - bool isTelephonySupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test: Set and get a access point name")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Apn A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void Apn_SET_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "Apn_SET_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var apnName = "TestAPN"; - Assert.AreNotEqual(apnName, _cellularProfile.Apn.ToString(), "Apn is same"); - _cellularProfile.Apn = apnName; - Assert.AreEqual(apnName, _cellularProfile.Apn.ToString(), "Apn is different"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test: Set and get a HomeUri")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.HomeUri A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void HomeUri_SET_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "HomeUri_SET_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var homeUri = "192.168.333"; - Assert.AreNotEqual(homeUri, _cellularProfile.HomeUri.ToString(), "HomeUri is same"); - _cellularProfile.HomeUri = homeUri; - Assert.AreEqual(homeUri, _cellularProfile.HomeUri.ToString(), "HomeUri is different"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - - [Test] - [Category("P1")] - [Description("Test: Set and get a service type")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.ServiceType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void ServiceType_SET_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "ServiceType_SET_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Log.Info(Globals.LogTag, "ServiceType_SET_GET out of service"); - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Log.Info(Globals.LogTag, "ServiceType_SET_GET GetDefaultCellularProfile"); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var serviceType = CellularServiceType.MMS; - Assert.AreNotEqual(serviceType.ToString(), _cellularProfile.ServiceType.ToString(), "ServiceType is same"); - _cellularProfile.ServiceType = serviceType; - Log.Info(Globals.LogTag, "ServiceType_SET_GET Set ServiceType to MMS"); - Assert.AreEqual(serviceType.ToString(), _cellularProfile.ServiceType.ToString(), "ServiceType is different"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test: Set and get a PdnType")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.PdnType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void PdnType_SET_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "PdnType_SET_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var pdnType = CellularPdnType.IPv4; - Assert.AreNotEqual(pdnType, _cellularProfile.PdnType, "PdnType is same"); - _cellularProfile.PdnType = pdnType; - Assert.AreEqual(pdnType, _cellularProfile.PdnType, "PdnType is different"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test: Set and get a RoamingPdnType")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.RoamingPdnType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void RoamingPdnType_SET_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "RoamingPdnType_SET_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var roamingPdnType = CellularPdnType.IPv4; - Assert.AreNotEqual(roamingPdnType, _cellularProfile.RoamingPdnType, "RoamingPdnType is same"); - _cellularProfile.RoamingPdnType = roamingPdnType; - Assert.AreEqual(roamingPdnType, _cellularProfile.RoamingPdnType, "RoamingPdnType is different"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test:Checks whether the profile is hidden.")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.IsRoaming A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void IsRoaming_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "IsRoaming_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.IsTrue(true, "Out of service"); - return; - } - Log.Info(Globals.LogTag, "Try to GetDefaultCellularProfile"); - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Fail to get a ConnectionProfile"); - Log.Info(Globals.LogTag, "Get default cellular profile"); - _cellularProfile = (CellularProfile)connection; - Assert.IsFalse(_cellularProfile.IsRoaming, "IsRoaming is true"); - Log.Info(Globals.LogTag, "IsRoaming_GET done"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets cellular Authentification Information.")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.CellularAuthInfo A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void CellularAuthInfo_GET_SET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "CellularAuthInfo_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - var info = _cellularProfile.CellularAuthInfo; - Assert.IsNotNull(info, "CellularAuthInfo is NULL"); - CellularAuthInformation newInfo = new CellularAuthInformation(); - newInfo.UserName = info.UserName; - newInfo.Password = info.Password; - newInfo.AuthType = info.AuthType; - _cellularProfile.CellularAuthInfo = newInfo; - Assert.AreEqual(_cellularProfile.CellularAuthInfo, newInfo, "It is failed to set CellularAuthInfo"); - Assert.True(true, "set CellularAuthInfo"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - - [Test] - [Category("P1")] - [Description("Test: Checks whether the profile is default.")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.IsDefault A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task IsDefault_GET() - { - CellularProfile _cellularProfile = null; - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - Log.Info(Globals.LogTag, "IsDefault_GET start"); - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - Log.Info(Globals.LogTag, "IsDefault_GET GetDefaultCellularProfile"); - await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.Internet, connection); - Log.Info(Globals.LogTag, "IsDefault_GET SetDefaultCellularProfile"); - connection = null; - connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - Assert.IsTrue(_cellularProfile.IsDefault, "CellularProfile don't must default"); - Log.Info(Globals.LogTag, "IsDefault_GET Done"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test:Checks whether the profile is hidden.")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Hidden A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void Hidden_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "Hidden_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.IsTrue(true, "Out of service"); - return; - } - Log.Info(Globals.LogTag, "Hidden_GET try to GetDefaultCellularProfile"); - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - Log.Info(Globals.LogTag, "Hidden_GET Get default cellular profile"); - _cellularProfile = (CellularProfile)connection; - Assert.IsFalse(_cellularProfile.Hidden, "Hidden is true"); - Log.Info(Globals.LogTag, "Hidden_GET done"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test:Checks whether the profile is editable.")] - [Property("SPEC", "Tizen.Network.Connection.CellularProfile.Editable A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void Editable_GET() - { - CellularProfile _cellularProfile = null; - try - { - Log.Info(Globals.LogTag, "Editable_GET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Log.Info(Globals.LogTag, "Out of service"); - Assert.IsTrue(true, "Out of service"); - return; - } - Log.Info(Globals.LogTag, "After if"); - var connection = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connection, "Don't get a ConnectionProfile"); - _cellularProfile = (CellularProfile)connection; - Assert.IsTrue(_cellularProfile.Editable, "Editable is fail"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.Fail("Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_cellularProfile != null) - { - _cellularProfile.Dispose(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionItem.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionItem.cs deleted file mode 100755 index ef385fc5a..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionItem.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionItem Tests")] - public class ConnectionItemTests - { - bool isWiFiSupported = false; - bool isEthernetSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - /* - if (!WiFiManager.IsActive) - await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - */ - } - - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("Get Type of CurrrentConnection")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionItem.Type A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task ConnectionItem_Type_GET() - { - Log.Info(Globals.LogTag, "ConnectionItem_Type_GET start"); - try - { - /** - * PRE CONDITION - */ - - await setUp(); - - /** - * TEST CODE - */ - - Assert.AreEqual(ConnectionType.WiFi, ConnectionManager.CurrentConnection.Type, "ConnectionItem_Type_GET is fail"); - - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Get State of CurrrentConnection")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionItem.State A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task ConnectionItem_State_GET() - { - try - { - /** - * PRE CONDITION - */ - Log.Info(Globals.LogTag, "ConnectionItem_State_GET start"); - - await setUp(); - - /** - * TEST CODE - */ - Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.CurrentConnection.State.ToString(), "CurrentConnction_STATE is fail"); - - /** - * POST CONDITION - */ - } - 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()); - } - } - } // end class -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionManager.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionManager.cs deleted file mode 100755 index 554db98d5..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionManager.cs +++ /dev/null @@ -1,1085 +0,0 @@ -using System; -using System.Net; -using Tizen.Network.WiFi; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - /* ***********************************************************************/ - // ** Scenario - Manage all connection info of mobile. - // ** - // ** connect to an AP before run this class: example: "WiFi_public" - // ** setup an AP: name/securetype is "WiFi_public"/public, connect to it mannually first - // ** get IP, MAC, proxy of connected AP - // ** caught events - // ** - /* ***********************************************************************/ - - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionManager Tests")] - public class ConnectionManagerTests - { - private string _nameWiFi; - private string _getted; - private bool _flag = false; - bool isWiFiSupported = false; - bool isTelephonySupported = false; - bool isBTTetheringSupported = false; - bool isEthernetSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _getted = null; - _nameWiFi = null; - _flag = false; - - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); - Information.TryGetValue("http://tizen.org/feature/network.tethering.bluetooth", out isBTTetheringSupported); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - _nameWiFi = networkParameter.wnPRIVATE; - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - /*setup using for connecting to a PUBLIC AP*/ - public async Task setUp_PUBLIC() - { - _nameWiFi = networkParameter.wnPUBLIC; - Log.Info(Globals.LogTag, "Try to connect to " + networkParameter.wnPUBLIC); - await networkSetup.ConnectWiFi(networkParameter.wnPUBLIC, networkParameter.wType.wPublic, null); - await Task.Delay(1500); - } - - public async Task tearDown() - { - _nameWiFi = null; - await networkSetup.DeactivateWiFi(); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("Get bluetoothState")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.BluetoothState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public void BluetoothState_DEACIVATED_STATE() - { - try - { - /** - * PRECONDITION: - * turn off bluettooth - * */ - Log.Info(Globals.LogTag, "BluetoothState_DEACIVATED_STATE start"); - /** - * TEST CODE - **/ - Log.Info(Globals.LogTag, "BluetoothState_DEACIVATED_STATE ConnectionManager is created"); - Assert.AreEqual(ConnectionState.Deactivated, ConnectionManager.BluetoothState, "get BluetoothState is fail"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isBTTetheringSupported == false, "Invalid NotSupportedException"); - } - catch (TypeInitializationException e) - { - Assert.IsTrue(isBTTetheringSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - - [Test] - [Category("P1")] - [Description("Get CellularState with ")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CellularState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task CellularState_CONNECTED_STATE() - { - /** - * PRECONDITION: - * close WiFi Connection - */ - Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE start"); - Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE ConnectionManager created"); - if (isWiFiSupported && WiFiManager.IsActive) - await tearDown(); - await Task.Delay(10000); - - Log.Info(Globals.LogTag, "CellularState_CONNECTED_STATE WiFi is disconnected"); - /** - * TEST CODE - **/ - try - { - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - - Assert.AreEqual(CellularState.Connected, ConnectionManager.CellularState, "get Cellular_Connected_State is fail"); - - // POSTCONDITION - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - } - - [Test] - [Category("P1")] - [Description("Get WiFiState with connected type")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task WiFiState_CONNECTED_STATE() - { - try - { - /** - * PRECONDITION: - * open WiFi Private - * */ - Log.Info(Globals.LogTag, "WiFiState_CONNECTED_STATE start"); - await setUp(); - - /** - * TEST CODE - **/ - Log.Info(Globals.LogTag, "WiFiState: " + ConnectionManager.WiFiState.ToString()); - Assert.AreEqual(ConnectionState.Connected, ConnectionManager.WiFiState, "Invalid WiFiState"); - } - 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) - { - if (isWiFiSupported == false) - Assert.IsInstanceOf(ex, "NotSupportedException should be thrown for not supported sensor"); - else - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - - [Test] - [Category("P1")] - [Description("Get WiFiState with disconnected type")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task WiFiState_DISCONNECTED_STATE() - { - WiFiAP _wifiAP = null; - try - { - /** - * PRECONDITION: - * turn off WiFi - * */ - Log.Info(Globals.LogTag, "WiFiState_DISCONNECTED_STATE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - await _wifiAP.ForgetAPAsync(); - await Task.Delay(1500); - - /** - * TEST CODE - **/ - Log.Info(Globals.LogTag, "WiFiState: " + ConnectionManager.WiFiState.ToString()); - Assert.AreEqual(ConnectionState.Disconnected, ConnectionManager.WiFiState, "get WiFi_State_disconnected is fail"); - - 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("P1")] - [Description("Get WiFiState with deactivated type")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.WiFiState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task WiFiState_DEACTIVATED_STATE() - { - try - { - /** - * PRECONDITION: - * turn off WiFi - * */ - Log.Info(Globals.LogTag, "WiFiState_DEACTIVATED_STATE start"); - if (WiFiManager.IsActive) - await tearDown(); - - /** - * TEST CODE - **/ - Assert.AreEqual(ConnectionState.Deactivated, ConnectionManager.WiFiState, "get WiFi_State_deactived is fail"); - - // 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()); - } - } - - [Test] - [Category("P1")] - [Description("Get WiFiState with deactivated type")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public void EthernetState_DEACTIVATED_STATE() - { - try - { - Log.Info(Globals.LogTag, "EthernetState_DEACTIVATED_STATE start"); - /** - * TEST CODE - **/ - Assert.IsTrue((ConnectionState.Deactivated == ConnectionManager.EthernetState) || - (ConnectionState.Disconnected == ConnectionManager.EthernetState) || - (ConnectionState.Connected == ConnectionManager.EthernetState), "get EthernetState_State_deactivated is fail"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isEthernetSupported == false, "Invalid NotSupportedException"); - } - catch (TypeInitializationException e) - { - Assert.IsTrue(isEthernetSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Get EthernetCableState")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.EthernetCableState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public void EthernetCableState_GET() - { - try - { - Log.Info(Globals.LogTag, "EthernetCableState_GET start"); - /** - * TEST CODE - **/ - Assert.IsTrue((EthernetCableState.Detached == ConnectionManager.EthernetCableState) || - (EthernetCableState.Attached == ConnectionManager.EthernetCableState), "get EthernetCableState_State_detached is fail"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isEthernetSupported == false, "Invalid NotSupportedException"); - } - catch (TypeInitializationException e) - { - Assert.IsTrue(isEthernetSupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Get CurrentConnection with WiFi item")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CurrentConnection A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task CurrentConnection_WiFi_ITEM() - { - Log.Info(Globals.LogTag, "CurrentConnection_WiFi_ITEM start"); - try - { - /** - * PRE CONDITION - * create a connection to WiFi public/private - * */ - await setUp(); - - /** - * TEST CODE - * */ - Assert.AreEqual(ConnectionState.Connected, ConnectionManager.CurrentConnection.State, "CurrentConnection_WiFi_ITEM is fail"); - Assert.AreEqual(ConnectionType.WiFi, ConnectionManager.CurrentConnection.Type, "CurrentConnection_WiFi_ITEM is fail"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Get Ipv4 of device: dynamic")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetIPAddress M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task GetIPAddress_DYNAMIC_IPV4() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Get connect AP - */ - Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 start"); - await setUp(); - Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 WiFi Connected"); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Log.Info(Globals.LogTag, "GetIpAddress_DYMAMIC_IPV4 BEFORE=" + _wifiAP.NetworkInformation.IPv4Setting.IP); - - /* TEST CODE */ - _getted = ConnectionManager.GetIPAddress(AddressFamily.IPv4).ToString(); - Log.Info(Globals.LogTag, "GetIpAddress AFTER=" + _getted); - Assert.IsNotNull(_getted, "Ipv4 get from manager should be not null"); - Assert.AreEqual((string)_getted, _wifiAP.NetworkInformation.IPv4Setting.IP.ToString(), "Ipv4 get from manager and from connected AP should be equal"); - } - 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("P1")] - [Description("Get all IPv6 addresses of device: dynamic")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetAllIPv6Addresses M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetAllIPv6Addresses_WIFI_PROFILE() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Get connect AP - */ - Log.Info(Globals.LogTag, "GetAllIPv6Addresses_ALL_TYPE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); - - /* TEST CODE */ - var list = ConnectionManager.GetAllIPv6Addresses(ConnectionType.WiFi); - Assert.IsNotNull(list, "GetAllIPv6Address fails"); - } - 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("P1")] - [Description("Get proxy of device")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetProxy M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task GetProxy_RETURN_VALUE_IPV4_IPV6() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * Connect to WiFi Public/Private AP - */ - Log.Info(Globals.LogTag, "GetProxy_RETURN_VALUE_IPV4_IPV6 start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); - /** - * TEST CODE - * */ - _getted = ConnectionManager.GetProxy(AddressFamily.IPv4); - Assert.IsNotNull(_getted, "Ipv4 get from manager should be not null"); - _getted = ConnectionManager.GetProxy(AddressFamily.IPv6); - Assert.IsNotNull(_getted, "Ipv6 get from manager should be not null"); - } - 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("P1")] - [Description("Get mac address of device")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetMacAddress M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task GetMacAddress_ALL_CONNECTION_TYPE() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Bluetooth, SIM card inserted. - */ - Log.Info(Globals.LogTag, "GetMacAddress_ALL_CONNECTION_TYPE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); - - /* TEST CODE */ - /*--------------------WiFi mac address------------------*/ - _getted = ConnectionManager.GetMacAddress(ConnectionType.WiFi); - Assert.IsNotNull((string)_getted, "MacAddress of WiFi get from manager should be not null"); - /*compare to WiFimanager*/ - var getted = WiFiManager.MacAddress; - Console.WriteLine("HYUKIN _getted:" + _getted); - Console.WriteLine("HYUKIN getted:" + getted); - Assert.AreEqual(_getted, getted, "MacAddress get from WiFiManager and from manager should be equal"); - } - 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("P1")] - [Description("Get statistics")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.GetStatistics M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR, MAE")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetStatistics_ALL_STATISTICS_TYPE() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Bluetooth, SIM card inserted. - */ - Log.Info(Globals.LogTag, "GetStatistics_ALL_CONNECTION_TYPE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Assert.AreEqual((string)_nameWiFi, (string)_wifiAP.NetworkInformation.Essid, "Connect to an AP do not successfully"); - - /* TEST CODE */ - var data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData); - Log.Info(Globals.LogTag, "LastReceivedData: " + data); - Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); - data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData); - Log.Info(Globals.LogTag, "LastSentData: " + data); - Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); - data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData); - Log.Info(Globals.LogTag, "TotalReceivedData: " + data); - Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); - data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData); - Log.Info(Globals.LogTag, "TotalSentData: " + data); - Assert.IsTrue(data.GetType() == typeof(long), "GetStatistics failed"); - } - 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("P1")] - [Description("Reset statistics")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ResetStatistics M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR, MAE, MCST")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task ResetStatistics_ALL_STATISTICS_TYPE() - { - try - { - Log.Info(Globals.LogTag, "ResetStatistics_ALL_CONNECTION_TYPE start"); - await tearDown(); - - ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData); - Log.Info(Globals.LogTag, "Reset LastReceivedData"); - Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastReceivedData), "Reset LastReceivedData failed"); - ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData); - Log.Info(Globals.LogTag, "Reset LastSentData"); - Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.LastSentData), "Reset LastSentData failed"); - ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData); - Log.Info(Globals.LogTag, "Reset TotalReceivedData"); - Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData), "Reset TotalReceivedData failed"); - ConnectionManager.ResetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData); - Log.Info(Globals.LogTag, "Reset TotalSentData"); - Assert.IsTrue(0 == ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalSentData), "Reset TotalSentData failed"); - - // 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()); - } - } - - [Test] - [Category("P1")] - [Description("Listen connection type changed event")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ConnectionTypeChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task ConnectionTypeChanged_EVENT() - { - try - { - /** - * PRE CONDITION - * create a connection to WiFi public/private AP - * */ - Log.Info(Globals.LogTag, "ConnectionTypeChanged_EVENT start"); - await setUp(); - /** - * TEST CODE - * */ - ConnectionManager.ConnectionTypeChanged += EventHandlerConnectionTypeChanged; - await Task.Delay(1500); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - ConnectionManager.ConnectionTypeChanged -= EventHandlerConnectionTypeChanged; - Assert.IsTrue(_flag, "Event ChangeType is fail"); - // 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()); - } - } - - public void EventHandlerConnectionTypeChanged(object sender, ConnectionTypeEventArgs e) - { - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Listen IpAddess changed")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.IPAddressChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task IPAddressChanged_EVENT() - { - WiFiAP _wifiAP = null; - try - { - /** - * PRE CONDITION - * create a connection to WiFi public/private - * */ - Log.Info(Globals.LogTag, "IpAddressChanged_EVENT start"); - ConnectionManager.IPAddressChanged += EventHandlerIpAddressChanged; - await Task.Delay(1500); - await setUp(); - /** - * TEST CODE - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - await _wifiAP.ForgetAPAsync(); - await Task.Delay(1500); - await setUp(); - ConnectionManager.IPAddressChanged -= EventHandlerIpAddressChanged; - Assert.IsTrue(_flag, "Event ChangeType is fail"); - } - 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(); - } - } - } - - public void EventHandlerIpAddressChanged(object sender, AddressEventArgs e) - { - Log.Info(Globals.LogTag, "IP is changed: " + e.IPv4Address); - _flag = true; - } - - [Test] - [Category("P1")] - [Description("listen ProxyAddressChanged event")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.ProxyAddressChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task ProxyAddressChanged_EVENT() - { - Log.Info(Globals.LogTag, "ProxyAddressChanged_EVENT start"); - WiFiAP _wifiAP = null; - try - { - 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(1500); - 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 networkSetup.ForgetCurrentAP(); - ConnectionManager.ProxyAddressChanged -= EventHandlerProxyAddressChanged; - // 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(); - } - } - } - - public void EventHandlerProxyAddressChanged(object sender, AddressEventArgs e) - { - Log.Info(Globals.LogTag, "Proxy is changed: " + e.IPv4Address); - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Get CurrentConnection with WiFi item")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CurrentConnection A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Thao, nguyen.thao@samsung.com")] - public async Task CurrentConnection_Get_Connected_State_WiFi_PUBLIC() - { - Log.Info(Globals.LogTag, "CurrentConnection_Get_Connected_State_WiFi_PUBLIC start"); - try - { - /** - * PRE CONDITION - * create a connection to WiFi public - * */ - await setUp_PUBLIC(); - Log.Info(Globals.LogTag, "Connected to public AP"); - /** - * TEST CODE - * */ - Log.Info(Globals.LogTag, "ConnectionState=" + ConnectionManager.CurrentConnection.State.ToString()); - 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) - { - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test CreateRequestProfile method with Cellular type")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.CreateCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - public void CreateCellularProfile_CELLULAR() - { - try - { - Log.Info(Globals.LogTag, "CreateCellularProfile_CELLULAR start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - CellularProfile rCP = null; - string _key = "RequestCellularProfile"; - rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, _key); - Assert.IsNotNull(rCP, "object should not be null after INIT"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (TypeInitializationException e) - { - Assert.IsTrue(isTelephonySupported == false && e.InnerException.GetType() == typeof(NotSupportedException), "Invalid NotSupportedException or TypeInitializationException"); - } - catch (Exception ex) - { - Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test AddRoute Method")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.AddRoute M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task AddRoute_WiFi() - { - try - { - Log.Info(Globals.LogTag, "AddRoute_WiFi start"); - - await setUp(); - var hostAddress = IPAddress.Parse("1.1.1.1"); - var gateway = IPAddress.Parse("192.168.0.1"); - ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); - Assert.True(true, "AddRoute"); - } - 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.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P2")] - [Description("Test if AddRoute method throws ArgumentNullException")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.AddRoute M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task AddRoute_ARGUMENTNULLEXCEPTION() - { - try - { - Log.Info(Globals.LogTag, "AddRoute_ARGUMENTNULLEXCEPTION start"); - - await setUp(); - ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", null, null); - Assert.True(false, "Should throw ArgumentNullException"); - } - 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 (ArgumentNullException) - { - Assert.True(true, "AddRoute fails"); - } - catch (Exception ex) - { - Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Test RemoveRoute Method")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.RemoveRoute M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task RemoveRoute_WiFi() - { - try - { - Log.Info(Globals.LogTag, "RemoveRoute_WiFi start"); - - await setUp(); - var hostAddress = IPAddress.Parse("1.1.1.1"); - var gateway = IPAddress.Parse("192.168.0.1"); - ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); - ConnectionManager.RemoveRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); - Assert.True(true, "RemoveRoute"); - } - 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.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P2")] - [Description("Test if RemoveRoute method throws ArgumentNullException")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionManager.RemoveRoute M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task RemoveRoute_ARGUMENTNULLEXCEPTION() - { - try - { - Log.Info(Globals.LogTag, "RemoveRoute_ARGUMENTNULLEXCEPTION start"); - - await setUp(); - var hostAddress = IPAddress.Parse("1.1.1.1"); - var gateway = IPAddress.Parse("192.168.0.1"); - ConnectionManager.AddRoute(AddressFamily.IPv4, "wlan0", hostAddress, gateway); - ConnectionManager.RemoveRoute(AddressFamily.IPv4, "wlan0", null, null); - Assert.True(false, "Should throw ArgumentNullException"); - } - 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 (ArgumentNullException) - { - Assert.True(true, "RemoveRoute fails"); - } - catch (Exception ex) - { - Assert.IsTrue(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - } // end class -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfile.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfile.cs deleted file mode 100755 index aa8caa09a..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfile.cs +++ /dev/null @@ -1,629 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using System.Net; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionProfile Tests")] - public class ConnectionProfileTests - { - public bool _flag; - bool isWiFiSupported = false; - bool isEthernetSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("get Id of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Id A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task Id_GET() - { - Log.Info(Globals.LogTag, "Id_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.IsNotNull((string)_connectionProfile.Id, "ID is null"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("get InterfaceName of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.InterfaceName A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task InterfaceName_GET() - { - Log.Info(Globals.LogTag, "InterfaceName_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.IsNotNull((string)_connectionProfile.InterfaceName, "InterfaceName is null"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("get ProfileState of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.GetState M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetState_IPV4() - { - Log.Info(Globals.LogTag, "GetState_IPV4 start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.AreEqual(ProfileState.Connected.ToString(), _connectionProfile.GetState(AddressFamily.IPv4).ToString(), "get state is fail"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("refresh profile informations")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Refresh M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task Refresh_REFRESH() - { - Log.Info(Globals.LogTag, "Refresh_REFRESH start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - _connectionProfile.Refresh(); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("get Name of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Name A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task Name_GET() - { - Log.Info(Globals.LogTag, "Name_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) - { - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.IsTrue(_connectionProfile.Name.Contains("eth"), "get name is fail"); - } - else - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.AreEqual((string)networkParameter.wnPRIVATE, (string)_connectionProfile.Name, "get name is fail"); - } - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("get Type of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.Type A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task Type_GET() - { - Log.Info(Globals.LogTag, "Type_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) - { - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.AreEqual(ConnectionProfileType.Ethernet, _connectionProfile.Type, "get Type is fail"); - } - else - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Assert.AreEqual(ConnectionProfileType.WiFi, _connectionProfile.Type, "get Type is fail"); - } - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("set and get a IPV4 of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.IPv4Settings A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task IPv4Settings_SET_GET() - { - Log.Info(Globals.LogTag, "IPv4Settings_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - Log.Info(Globals.LogTag, "GetCurrentProfile done"); - Log.Info(Globals.LogTag, "Get IPv4 information"); - var addInfor = _connectionProfile.IPv4Settings; - var preIP = 3456; - var preSubnet = "255.255.0.0"; - var preGateway = 234567; - Assert.IsNotNull(addInfor, "Ipv4Settings is NULL"); - addInfor.IPConfigType = IPConfigType.Static; - Log.Info(Globals.LogTag, "Set IPv4 information " + new IPAddress(preIP).ToString()); - addInfor.IP = new IPAddress(preIP); - Log.Info(Globals.LogTag, "addInfor.IP " + addInfor.IP.ToString()); - addInfor.SubnetMask = IPAddress.Parse(preSubnet); - addInfor.Gateway = new IPAddress(preGateway); - ConnectionProfileManager.UpdateProfile(_connectionProfile); - Assert.AreEqual(new IPAddress(BitConverter.GetBytes(preGateway)).ToString(), addInfor.Gateway.ToString(), "set Gateway is fail"); - 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) - { - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("set and get a IPV6 of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.IPv6Settings A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task IPv6Settings_SET_GET() - { - Log.Info(Globals.LogTag, "IPv6Settings_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var addInfor = _connectionProfile.IPv6Settings; - Assert.IsNotNull(addInfor, "Ipv4Settings is NULL"); - var preIP = "fe80::202:b3ff:fe1e:8329"; - addInfor.IPConfigType = IPConfigType.Static; - addInfor.IP = IPAddress.Parse(preIP); - ConnectionProfileManager.UpdateProfile(_connectionProfile); - await Task.Delay(3000); - - bool found = false; - var IPList = ConnectionManager.GetAllIPv6Addresses(ConnectionType.WiFi); - foreach (IPAddress item in IPList) - { - Log.Info(Globals.LogTag, "IPv6 Address: " + item.ToString()); - if (item.ToString().Equals(preIP)) - { - found = true; - break; - } - } - 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) - { - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("set and get a ProxyType of a connection profile exist")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProxyType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ProxyType_SET_GET() - { - Log.Info(Globals.LogTag, "ProxyType_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - - _connectionProfile.ProxyType = ProxyType.Manual; - Assert.AreEqual(ProxyType.Manual.ToString(), _connectionProfile.ProxyType.ToString(), "Set ProxyType is fail"); - - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test ProxyAddress property of a connection profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProxyAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ProxyAddress_SET_GET() - { - Log.Info(Globals.LogTag, "ProxyAddress_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - - /* 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"); - - /* POSTCONDITION */ - await networkSetup.ForgetCurrentAP(); - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - public void EventHandlerProfileStateChanged(object sender, ProfileStateEventArgs e) - { - _flag = true; - Log.Info(Globals.LogTag, "ProfileState" + e.State); - } - - [Test] - [Category("P1")] - [Description("Check ProfileStateChanged event action")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfile.ProfileStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ProfileStateChanged_CHECK_EVENT() - { - Log.Info(Globals.LogTag, "ProfileStateChanged_CHECK_EVENT start"); - ConnectionProfile _connectionProfile = null; - Log.Info(Globals.LogTag, "ProfileStateChanged_CHECK_EVENT start"); - try - { - await setUp(); - var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPRIVATE) - { - Log.Info(Globals.LogTag, "Find " + networkParameter.wnPRIVATE); - _connectionProfile = i; - break; - } - i.Dispose(); - } - - Assert.IsNotNull(_connectionProfile, "No Profile Found"); - _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged; - await Task.Delay(1500); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - Log.Info(Globals.LogTag, "_flag=" + _flag); - Assert.IsTrue(_flag, "Profile State don't change"); - _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; - // 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileManager.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileManager.cs deleted file mode 100755 index b1bec2e46..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileManager.cs +++ /dev/null @@ -1,984 +0,0 @@ -using System; -using Tizen.Network.Connection; -using Tizen.Network.WiFi; -using System.Collections.Generic; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - /* ***********************************************************************/ - // ** Scenario - Manage all connection info of mobile. - // ** - // ** connect to an AP before run this class: example: "WiFi_public" - // ** setup an AP: name/securetype is "WiFi_public"/public, connect to it mannually first - // ** get IP, MAC, proxy of connected AP - // ** caught events - // ** - /* ***********************************************************************/ - - [TestFixture] - [Description("Tizen.Network.ConnectionProfileManager Tests")] - public class ConnectionProfileManagerTests - { - IEnumerable _list; - private int _numTask; - bool isWiFiSupported = false; - bool isTelephonySupported = false; - bool isBTTetheringSupported = false; - bool isEthernetSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - Information.TryGetValue("http://tizen.org/feature/network.telephony", out isTelephonySupported); - Information.TryGetValue("http://tizen.org/feature/network.tethering.bluetooth", out isBTTetheringSupported); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - public async Task tearDown() - { - await networkSetup.DeactivateWiFi(); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("Get a DefaultCellularProfile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public void GetDefaultCellularProfile_TYPE_INTERNET() - { - try - { - Log.Info(Globals.LogTag, "GetDefaultCellularProfile_TYPE_INTERNET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - /* - * Preconditions: - * Insert Simcard in devices and turn off WiFi - */ - /* TEST CODE */ - var currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(currCP, "GetDefaultCellularProfile is fail"); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test]/*FIXME: this function: GetDefaultCellularProfile_TYPE_MMS does not work in this binary*/ - [Category("P1")] - [Description("get a default Cellular Profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetDefaultCellularProfile_TYPE_MMS() - { - try - { - Log.Info(Globals.LogTag, "GetDefaultCellularProfile_TYPE_MMS start"); - /* - * Preconditions: - * Insert Simcard in devices and turn off WiFi - */ - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - - if (isWiFiSupported && WiFiManager.IsActive) - await tearDown(); - - /* TEST CODE */ - var connectProfile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(connectProfile, "Can't get current profile"); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test]/*FIXME: this function: SetDefaultCellularProfile_TYPE_MMS does not work in this binary*/ //hangon - [Category("P1")] - [Description("set a default Cellular Profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.SetDefaultCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task SetDefaultCellularProfile_TYPE_MMS() - { - try - { - Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_MMS start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - - if (isWiFiSupported && WiFiManager.IsActive) - await tearDown(); - - var connectProfile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.MMS); - Assert.IsNotNull(connectProfile, "getCellular is Null"); - await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.MMS, connectProfile); - Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_MMS Finish"); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("GetDefaultCellularProfile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetDefaultCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task GetDefaultCellularProfile_SIM_INSERTED() - { - ConnectionProfile _currCP = null; - - try - { - /* - * Preconditions: - * Insert Simcard in devices and turn off WiFi - */ - Log.Info(Globals.LogTag, "GetDefaultCellularProfile_SIM_INSERTED start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - - /* TEST CODE */ - _currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.MMS); - Assert.IsNotNull(_currCP, "Object should be not NULL"); - _currCP = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Assert.IsNotNull(_currCP, "Object should be not NULL"); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isTelephonySupported == false, "Invalid NotSupportedException"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_currCP != null) - { - _currCP.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Get list of profile, which is Registered on mobile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync ME")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Tan, nguyen.vtan@samsung.com")] - public async Task GetProfileListAsync_REGISTERED() - { - try - { - /* - * Preconditions: - * -your mobile connected to some APs before, - * -WiFi turn on, - * -your mobile connected to an AP now - * -bluetooth turn on, - * -SIM card inserted - * - * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time - */ - Log.Info(Globals.LogTag, "GetProfileListAsync_REGISTERED start"); - await setUp(); - - /* TEST CODE*/ - _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - _numTask = 0; - foreach (var p in _list) - { - //Console.WriteLine("Profilexx:" + p.Name); - _numTask++; - p.Dispose(); - } - Assert.Greater(_numTask, 0, "GetProfileListAsync is fail"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Get list of profile, which is type Connnected")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetProfileListAsync_PROFILE_TYPE_CONNECTED() - { - try - { - /* - * Preconditions: - * WiFi turn on, - * your mobile connected to an AP now, - * - * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time - */ - Log.Info(Globals.LogTag, "GetProfileListAsync_PROFILE_TYPE_CONNECTED start"); - await setUp(); - - /*TEST CODE*/ - _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); - _numTask = 0; - foreach (var p in _list) - { - if (p.Type == ConnectionProfileType.WiFi) - _numTask++; - p.Dispose(); - } - Assert.AreEqual(1, _numTask); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Get list of profile, which is type Connnected")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetProfileListAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetProfileListAsync_PROFILE_TYPE_CONNECTED_NONE() - { - try - { - /* - * Preconditions: - * WiFi turn off, - * your mobile do not connect to any AP now, - * - * GetProfileListAsync(Registered) type: will return all profiles which your mobile connected at that time - */ - Log.Info(Globals.LogTag, "GetProfileListAsync_PROFILE_TYPE_CONNECTED_NONE start"); - if (isWiFiSupported && WiFiManager.IsActive) - await tearDown(); - - /*TEST CODE*/ - _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); - _numTask = 0; - foreach (var p in _list) - { - if (p.Type == ConnectionProfileType.WiFi) - _numTask++; - p.Dispose(); - } - Assert.AreEqual(0, _numTask); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - 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()); - } - } - - [Test] - [Category("P1")] - [Description("get Current profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.GetCurrentProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetCurrentProfile_RETURN_VALUE() - { - ConnectionProfile _currCP = null; - WiFiAP _wifiAP = null; - Log.Info(Globals.LogTag, "GetCurrentProfile_RETURN_VALUE start"); - try - { - if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) - { - Log.Info(Globals.LogTag, "Ethernet is connected"); - _currCP = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_currCP); - Assert.IsTrue(_currCP.Name.Contains("eth"), "get name is fail"); - } - else - { - /* - * Preconditions: - * WiFi turn on, - * your mobile connected to an AP: example: "WiFi_public" now, - * - * GetCurrentProfile: return current profiles which your mobile connected at that time - */ - await setUp(); - /*Connect to an online AP*/ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - - /* TEST CODE - * Get current profile - */ - _currCP = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_currCP); - Assert.AreEqual(_wifiAP.NetworkInformation.Essid.ToString(), _currCP.Name.ToString(), "WiFi manager should get right current profile"); - } - } - 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 (_currCP != null) - { - _currCP.Dispose(); - } - if (_wifiAP != null) - { - _wifiAP.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Remove a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.RemoveProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task RemoveProfile_REMOVE() - { - WiFiAP _wifiAP = null; - ConnectionProfile _profile = null; - try - { - /* - * Preconditions: - * WiFi turn on, - * your mobile connected to an AP: example: "WiFi_private" now, - * - * GetCurrentProfile: return current profiles which your mobile connected at that time - */ - Log.Info(Globals.LogTag, "RemoveProfile_REMOVE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - - /* TEST CODE */ - var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); - foreach (var item in list) - { - if (item.Name == networkParameter.wnPRIVATE) - { - _profile = item; - break; - } - item.Dispose(); - } - - ConnectionProfileManager.RemoveProfile(_profile); - list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); - bool flag = true; - foreach (var item in list) - { - if (item.Name == networkParameter.wnPRIVATE) - { - flag = false; - break; - } - item.Dispose(); - } - - Assert.IsTrue(flag, "RemoveProfile is fail"); - 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(); - } - if (_profile != null) - { - _profile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Remove a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.RemoveProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task RemoveProfile_REMOVE_TYPE_CELLULAR() - { - try - { - /** - * PRECONDITION - * turn off WiFi - * */ - Log.Info(Globals.LogTag, "RemoveProfile_REMOVE_TYPE_CELLULAR start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Log.Info(Globals.LogTag, "Out of service"); - Assert.IsTrue(true, "Out of service"); - return; - } - if (isWiFiSupported && WiFiManager.IsActive) - { - await tearDown(); - Log.Info(Globals.LogTag, "WiFi deactivated"); - } - //TEST CODE - CellularProfile rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, "TestCellular"); - rCP.ServiceType = CellularServiceType.Internet; - ConnectionProfileManager.AddCellularProfile(rCP); - Log.Info(Globals.LogTag, "AddCellularProfile is completed"); - //check new profile exits - var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - bool mFlag = false; - foreach (var item in list) - { - Log.Info(Globals.LogTag, "profile: " + item.Name); - if (item.Name == "TestCellular") - { - mFlag = true; - Log.Info(Globals.LogTag, "RemoveProfile " + item.Name); - ConnectionProfileManager.RemoveProfile(item); - Log.Info(Globals.LogTag, "RemoveProfile is completed"); - } - item.Dispose(); - } - Log.Info(Globals.LogTag, "Profile is removed"); - Assert.IsTrue(mFlag, "Add profile is not success"); - ConnectionProfile mConnectionProfile = null; - mConnectionProfile = null; - list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var item in list) - { - Log.Info(Globals.LogTag, "profile: " + item.Name); - if (item.Name == "TestRemoveProfile") - { - mConnectionProfile = item; - break; - } - item.Dispose(); - } - Assert.IsNull(mConnectionProfile, "RemoveProfile is fail"); - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); - } - } - - /* - * Scenario: - * get current AP profile - * remove it - * connect to it using: ConnectProfileAsync - * compare name - * */ - [Test] - [Category("P1")] - [Description("Connect to a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.ConnectProfileAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT() - { - ConnectionProfile _profile = null; - try - { - /* - * Preconditions: - * WiFi turn on, - * your mobile connected to an AP: example: "WiFi_public" now, - * get current AP profile - * remove it - * connect to it using: ConnectProfileAsync - * compare name - * - * GetCurrentProfile: return current profiles which your mobile connected at that time - */ - Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT start"); - await setUp(); - - /* TEST CODE */ - var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPRIVATE) - { - Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); - _profile = i; - break; - } - i.Dispose(); - } - Assert.IsNotNull(_profile, "Profile is Null"); - await ConnectionProfileManager.DisconnectProfileAsync(_profile); - Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail"); - await Task.Delay(1500); - await ConnectionProfileManager.ConnectProfileAsync(_profile); - Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.WiFiState.ToString(), "ConnectProfileAsync is fail"); - Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_AGAIN_TO_SAME_POINT Finish"); - } - 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 (_profile != null) - { - _profile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Connect to a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.ConnectProfileAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task ConnectProfileAsync_CONNECT_TO_NEW_POINT() - { - ConnectionProfile _currCP = null; - ConnectionProfile _currCP1 = null; - try - { - /* - * Precondition: - * get all current AP profile - * remove it - * connect to new point using: ConnectProfileAsync - * compare name - * */ - Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_TO_NEW_POINT start"); - await setUp(); - Log.Info(Globals.LogTag, "wifi is connected"); - - _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPRIVATE) - { - Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); - _currCP = i; - break; - } - i.Dispose(); - } - /*Disconnect AP*/ - await ConnectionProfileManager.DisconnectProfileAsync(_currCP); - await Task.Delay(1500); - Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail"); - Log.Info(Globals.LogTag, "wifi is disconnected"); - - /* TEST CODE */ - /* connect to a WANTED AP */ - _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - ConnectionProfile mP = null; - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPUBLIC) - { - Log.Info(Globals.LogTag, "Found " + networkParameter.wnPUBLIC); - mP = i; - break; - } - i.Dispose(); - } - await ConnectionProfileManager.ConnectProfileAsync(mP); - Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.WiFiState.ToString(), "ConnectProfileAsync is fail"); - Log.Info(Globals.LogTag, "ConnectProfileAsync_CONNECT_TO_NEW_POINT Finish"); - } - 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 (_currCP != null) - { - _currCP.Dispose(); - } - if (_currCP1 != null) - { - _currCP1.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("DisConnect to a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.DisconnectProfileAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task DisconnectProfileAsync_DISCONNECT_AP() - { - ConnectionProfile _profile = null; - try - { - /* - * Preconditions: - * -your mobile connected to some APs before, - * -WiFi turn on, - * -your mobile connected to an AP now - */ - Log.Info(Globals.LogTag, "DisconnectProfileAsync_DISCONNECT_AP start"); - if (WiFiManager.GetConnectedAP() == null) - { - await Task.Delay(1500); - } - await setUp(); - /* TEST CODE */ - var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPRIVATE) - { - Log.Info(Globals.LogTag, "Found " + networkParameter.wnPRIVATE); - _profile = i; - break; - } - i.Dispose(); - } - await ConnectionProfileManager.DisconnectProfileAsync(_profile); - 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) - { - 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 (_profile != null) - { - _profile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Add a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.AddCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Hyukin, hyukin.kwon@samsung.com")] - public async Task AddCellularProfile_ADD_A_NEW() - { - try - { - Log.Info(Globals.LogTag, "AddCellularProfile_ADD_A_NEW start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - await setUp(); - CellularProfile rCP = ConnectionManager.CreateCellularProfile(ConnectionProfileType.Cellular, "TestCellular"); - rCP.ServiceType = CellularServiceType.Internet; - ConnectionProfileManager.AddCellularProfile(rCP); - Log.Info(Globals.LogTag, "AddCellularProfile is finished"); - var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - ConnectionProfile mConnectionProfile = null; - foreach (var item in list) - { - if (item.Name.ToString() == "TestCellular") - { - mConnectionProfile = item; - break; - } - item.Dispose(); - } - Assert.IsNotNull(mConnectionProfile, "Add profile is not success"); - /**POST CONDITION - * Rome profile, which's just addition - * turn off WiFi - **/ - list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var item in list) - { - if (item.Name.ToString() == "TestCellular") - { - ConnectionProfileManager.RemoveProfile(item); - } - item.Dispose(); - } - } - catch (NotSupportedException) - { - Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); - } - } - - [Test] - [Category("P1")] - [Description("set a default Cellular Profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.SetDefaultCellularProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Hyukin, hyukin.kwon@samsung.com")] - public async Task SetDefaultCellularProfile_TYPE_INTERNET() - { - try - { - /* - * Preconditions: - * 1. Add Profile. - * 2. Get Profile. - */ - Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_INTERNET start"); - if (ConnectionManager.CellularState == CellularState.OutOfService) - { - Assert.True(true, "Out of service"); - return; - } - - if (isWiFiSupported && WiFiManager.IsActive) - await tearDown(); - - /* TEST CODE */ - var profile = ConnectionProfileManager.GetDefaultCellularProfile(CellularServiceType.Internet); - Log.Info(Globals.LogTag, "Get current default cellular profile: " + profile.Name); - Log.Info(Globals.LogTag, "Set current default cellular profile: " + profile.Name); - await ConnectionProfileManager.SetDefaultCellularProfile(CellularServiceType.Internet, profile); - Log.Info(Globals.LogTag, "SetDefaultCellularProfile_TYPE_INTERNET finished"); - - // POSTCONDITION - if (isWiFiSupported && !WiFiManager.IsActive) - await setUp(); - } - catch (NotSupportedException) - { - Assert.IsTrue(isWiFiSupported == false || isTelephonySupported == 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()); - } - } - - [Test] - [Category("P1")] - [Description("Update a profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileManager.UpdateProfile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task UpdateProfile_UPDATE_A_PROFILE() - { - try - { - /* - * Preconditions: - * -your mobile connected to some APs before, - * -WiFi turn on, - * -your mobile connected to an AP now - */ - Log.Info(Globals.LogTag, "UpdateProfile_UPDATE_A_PROFILE start"); - await setUp(); - /* TEST CODE */ - var currentProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(currentProfile); - ConnectionProfileManager.UpdateProfile(currentProfile); - Log.Info(Globals.LogTag, "UpdateProfile_UPDATE_A_PROFILE Finish"); - } - 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()); - } - } - } // end class -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileStateEventArgs.cs deleted file mode 100755 index b773e2ff6..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionProfileStateEventArgs.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionProfileStateEventArgs Tests")] - public class ConnectionProfileStateEventArgsTests - { - public bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - public void EventHandlerProfileStateChanged(object sender, ProfileStateEventArgs e) - { - if (e.State == ProfileState.Disconnected) - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Get State of Profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionProfileStateEventArgs.ConnectionProfileState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task ConnectionProfileState_GET() - { - _flag = false; - ConnectionProfile _connectionProfile = null; - Log.Info(Globals.LogTag, "Start ConnectionProfileState_GET"); - try - { - await setUp(); - var _list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var i in _list) - { - Log.Info(Globals.LogTag, "Find Profile " + i.Name); - if (i.Name == networkParameter.wnPRIVATE) - { - Log.Info(Globals.LogTag, "Find " + networkParameter.wnPRIVATE); - _connectionProfile = i; - break; - } - i.Dispose(); - } - - Assert.IsNotNull(_connectionProfile, "No Profile Found"); - _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged; - await Task.Delay(1500); - Log.Info(Globals.LogTag, "Event subscripted"); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - Assert.IsTrue(_flag, "Profile State don't change"); - _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged; - // 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionStateChangedEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionStateChangedEventArgs.cs deleted file mode 100755 index a79bd71fb..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionStateChangedEventArgs.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.ConnectionStateChangedEventArgs test")] - public class ConnectionStateChangedEventArgsTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - private void EventHandlerConnectionStateChangedCBState(object sender, ConnectionStateChangedEventArgs e) - { - if (e.State == WiFiManager.ConnectionState) - _flag = true; - } - - private void EventHandlerConnectionStateChangedCBAp(object sender, ConnectionStateChangedEventArgs e) - { - if (e.AP.NetworkInformation.Essid == networkParameter.wnPRIVATE1) - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Test State property of ConnectionStateChangedEventArgs")] - [Property("SPEC", "Tizen.Network.WiFi.ConnectionStateChangedEventArgs.State A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task State_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then connect to an AP. - */ - await setUp(); - Assert.IsFalse(_flag, "Flag should be fail before checking"); - - /* - * TEST CODE - */ - WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBState; - await Task.Delay(1500); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - Assert.IsTrue(_flag, "Flag should be true after checking"); - - /** - * POSTCONDITION - * */ - WiFiManager.ConnectionStateChanged -= EventHandlerConnectionStateChangedCBState; - // 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test Ap property of ConnectionStateChangedEventArgs")] - [Property("SPEC", "Tizen.Network.WiFi.ConnectionStateChangedEventArgs.AP A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task AP_PROPERTY() - { - WiFiAP _wifiAP1 = null; - WiFiAP _wifiAP2 = null; - try - { - /* - * PRECONDITION - * The first, connect to WiFi private1 - */ - await setUp(); - _wifiAP1 = WiFiManager.GetConnectedAP(); - await networkSetup.ForgetCurrentAP(); - Assert.IsFalse(_flag, "Flag should be fail before checking"); - - /* - * TEST CODE - * Then, connect to WiFi private2, changed WiFiApjk - */ - WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBAp; - await Task.Delay(1500); - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE1, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - _wifiAP2 = WiFiManager.GetConnectedAP(); - Assert.IsTrue(_flag, "Flag should be true after checking"); - WiFiManager.ConnectionStateChanged -= EventHandlerConnectionStateChangedCBAp; - // 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 (_wifiAP1 != null) - { - _wifiAP1.Dispose(); - } - if (_wifiAP2 != null) - { - _wifiAP2.Dispose(); - } - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionTypeEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionTypeEventArgs.cs deleted file mode 100755 index f3da2f7eb..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSConnectionTypeEventArgs.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ConnectionTypeEventArgs Tests")] - public class ConnectionTypeEventArgsTests - { - public bool _flag; - bool isWiFiSupported = false; - bool isEthernetSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - Information.TryGetValue("http://tizen.org/feature/network.ethernet", out isEthernetSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - _flag = false; - } - /*setup using for connecting to a PRIVATE AP*/ - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("Get State of Profile")] - [Property("SPEC", "Tizen.Network.Connection.ConnectionTypeEventArgs.ConnectionType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")] - public async Task ConnectionType_GET() - { - try - { - if (isEthernetSupported && ConnectionManager.EthernetState == ConnectionState.Connected) - { - /* always connected to ethernet */ - } - else - { - /**PRE CONDITION - * Connect to wifi AP - * */ - Log.Info(Globals.LogTag, "ConnectionType_GET start"); - await networkSetup.ForgetCurrentAP(); - Assert.IsFalse(_flag, "Flag should be fail before check"); - - /** TEST CODE */ - ConnectionManager.ConnectionTypeChanged += ConnectionTypeChangedCB; - await Task.Delay(1500); - Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged Event subsribed"); - await setUp(); - Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Connected"); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Disconnected"); - Assert.IsTrue(_flag, "ConnectionType is not changed"); - ConnectionManager.ConnectionTypeChanged -= ConnectionTypeChangedCB; - // 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()); - } - } - - public void ConnectionTypeChangedCB(object sender, ConnectionTypeEventArgs e) - { - if (e.ConnectionType == ConnectionType.WiFi || e.ConnectionType == ConnectionType.Disconnected) - _flag = true; - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSDeviceStateChangedEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSDeviceStateChangedEventArgs.cs deleted file mode 100755 index fec3bc6d4..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSDeviceStateChangedEventArgs.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.DeviceStateChangedEventArgs test")] - public class DeviceStateChangedEventArgsTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Posconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - public async Task tearDown() - { - await networkSetup.DeactivateWiFi(); - } - - private void EventHandlerDeviceStateChangedCB(object sender, DeviceStateChangedEventArgs e) - { - Log.Info(Globals.LogTag, "Device state is changed: " + e.State); - if (e.State == WiFiDeviceState.Deactivated) - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Test State property of DeviceStateChangedEventArgs")] - [Property("SPEC", "Tizen.Network.WiFi.DeviceStateChangedEventArgs.State A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task State_PROPERTY() - { - try - { - /* - * TEST CODE - */ - WiFiManager.DeviceStateChanged += EventHandlerDeviceStateChangedCB; - await Task.Delay(1500); - await tearDown(); - await Task.Delay(1500); - await setUp(); - await Task.Delay(1500); - Assert.IsTrue(_flag, "Flag should be true after checking"); - - WiFiManager.DeviceStateChanged -= EventHandlerDeviceStateChangedCB; - } - 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()); - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSIAddressInformation.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSIAddressInformation.cs deleted file mode 100755 index e286e0e04..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSIAddressInformation.cs +++ /dev/null @@ -1,538 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using System.Net; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.IAddressInformation test")] - public class IAddressInformationTests - { - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - [Test] - [Category("P1")] - [Description("Test Dns1 property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Dns1 A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Dns1_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - var getDns1 = iAddressInformation.Dns2; - Assert.IsTrue(!getDns1.Equals(""), "Dns1 is empty"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Dns2 property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Dns2 A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Dns2_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - var getDns2 = iAddressInformation.Dns2; - Assert.IsNotNull(getDns2.ToString(), "Dns2 is NULL"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Gateway property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.Gateway A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Gateway_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - var getGateway = iAddressInformation.Gateway; - Assert.IsNotNull(getGateway.ToString(), "gateway is NULL"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test SubnetMask property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.SubnetMask A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SubnetMask_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - var subnetMask = "255.255.255.0"; - iAddressInformation.SubnetMask = IPAddress.Parse(subnetMask); - var getSubnetMask = iAddressInformation.SubnetMask; - Assert.AreEqual(subnetMask.ToString(), getSubnetMask.ToString(), "SubnetMask of IAddressInformation get should be same set"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Ip property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.IP A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IP_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - var getIp = iAddressInformation.IP; - Assert.IsNotNull(getIp.ToString(), "IP is NULL"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test IpConfigType property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.IPConfigType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IPConfigType_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Connect to wifi private - */ - await setUp(); - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - /* - * TEST CODE - */ - iAddressInformation.IPConfigType = IPConfigType.Dynamic; - Assert.AreEqual((int)(IPConfigType.Dynamic), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Dynamic after setting"); - iAddressInformation.IPConfigType = IPConfigType.Fixed; - Assert.AreEqual((int)(IPConfigType.Fixed), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Fixed after setting"); - iAddressInformation.IPConfigType = IPConfigType.Static; - Assert.AreEqual((int)(IPConfigType.Static), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return after setting"); - iAddressInformation.IPConfigType = IPConfigType.Auto; - Assert.AreEqual((int)(IPConfigType.Auto), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return Auto after setting"); - iAddressInformation.IPConfigType = IPConfigType.None; - Assert.AreEqual((int)(IPConfigType.None), (int)(iAddressInformation.IPConfigType), "IpConfigType property should be return None after setting"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test PrefixLength property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.PrefixLength A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task PrefixLength_PROPERTY() - { - Log.Info(Globals.LogTag, "PrefixLength_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - /*TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - int prefix = 24; - iAddressInformation.PrefixLength = prefix; - Assert.AreEqual(prefix, iAddressInformation.PrefixLength, "Set PrefixLength is fail"); -} - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test DnsConfigType property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DnsConfigType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task DnsConfigType_PROPERTY() - { - Log.Info(Globals.LogTag, "DnsConfigType_SET_GET start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - /*TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - DnsConfigType type = DnsConfigType.Static; - iAddressInformation.DnsConfigType = type; - Assert.AreEqual(type, iAddressInformation.DnsConfigType, "Set DnsConfigType is fail"); -} - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test DhcpServerAddress property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DhcpServerAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task DhcpServerAddress_PROPERTY() - { - Log.Info(Globals.LogTag, "DhcpServerAddress_PROPERTY start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - * */ - await setUp(); - /*TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - var dhcp = iAddressInformation.DhcpServerAddress; - Assert.IsInstanceOf(dhcp, "Invalid property value"); - Assert.NotNull(dhcp, "DhcpServerAddress should not be NULL"); -} - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test DhcpLeaseDuration property of IAddressInformation")] - [Property("SPEC", "Tizen.Network.Connection.IAddressInformation.DhcpLeaseDuration A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] - public async Task DhcpLeaseDuration_PROPERTY() - { - Log.Info(Globals.LogTag, "DhcpLeaseDuration_PROPERTY start"); - ConnectionProfile _connectionProfile = null; - try - { - /** PRECONDITION - * turn on a Public WiFi - **/ - await setUp(); - - /* TEST CODE */ - _connectionProfile = ConnectionProfileManager.GetCurrentProfile(); - Assert.IsNotNull(_connectionProfile); - var iAddressInformation = _connectionProfile.IPv4Settings; - Assert.IsNotNull(iAddressInformation, "IAddressInformation is NULL"); - - var duration = iAddressInformation.DhcpLeaseDuration; - Assert.IsTrue(duration >= 0, "Invalid dhcp lease duration"); - } - 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSProfileStateEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSProfileStateEventArgs.cs deleted file mode 100755 index b3af315ad..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSProfileStateEventArgs.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.ProfileStateEventArgs Test")] - public class ProfileStateEventArgsTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - private void EventHandlerProfileStateChangedCB(object sender, ProfileStateEventArgs e) - { - if (e.State == ProfileState.Disconnected) - _flag = true; - } - - [Test] - [Category("P1")] - [Description("Test State property of ProfileStateEventArgs")] - [Property("SPEC", "Tizen.Network.Connection.ProfileStateEventArgs.State A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task State_PROPERTY() - { - ConnectionProfile _connectionProfile = null; - try - { - /* - * PRECONDITION - * Activate WiFi then connect to an AP. - */ - await setUp(); - Assert.IsFalse(_flag, "Flag should be fail before check"); - - var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Connected); - foreach (var item in list) - { - if (item.Name == networkParameter.wnPRIVATE) - { - _connectionProfile = item; - break; - } - item.Dispose(); - } - - /* - * TEST CODE - */ - Assert.IsNotNull(_connectionProfile, "No Profile Found"); - _connectionProfile.ProfileStateChanged += EventHandlerProfileStateChangedCB; - await Task.Delay(1500); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - Assert.IsTrue(_flag, "Flag should be true before check"); - - /** - * POSTCONDITION - * */ - _connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChangedCB; - // 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 (_connectionProfile != null) - { - _connectionProfile.Dispose(); - } - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSRssiLevelChangedEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSRssiLevelChangedEventArgs.cs deleted file mode 100755 index 98fe4f833..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSRssiLevelChangedEventArgs.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.RssiLevelChangedEventArgs test")] - public class RssiLevelChangedEventArgsTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditional for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - private void EventHandlerRssiLevelChangedCB(object sender, RssiLevelChangedEventArgs e) - { - Log.Info(Globals.LogTag, "RSSI Level " + e.Level); - if (e.Level >= WiFiRssiLevel.Level0) - { - _flag = true; - } - } - - [Test] - [Category("P1")] - [Description("Test Level property of RssiLevelChangedEventArgs")] - [Property("SPEC", "Tizen.Network.WiFi.RssiLevelChangedEventArgs.Level A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Level_PROPERTY() - { - try - { - /* - * TEST CODE - */ - WiFiManager.RssiLevelChanged += EventHandlerRssiLevelChangedCB; - await Task.Delay(1500); - await networkSetup.ForgetCurrentAP(); - await Task.Delay(1500); - await setUp(); - Assert.IsTrue(_flag, "Flag should be true after checking"); - - WiFiManager.RssiLevelChanged -= EventHandlerRssiLevelChangedCB; - } - 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()); - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSScanStateChangedEventArgs.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSScanStateChangedEventArgs.cs deleted file mode 100755 index 153d8415d..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSScanStateChangedEventArgs.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.ScanStateChangedEventArgs test")] - public class ScanStateChangedEventArgsTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _flag = false; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditional for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - private void EventHandlerScanStateChangedCB(object sender, ScanStateChangedEventArgs State) - { - if (!_flag && (State.State == WiFiScanState.Scanning)) - { - _flag = true; - } - } - - [Test] - [Category("P1")] - [Description("Test State property of ScanStateChangedEventArgs")] - [Property("SPEC", "Tizen.Network.WiFi.ScanStateChangedEventArgs.State A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] - public async Task State_PROPERTY() - { - try - { - /* - * TEST CODE - */ - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - } - WiFiManager.ScanStateChanged += EventHandlerScanStateChangedCB; - await Task.Delay(1500); - await WiFiManager.ScanAsync(); - WiFiManager.ScanStateChanged -= EventHandlerScanStateChangedCB; - - Assert.IsTrue(_flag, "Flag should be true after checking"); - } - 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()); - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs deleted file mode 100755 index 59e33f3db..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiAP.cs +++ /dev/null @@ -1,738 +0,0 @@ -using System; -using NUnit.Framework; -using Tizen.Network.Connection; -using System.Net; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - /************************************************************************/ - // ** Scenario - Create/get/dispose an AP. - // ** - // ** create a public AP - // ** create a hidden AP - // ** connect to that AP - // ** get network information from that AP - // ** refesh AP - // ** - /************************************************************************/ - - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiAP Tests")] - public class WiFiAPTests - { - private string _essid = "WiFi_AP1"; - private string _essid_UTF8 = "안녕하세요"; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - [Test] - [Category("P1")] - [Description("Create a WiFi AP")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Ngo Van Hai, hai.nv3@samsung.com")] - [Property("COVPARAM", "string")] - public void WiFiAP_INIT() - { - WiFiAP _wifiAP = null; - try - { - _wifiAP = new WiFiAP(_essid); - Assert.AreEqual(_essid, _wifiAP.NetworkInformation.Essid, "WiFiAp init do not successfully, NetworkInformation.Essid should be not null"); - } - 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("P1")] - [Description("Create a WiFi AP")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - [Property("COVPARAM", "string")] - public void WiFiAP_INIT_UTF_8_NAME() - { - WiFiAP _wifiAP = null; - try - { - _wifiAP = new WiFiAP(_essid_UTF8); - Assert.AreEqual(_essid_UTF8, _wifiAP.NetworkInformation.Essid, "WiFiAp init do not successfully, NetworkInformation.Essid should be not null"); - } - 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("P1")] - [Description("Create a WiFi AP")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - [Property("COVPARAM", "string, bool")] - public void WiFiAP_INIT_HIDDEN() - { - WiFiAP _wifiAP = null; - try - { - _wifiAP = new WiFiAP("WiFi_hidden", true); - Assert.IsNotNull(_wifiAP, "created object should be not null"); - } - 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("P1")] - [Description("Info of WiFi access point must to be refreshed after call REFRESH method")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.Refresh M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - [Property("MODIFIER", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task Refresh_REFRESH() - { - Log.Info(Globals.LogTag, "Start Refresh_REFRESH"); - WiFiAP _wifiAP = null; - try - { - /* Precondition - * Setup WiFi type public - * */ - await setUp(); - - /** - * TEST CODE - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - Log.Info(Globals.LogTag, "Connected AP: " + _wifiAP.NetworkInformation.Essid); - - var typeSecurity = _wifiAP.SecurityInformation.SecurityType; - _wifiAP.SecurityInformation.SecurityType = WiFiSecurityType.Wpa2Psk; - - _wifiAP.Refresh(); - } - 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("P1")] - [Description("Check a connection to a WiFi")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ConnectAsync_CONNECT_TO_AN_AP() - { - WiFiAP _wifiAP = null; - WiFiAP _wifiAP2 = null; - try - { - if (!WiFiManager.IsActive) - await WiFiManager.ActivateAsync(); - await networkSetup.ForgetCurrentAP(); - - await WiFiManager.ScanAsync(); - var list = WiFiManager.GetFoundAPs(); - Log.Info(Globals.LogTag, "Got found aps"); - foreach (var ap in list) - { - if (ap.NetworkInformation.Essid == networkParameter.wnPRIVATE) - { - _wifiAP = ap; - break; - } - } - Assert.IsNotNull(_wifiAP, "Can't create a WiFi ap"); - Log.Info(Globals.LogTag, "Try to Connect to " + _wifiAP.NetworkInformation.Essid.ToString()); - _wifiAP.SecurityInformation.SetPassphrase(networkParameter.wPASS); - await _wifiAP.ConnectAsync(); - _wifiAP2 = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP2, "No WiFi connection"); - Assert.AreEqual(_wifiAP.NetworkInformation.Essid.ToString(), _wifiAP2.NetworkInformation.Essid.ToString(), "Can't connect to a WiFi"); - - 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(); - } - if (_wifiAP2 != null) - { - _wifiAP2.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test: Disconnect to a WiFi, PASS if disconnect success otherwise Fail ")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.DisconnectAsync M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task DisconnectAsync_DISCONNECT_FROM_AP() - { - WiFiAP _wifiAP = null; - try - { - /** - * PRE CONDITION - * */ - await setUp(); - /** TEST CODE **/ - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not connected"); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "Failed to connect WiFi"); - await _wifiAP.DisconnectAsync(); - await Task.Delay(1500); - Assert.AreEqual(WiFiConnectionState.Disconnected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not disconnected"); - Log.Info(Globals.LogTag, "Successfully done"); - /** - * POST CONDITION - * */ - await _wifiAP.ConnectAsync(); - } - 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("P1")] - [Description("Test NetworkInformation property of WiFiAp")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.NetworkInformation A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void NetworkInformation_PROPERTY() - { - WiFiAP _wifiAP = null; - try - { - var proxyAddress = "192.168.1.105"; - _wifiAP = new WiFiAP(_essid); - _wifiAP.NetworkInformation.ProxyType = WiFiProxyType.Manual; - _wifiAP.NetworkInformation.ProxyAddress = proxyAddress; - Assert.AreEqual((int)(WiFiProxyType.Manual), (int)(_wifiAP.NetworkInformation.ProxyType), "NetworkInformation.ProxyType doens't set and get successful"); - Assert.AreEqual(proxyAddress, _wifiAP.NetworkInformation.ProxyAddress, "NetworkInformation.ProxyAddress doens't set and get successful"); - } - 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("P1")] - [Description("Test SecurityInformation property of WiFiAp")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.SecurityInformation A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void SecurityInformation_PROPERTY() - { - WiFiAP _wifiAP = null; - try - { - _wifiAP = new WiFiAP(_essid); - _wifiAP.SecurityInformation.EncryptionType = WiFiEncryptionType.Aes; - _wifiAP.SecurityInformation.SecurityType = WiFiSecurityType.Eap; - Assert.AreEqual((int)(WiFiEncryptionType.Aes), (int)(_wifiAP.SecurityInformation.EncryptionType), "SecurityInformation.EncryptionType doens't set and get successful"); - Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wifiAP.SecurityInformation.SecurityType), "SecurityInformation.SecurityType doens't set and get successful"); - } - 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("P1")] - [Description("Remove AP. Check some information and state of this access point.")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ForgetAP M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ForgetAP_FORGET_AP() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wifiAP.ForgetAP(); - await Task.Delay(1500); - Assert.AreEqual((int)(WiFiConnectionState.Disconnected), (int)(WiFiManager.ConnectionState), "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("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 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(); - await Task.Delay(1500); - 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 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(); - 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 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 networkSetup.DeactivateWiFi(); - await _wifiAP.ForgetAPAsync(); - Assert.IsTrue(false, "InvalidOperationException should be thrown"); - - 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 (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", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task Update_UPDATE() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - Log.Info(Globals.LogTag, "Update_UPDATE start"); - await setUp(); - /* TEST CODE */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var ipv4Setting = _wiFiNetwork.IPv4Setting; - Assert.IsNotNull(ipv4Setting, "Ipv4Setting should be return not null"); - - var oldIP = ipv4Setting.IP.ToString(); - var ip = "192.168.192.23"; - - ipv4Setting.IPConfigType = IPConfigType.Static; - ipv4Setting.IP = IPAddress.Parse(ip); - - _wifiAP.Update(); - await Task.Delay(3000); - Assert.AreEqual(ip.ToString(), ipv4Setting.IP.ToString(), "Ip of Ipv4Setting get should be same set"); - Log.Info(Globals.LogTag, "Successfully done"); - - /* - * POSTCONDITION - */ - await networkSetup.ForgetCurrentAP(); - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Cancel the request to connect by WPS")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task CancelWps_CANCELWPS() - { - Log.Info(Globals.LogTag, "CancelWps_CANCELWPS"); - - try - { - WpsInfo info = new WpsPbcInfo(); - var task = WiFiAP.ConnectWpsWithoutSsidAsync(info); - await Task.Delay(5000); - WiFiAP.CancelWps(); - await Task.Delay(5000); - - Assert.IsTrue(task.IsCanceled, "ConnectWpsWithoutSsidAsync() isn't cancelled"); - - // 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()); - } - } - - [Test] - [Category("P2")] - [Description("Cancel WPS without the request to connect by WPS")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task CancelWps_INVALID_OPERATION_EXCEPTION() - { - Log.Info(Globals.LogTag, "CancelWps_CANCELWPS"); - - try - { - WiFiAP.CancelWps(); - Assert.IsTrue(false, "InvalidOperationException must be thrown"); - - // Postcondition - await setUp(); - } - catch (InvalidOperationException ex) - { - Assert.IsTrue(true, "Exception occurs. Msg: " + ex.ToString()); - } - 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()); - } - } - - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiConfiguration.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiConfiguration.cs deleted file mode 100755 index cb8d5dff9..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiConfiguration.cs +++ /dev/null @@ -1,609 +0,0 @@ -using System; -using NUnit.Framework; -using Tizen.Network.Connection; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Tizen.Network.WiFi.WiFiConfiguration Test class for managing the configuration of WiFi")] - public class WiFiConfigurationTests - { - private string _wants; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _wants = null; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - _wants = networkParameter.wnPRIVATE; - } - - [Test] - [Category("P1")] - [Description("Test WiFiConfiguration method initialization")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WiFiConfiguration_INITIALIZE_SECURE_NONE() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /** - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - * */ - await setUp(); - - /** - * Test contructor - * Test 2 properties: Name + SecurityType - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); - Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); - Assert.AreEqual((int)(WiFiSecurityType.None), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test WiFiConfiguration method initialization")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WiFiConfiguration_INITIALIZE_SECURE_WEP() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test contructor - * Test 2 properties: Name + SecurityType - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Wep); - Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); - Assert.AreEqual((int)(WiFiSecurityType.Wep), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test WiFiConfiguration method initialization")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WiFiConfiguration_INITIALIZE_SECURE_WPAPSK() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test contructor - * Test 2 properties: Name + SecurityType - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.WpaPsk); - Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); - Assert.AreEqual((int)(WiFiSecurityType.WpaPsk), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test WiFiConfiguration method initialization")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WiFiConfiguration_INITIALIZE_SECURE_WPA2PSK() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test contructor - * Test 2 properties: Name + SecurityType - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Wpa2Psk); - Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); - Assert.AreEqual((int)(WiFiSecurityType.Wpa2Psk), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test WiFiConfiguration method initialization")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WiFiConfiguration_INITIALIZE_SECURE_EAP() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test contructor - * Test 2 properties: Name + SecurityType - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); - Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); - Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property Name of WiFiConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.Name A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Name_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test property IsHidden - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); - Assert.AreEqual(_wants, _wiFiConfig.Name, "Name doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property SecurityType of WiFiConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.SecurityType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SecurityType_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test property IsHidden - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); - Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "SecurityType doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property IsHidden of WiFiConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.IsHidden A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IsHidden_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test property IsHidden - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); - Assert.False(_wiFiConfig.IsHidden, "IsHidden return true when doesn't hidden"); - _wiFiConfig.IsHidden = true; - Assert.True(_wiFiConfig.IsHidden, "IsHidden return false when does hidden"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property ProxyAddress of WiFiConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.ProxyAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ProxyAddress_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test property ProxyAddress - * */ - var proxyAddress = "192.168.1.105"; - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); - _wiFiConfig.ProxyAddress = proxyAddress; - Assert.AreEqual(proxyAddress, _wiFiConfig.ProxyAddress, "ProxyAddress doesn't set and get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property EapConfiguration of WiFiConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.EapConfiguration A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task EapConfiguration_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiConfiguration _wiFiConfig = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to an AP. - * 2. Get connected AP. - */ - await setUp(); - - /** - * Test property EapConfiguration - * */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); - _wiFiConfig.EapConfiguration.EapType = WiFiEapType.Peap; - Assert.AreEqual((int)(WiFiEapType.Peap), (int)(_wiFiConfig.EapConfiguration.EapType), "EapConfiguration doesn't set and get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEap.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEap.cs deleted file mode 100755 index 1a5439f7f..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEap.cs +++ /dev/null @@ -1,492 +0,0 @@ -using System; -using NUnit.Framework; -using Tizen.Network.Connection; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - /************************************************************************/ - // ** Scenario - get SECURITY info of an EAP. - // ** - // ** set/get certificate of EAP (a type of enterprise secure for an access point) - // ** set/get other secure info - // ** - // ** Step: - // ** connect to an EAP hotspot AP - // ** get secure networkInformation from that AP - // ** set/get and validate eapinformation - /************************************************************************/ - - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiEap Test class for managing the EAP information of access point(AP)")] - public class WiFiEapTests - { - private WiFiAP _wiFiAp = null; - private WiFiSecurity _wiFiSecurity = null; - private WiFiEap _wiFiEap = null; - private string _clientCertFile; - private string _userName; - private string _privateKeyFile; - private string _passWrd; - private string _wants; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - //Console.WriteLine("HYUKIN Postconditions for each TEST"); - //LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); - if (_wiFiAp != null) - { - _wiFiAp = null; - } - if (_wiFiSecurity != null) - { - _wiFiSecurity = null; - } - if (_wiFiEap != null) - { - _wiFiEap = null; - } - } - - public void setUp() - { - //Console.WriteLine("HYUKIN Preconditions for each TEST"); - //LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); - _wants = networkParameter.wnEAP; - _wiFiAp = new WiFiAP(_wants); - _wiFiSecurity = _wiFiAp.SecurityInformation; - _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; - _wiFiEap = _wiFiSecurity.EapInformation; - _clientCertFile = "/path/certFile"; - _userName = "WiFiEap"; - _passWrd = "abc12345"; - _privateKeyFile = "/path/key"; - } - - [Test] - [Category("P1")] - [Description("Test SetClientCertFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetClientCertFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void SetClientCertFile_SET_VALUE() - { - try - { - setUp(); - var clientCertFileDefault = _wiFiEap.GetClientCertFile(); - _wiFiEap.SetClientCertFile(_clientCertFile); - Assert.AreNotEqual(clientCertFileDefault, _wiFiEap.GetClientCertFile(), "ClientCertFile doesn't set successful"); - } - 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("P1")] - [Description("Test GetClientCertFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetClientCertFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void GetClientCertFile_GET_VALUE() - { - try - { - setUp(); - _wiFiEap.SetClientCertFile(_clientCertFile); - Assert.AreEqual(_clientCertFile, _wiFiEap.GetClientCertFile(), "ClientCertFile doesn't get properly"); - } - 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("P1")] - [Description("Test SetUserName")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetUserName M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void SetUserName_SET_VALUE() - { - try - { - setUp(); - var userNameDefault = _wiFiEap.GetUserName(); - _wiFiEap.SetUserName(_userName); - _wiFiEap.SetPassword(_passWrd); - Assert.AreNotEqual(userNameDefault, _wiFiEap.GetUserName(), "Username doesn't set successful"); - Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Password is not set properly"); - } - 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("P1")] - [Description("Test SetPassword")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetPassword M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void SetPassword_SET_VALUE() - { - try - { - setUp(); - _wiFiEap.SetUserName(_userName); - _wiFiEap.SetPassword(_passWrd); - Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Password is not set properly"); - } - 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("P1")] - [Description("Test GetUserName")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetUserName M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void GetUserName_GET_VALUE() - { - try - { - setUp(); - _wiFiEap.SetUserName(_userName); - _wiFiEap.SetPassword(_passWrd); - Assert.AreEqual(_userName, _wiFiEap.GetUserName(), "EapUserName doesn't get properly"); - } - 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("P1")] - [Description("Test SetPrivateKeyFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetPrivateKeyFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void SetPrivateKeyFile_SET_VALUE() - { - try - { - setUp(); - var privateKeyDefault = _wiFiEap.GetPrivateKeyFile(); - _wiFiEap.SetPrivateKeyFile(_privateKeyFile, _passWrd); - Assert.AreNotEqual(privateKeyDefault, _wiFiEap.GetPrivateKeyFile(), "PrivateKeyInfo doesn't set succesful"); - } - 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("P1")] - [Description("Test GetPrivateKeyFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetPrivateKeyFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void GetPrivateKeyFile_GET_VALUE() - { - try - { - setUp(); - _wiFiEap.SetPrivateKeyFile(_privateKeyFile, _passWrd); - Assert.AreEqual(_privateKeyFile, _wiFiEap.GetPrivateKeyFile(), "PrivateKeyInfo doesn't get properly"); - } - 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("P1")] - [Description("Test IsPasswordSet")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.IsPasswordSet M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MCST")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void IsPasswordSet_RETURN() - { - try - { - setUp(); - var user = "asavin"; - var passwordPhrase = ""; - _wiFiEap.SetUserName(user); - _wiFiEap.SetPassword(passwordPhrase); - Assert.IsFalse(_wiFiEap.IsPasswordSet(), "Return true when don't set password"); - passwordPhrase = "a1b2c3d4e5"; - _wiFiEap.SetUserName(user); - _wiFiEap.SetPassword(passwordPhrase); - Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Return false when set password"); - } - 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("P1")] - [Description("Test EapType property of WiFiEap")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.EapType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void EapType_PROPERTY() - { - try - { - setUp(); - _wiFiEap.EapType = WiFiEapType.Aka; - Assert.AreEqual((int)(WiFiEapType.Aka), (int)(_wiFiEap.EapType), "EapType doesn't set and get successful"); - } - 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("P1")] - [Description("Test AuthenticationType property of WiFiEap")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.AuthenticationType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void AuthenticationType_PROPERTY() - { - try - { - setUp(); - _wiFiEap.AuthenticationType = WiFiAuthenticationType.Pap; - Assert.AreEqual((int)(WiFiAuthenticationType.Pap), (int)(_wiFiEap.AuthenticationType), "AuthenticationType doesn't set and get successful"); - } - 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("P1")] - [Description("Test CaCertificationFile property of WiFiEap")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.CaCertificationFile A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public void CaCertificationFile_PROPERTY() - { - try - { - setUp(); - var caCertification = "certification"; - _wiFiEap.CaCertificationFile = caCertification; - Assert.AreEqual(caCertification, _wiFiEap.CaCertificationFile, "CaCertificationFile doesn't set and get successful"); - } - 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(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEapConfiguration.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEapConfiguration.cs deleted file mode 100755 index 62fea2460..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiEapConfiguration.cs +++ /dev/null @@ -1,451 +0,0 @@ -using System; -using NUnit.Framework; -using Tizen.Network.Connection; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - /* ***********************************************************************/ - // ** Scenario - get SECURITY info of an EAP. - // ** - // ** set/get certificate of EAP (a type of enterprise secure for an access point) - // ** - /* ***********************************************************************/ - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiEapConfiguration Test class for managing the EAP configuration")] - class WiFiEapConfigurationTests - { - - private WiFiConfiguration _wiFiConfig = null; - private WiFiAP _wifiAP = null; - private WiFiEapConfiguration _wiFiEapConfig = null; - private string _privateKey; - private string _clientCert; - private string _wants; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - _wants = networkParameter.wnPRIVATE; - _privateKey = "privatekey"; - _clientCert = "clientcert"; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - _wifiAP = null; - _wiFiConfig = null; - _wiFiEapConfig = null; - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(_wants, networkParameter.wType.wPrivate, networkParameter.wPASS); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); - Assert.AreEqual(_wants, _wiFiConfig.Name, "Initialize WiFiConfiguration not successfully, Name of WiFiConfiguration is not true"); - Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "Initialize WiFiConfiguration not successfully, WiFiSecureType of WiFiConfiguration is not true"); - } - - [Test] - [Category("P1")] - [Description("Test SetClientCertFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.SetClientCertFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SetClientCertFile_SET_VALUE() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test code - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - var clientCertDefault = _wiFiEapConfig.GetClientCertFile(); - _wiFiEapConfig.SetClientCertFile(_privateKey, _clientCert); - Assert.AreNotEqual(clientCertDefault, _wiFiEapConfig.GetClientCertFile(), "ClientCertFile doesn't set successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test GetClientCertFile")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.GetClientCertFile M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task GetClientCertFile_GET_VALUE() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test code - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - _wiFiEapConfig.SetClientCertFile(_privateKey, _clientCert); - Assert.AreEqual(_clientCert, _wiFiEapConfig.GetClientCertFile(), "ClientCertFile doesn't get properly"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property AnonymousIdentify of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.AnonymousIdentify A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task AnonymousIdentify_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test property AnonymousIdentify - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - var anonymousIdentify = "anonymous"; - _wiFiEapConfig.AnonymousIdentify = anonymousIdentify; - Assert.AreEqual(_wiFiEapConfig.AnonymousIdentify, anonymousIdentify, "AnonymousIdentify doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property AuthenticationType of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.AuthenticationType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task AuthenticationType_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test properties - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - _wiFiEapConfig.AuthenticationType = WiFiAuthenticationType.Gtc; - Assert.AreEqual((int)(_wiFiEapConfig.AuthenticationType), (int)(WiFiAuthenticationType.Gtc), "AuthenticationType doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property CaCertificationFile of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.CaCertificationFile A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task CaCertificationFile_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test properties - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - var caCertificationFile = "cacertification"; - _wiFiEapConfig.CaCertificationFile = caCertificationFile; - Assert.AreEqual(_wiFiEapConfig.CaCertificationFile, caCertificationFile, "CaCertificationFile doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property EapType of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.EapType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task EapType_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test properties - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - _wiFiEapConfig.EapType = WiFiEapType.Peap; - Assert.AreEqual((int)(_wiFiEapConfig.EapType), (int)(WiFiEapType.Peap), "EapType doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property Identity of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.Identity A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Identity_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test properties - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - var identity = "identity"; - _wiFiEapConfig.Identity = identity; - Assert.AreEqual(_wiFiEapConfig.Identity, identity, "Identity doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test property SubjectMatch of WiFiEapConfiguration")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.SubjectMatch A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SubjectMatch_PROPERTY() - { - try - { - /** Precondition - * Settup WiFi type WiFiEap - * */ - await setUp(); - - /** - * Test properties - * */ - _wiFiEapConfig = _wiFiConfig.EapConfiguration; - var subjectMatch = "subjectmatch"; - _wiFiEapConfig.SubjectMatch = subjectMatch; - Assert.AreEqual(_wiFiEapConfig.SubjectMatch, subjectMatch, "SubjectMatch doesn't set and get successfully"); - } - 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(); - } - if (_wiFiConfig != null) - { - _wiFiConfig.Dispose(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiManager.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiManager.cs deleted file mode 100755 index 15c272ef6..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiManager.cs +++ /dev/null @@ -1,1059 +0,0 @@ -using System; -using NUnit.Framework; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; -using System.Threading; - -namespace Tizen.Network.WiFi.Tests -{ - /************************************************************************/ - // ** Class WiFiManagertest1 - // ** Scenario - Manage/Scan/Connect/Disconnect all available APs. - // ** - // ** connect to an AP before run this class: example: "WiFi_public" - // ** setUp 2 APs: name/securetype as - // ** "WiFi_hidden"/Wpa2Psk/isHidden true - // ** - // ** Test: - // ** get found APs ; scan/get specific AP; get WiFiConfig; save WiFiConfig (hidden)/get WiFiConfig - // ** deActivate; disconnect; removeAp - // ** - // ** Note: related to async method, if some TC fail --> please increase waiting time: using Thread.Sleep(time) - // ** - /************************************************************************/ - [TestFixture] - [Description("Tizen.Network.WiFiManager Tests")] - public class WiFiManagerTests - { - private bool _flag; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - _flag = false; - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - await Task.Delay(1500); - } - - public async Task tearDown() - { - await networkSetup.DeactivateWiFi(); - await Task.Delay(1500); - } - - public void EventHandlerRssi(object sender, RssiLevelChangedEventArgs Rssi) - { - var wiFiRssiLevel = WiFiRssiLevel.Level0; - if (Rssi.Level != wiFiRssiLevel) - _flag = true; - wiFiRssiLevel = Rssi.Level; - } - - public void EventHandlerDevice(object sender, DeviceStateChangedEventArgs Event) - { - if (Event.State == WiFiDeviceState.Activated) - _flag = true; - } - - [Test] - [Category("P1")] - [Description("A task indicates whether the Activate WiFi")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ActivateAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ActivateAsync_OPEN_WiFi() - { - try - { - /** - * PRE CONDITION - * turn off WiFi - * */ - if (WiFiManager.IsActive) - await tearDown(); - - /** TEST CODE */ - await WiFiManager.ActivateAsync(); - Assert.IsTrue(WiFiManager.IsActive, "WiFi is off"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("check indicates whether the ActivateWithPickerAsync method is done or not")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ActivateWithPickerAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task ActivateWithPickerAsync_OPEN() - { - try - { - /** - * PRE CONDITION - * turn off WiFi - * */ - if (WiFiManager.IsActive) - await tearDown(); - - /** TEST CODE */ - await WiFiManager.ActivateWithPickerAsync(); - Assert.IsTrue(WiFiManager.IsActive, "WiFi is off"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: deactive a WiFi ")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.DeactivateAsync M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task DeactivateAsync_DEACTIVE_WIFI() - { - try - { - /** - * PRE CONDITION - * */ - await setUp(); - - /** TEST CODE **/ - Assert.IsTrue(WiFiManager.IsActive, "WiFi doesn't turn on"); - WiFiAP ap = WiFiManager.GetConnectedAP(); - await networkSetup.ForgetCurrentAP(); - await WiFiManager.DeactivateAsync(); - Assert.IsFalse(WiFiManager.IsActive, "WiFi doesn't turn off"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets the handle of the connected access point.")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetConnectedAP M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetConnectedAP_GET_CURRENT_AP() - { - try - { - /** - * PRE CONDITION - * */ - await setUp(); - - /** TEST CODE **/ - var connection = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(connection, "No WiFi connection"); - Assert.AreEqual(networkParameter.wnPRIVATE, connection.NetworkInformation.Essid.ToString(), "GetConnectedAp is fail"); - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), connection.NetworkInformation.ConnectionState.ToString(), "GetConnectedAp is fail"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets the result of the scan asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundAPs M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetFoundAPs_SCAN_AND_GET_ALL_AP() - { - try - { - /** - * PRE CONDITION - * turn off WiFi - * */ - if (!WiFiManager.IsActive) - await WiFiManager.ActivateAsync(); - - /** TEST CODE **/ - var count = 0; - await WiFiManager.ScanAsync(); - var listApp = WiFiManager.GetFoundAPs(); - foreach (var item in listApp) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "GetFoundAps is fail"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets the result of the scan asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundSpecificAPs M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetFoundSpecificAPs_GET_A_CERTAIN_AP() - { - try - { - /** TEST CODE **/ - var count = 0; - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - } - await WiFiManager.ScanSpecificAPAsync(networkParameter.wnPRIVATE); - var listApp = WiFiManager.GetFoundSpecificAPs(); - await Task.Delay(1500); - foreach (var item in listApp) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "GetFoundSpecificAps is fail"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets the result of the scan asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetWiFiConfigurations M ")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task GetWiFiConfigurations_GETlist_OF_WIFI_CONFIG() - { - try - { - /** - * PRE CONDITION - * */ - await setUp(); - - /** TEST CODE **/ - var count = 0; - var listConfig = WiFiManager.GetWiFiConfigurations(); - foreach (var item in listConfig) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "GetWiFiConfigurations is fail"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P3")] - [Description("Saves Wi-Fi configuration of access point . Then gets the list of WiFi configuration. Check access point be saved")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.SaveWiFiConfiguration M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SaveWiFiConfiguration_SAVE_GET() - { - WiFiConfiguration _wiFiConfiguration = null; - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiConfiguration = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, _wifiAP.SecurityInformation.SecurityType); - var proxyAddress = _wiFiConfiguration.ProxyAddress; - _wiFiConfiguration.ProxyAddress = "192.168.1.105"; - _wiFiConfiguration.IsHidden = true; - Assert.AreNotEqual(proxyAddress, _wiFiConfiguration.ProxyAddress, "Proxyaddress fail"); - WiFiManager.SaveWiFiConfiguration(_wiFiConfiguration); - var list = WiFiManager.GetWiFiConfigurations(); - WiFiConfiguration _WiFiConfiguration = null; - foreach (var _itemWiFiAp in list) - { - if (_itemWiFiAp.Name.Contains(networkParameter.wnPRIVATE)) - { - _WiFiConfiguration = _itemWiFiAp; - break; - } - _itemWiFiAp.Dispose(); - } - Assert.IsNotNull(_WiFiConfiguration, "No WiFi Configuration"); - Assert.AreEqual(_wiFiConfiguration.ProxyAddress, _WiFiConfiguration.ProxyAddress, "GetWiFiConfigurations is fail"); - Assert.True(_WiFiConfiguration.IsHidden, "GetWiFiConfigurations is fail"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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 (_wiFiConfiguration != null) - { - _wiFiConfiguration.Dispose(); - } - if (_wifiAP != null) - { - _wifiAP.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("DeviceStateChanged is raised when the device state is changed")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.DeviceStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task DeviceStateChanged_CHECK_CB() - { - try - { - WiFiManager.DeviceStateChanged += EventHandlerDevice; - await Task.Delay(1500); - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - await Task.Delay(1500); - await tearDown(); - await Task.Delay(1500); - Assert.True(_flag, "Event DeviceStateChanged hasn't been call."); - } - else - { - await networkSetup.ForgetCurrentAP(); - await WiFiManager.DeactivateAsync(); - await Task.Delay(1500); - await WiFiManager.ActivateAsync(); - await Task.Delay(1500); - Assert.True(_flag, "Event DeviceStateChanged hasn't been call."); - } - WiFiManager.DeviceStateChanged -= EventHandlerDevice; - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("RssiLevelChanged is rasied when the RSSI of connected Wi-Fi is changed")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.RssiLevelChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task RssiLevelChanged_CHECK_CB() - { - try - { - /* - * TEST CODE - */ - WiFiManager.RssiLevelChanged += EventHandlerRssi; - await Task.Delay(1500); - if (WiFiManager.IsActive) - { - Log.Info(Globals.LogTag, "WiFi is activated"); - await networkSetup.ForgetCurrentAP(); - } - await setUp(); - Assert.True(_flag, "Event RssiLevelChanged hasn't been call."); - WiFiManager.RssiLevelChanged -= EventHandlerRssi; - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test ConnectionState property")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ConnectionState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ConnectionState_PROPERTY() - { - try - { - /* - * PRECONDITION - */ - await setUp(); - - /** TEST CODE */ - Assert.AreEqual((int)(WiFiConnectionState.Connected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return connected after connect to WiFiAp"); - await networkSetup.ForgetCurrentAP(); - Assert.AreEqual((int)(WiFiConnectionState.Disconnected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return disconnected after discnnect"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test IsActivated property")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.IsActive A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IsActive_PROPERTY() - { - try - { - /** TEST CODE */ - await setUp(); - Assert.True(WiFiManager.IsActive, "IsActivated return false after connected"); - await tearDown(); - Assert.False(WiFiManager.IsActive, "IsActivated return true after disconnected"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test InterfaceName property")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.InterfaceName A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task InterfaceName_PROPERTY() - { - try - { - /* - * PRECONDITION - */ - await setUp(); - Assert.IsInstanceOf(WiFiManager.InterfaceName); - Assert.IsNotNull(WiFiManager.InterfaceName, "After connect to an AP. InterfaceName should be not null."); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test MacAddress property")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.MacAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task MacAddress_PROPERTY() - { - try - { - /* - * PRECONDITION - */ - await setUp(); - - /** TEST CODE */ - Assert.IsInstanceOf(WiFiManager.MacAddress); - Assert.IsNotNull(WiFiManager.MacAddress, "After connect to an AP. MacAddress should be not null."); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("starts scan asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ScanAsync_SCAN() - { - try - { - /* - * PRECONDITION - */ - await setUp(); - - /* - * TEST CODE - */ - var count = 0; - await WiFiManager.ScanAsync(); - var listAp = WiFiManager.GetFoundAPs(); - foreach (var item in listAp) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "ScanAsync can't scan WiFiAp"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("starts specific ap scan, asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanSpecificAPAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ScanSpecificAPAsync_SCAN() - { - try - { - /* - * PRECONDITION - */ - await setUp(); - - /* - * TEST CODE - */ - var count = 0; - await WiFiManager.ScanSpecificAPAsync(networkParameter.wnPRIVATE1); - var listAp = WiFiManager.GetFoundSpecificAPs(); - foreach (var item in listAp) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "ScanSpecificApAsync can't scan WiFi private"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("starts specific ap scan, asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanSpecificAPAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] - public async Task ScanSpecificAPAsync_SCAN_HIDDEN_AP() - { - try - { - /* - * PRECONDITION - * Activate WiFi then connect to an AP. - */ - await setUp(); - - /* - * TEST CODE - * Scan all HIDDEN APs which have name containing a given certain phrase. - */ - var count = 0; - await WiFiManager.ScanSpecificAPAsync(networkParameter.wnHIDDEN); - var listAp = WiFiManager.GetFoundSpecificAPs(); - foreach (var item in listAp) - { - count++; - item.Dispose(); - } - Assert.Greater(count, 0, "ScanSpecificApAsync can't scan WiFi HIDDEN"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test ConnectionStateChanged event of WiFiManager")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ConnectionStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ConnectionStateChanged_CHECK_CB() - { - try - { - /* - * PRECONDITION - */ - if (WiFiManager.IsActive) - await networkSetup.ForgetCurrentAP(); - Assert.IsFalse(_flag, "Flag should be fail before checking"); - - /* - * TEST CODE - */ - EventHandler connectionStateChanged = (s, e) => - { - _flag = true; - }; - WiFiManager.ConnectionStateChanged += connectionStateChanged; - await Task.Delay(1500); - await setUp(); - await Task.Delay(1500); - Assert.IsTrue(_flag, "Flag should be true after checking"); - - WiFiManager.ConnectionStateChanged -= connectionStateChanged; - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test BackgroundScanFinished event of WiFiManager")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.BackgroundScanFinished E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] - public async Task BackgroundScanFinished_CHECK_CB_EVENT() - { - try - { - CancellationTokenSource tSource = new CancellationTokenSource(); - EventHandler backgroundScanFinished = (s, e) => - { - _flag = true; - tSource.Cancel(); - }; - - WiFiManager.BackgroundScanFinished += backgroundScanFinished; - await Task.Delay(1500); - await setUp(); - WiFiAP ap = WiFiManager.GetConnectedAP(); - ap.ForgetAP(); - - await Task.Delay(TimeSpan.FromSeconds(200), tSource.Token).ContinueWith(tsk => {}); - tSource.Dispose(); - WiFiManager.BackgroundScanFinished -= backgroundScanFinished; - - Assert.IsTrue(_flag, "No BackgroundScan"); - - 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()); - } - } - - [Test] - [Category("P1")] - [Description("starts BSSID scan asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.BssidScanAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task BssidScanAsync_BSSIDSCAN() - { - try - { - await setUp(); - - var count = 0; - await WiFiManager.BssidScanAsync(); - var listAp = WiFiManager.GetFoundBssids(); - foreach (var item in listAp) - count++; - Assert.Greater(count, 0, "BssidScanAsync can't scan any WiFiAp"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test: Gets the result of the BssidScanAsync asynchronously")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundBssids M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetFoundBssids_BSSIDSCAN_AND_GET_ALL_AP() - { - try - { - await setUp(); - - var count = 0; - await WiFiManager.BssidScanAsync(); - var listAp = WiFiManager.GetFoundBssids(); - foreach (var item in listAp) - count++; - Assert.Greater(count, 0, "GetFoundBssids fail"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - public void EventHandlerScanState(object sender, ScanStateChangedEventArgs State) - { - if (State.State == WiFiScanState.Scanning) - _flag = true; - } - - - [Test] - [Category("P1")] - [Description("Test ScanStateChanged event of WiFiManager")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] - public async Task ScanStateChanged_CHECK_CB_EVENT() - { - try - { - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - } - WiFiManager.ScanStateChanged += EventHandlerScanState; - await Task.Delay(1500); - await WiFiManager.ScanAsync(); - await Task.Delay(1500); - WiFiManager.ScanStateChanged -= EventHandlerScanState; - Assert.IsTrue(_flag, "ScanState is not changed."); - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test ScanState property")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] - public async Task ScanState_PROPERTY() - { - try - { - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - await Task.Delay(3000); - } - Assert.AreEqual(WiFiScanState.NotScanning, WiFiManager.ScanState, "ScanState didn't return NotScanning"); - Log.Info(Globals.LogTag, "Successfully done"); - } - 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()); - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiNetwork.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiNetwork.cs deleted file mode 100755 index 076eb9d2f..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiNetwork.cs +++ /dev/null @@ -1,976 +0,0 @@ -using System; -using System.Text; -using Tizen.Network.Connection; -using System.Threading.Tasks; -using networkUtils; -using NUnit.Framework; -using System.Net; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiNetwork Tests")] - public class WiFiNetworkTests - { - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Console.WriteLine("Preconditions for each TESTCASE"); - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Console.WriteLine("Postconditions for each TESTCASE"); - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - [Test] - [Category("P1")] - [Description("Test Essid property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Essid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Essid_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var essid = _wiFiNetwork.Essid; - Assert.AreEqual(networkParameter.wnPRIVATE, essid, "Essid doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test RawSsid property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.RawSsid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun, chleun.moon@samsung.com")] - public async Task RawSsid_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var rawSsid = _wiFiNetwork.RawSsid; - string ssid = Encoding.UTF8.GetString(rawSsid); - Log.Info(Globals.LogTag, "Converted SSID: " + ssid); - Assert.AreEqual(networkParameter.wnPRIVATE, ssid, "Invalid RawSsid"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test Bssid property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Bssid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Bssid_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var bssid = _wiFiNetwork.Bssid; - Assert.IsNotNull(bssid, "Bssid doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Get all BSSIDs of a WiFiAp")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.GetBssids M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetBssids_GET() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Get connect AP - */ - Log.Info(Globals.LogTag, "GetBssids_GET start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - - /* TEST CODE */ - var list = _wifiAP.NetworkInformation.GetBssids(); - Assert.IsNotNull(list, "GetBssids fails"); - } - 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("P1")] - [Description("Test CountryCode property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.CountryCode A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task CountryCode_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var code = _wiFiNetwork.CountryCode; - - /* - * The country code can be NULL if AP or M/W do not have the country code. - * Therefore, we check only if there is no exception when CountryCode is accessed. - */ - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test ConnectionState property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ConnectionState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ConnectionState_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - Assert.AreEqual((int)(WiFiConnectionState.Connected), (int)(_wiFiNetwork.ConnectionState), "ConnectionState doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test Frequency property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Frequency A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Frequency_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var frequency = _wiFiNetwork.Frequency; - Assert.Greater(frequency, 0, "Frequency doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test IsFavorite property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IsFavorite A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IsFavorite_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - Assert.IsTrue(_wiFiNetwork.IsFavorite, "IsFavorite doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test IsPasspoint property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IsPasspoint A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IsPasspoint_PROPERTY() - { - Log.Info(Globals.LogTag, "Start IsPasspoint_PROPERTY"); - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - Assert.IsInstanceOf(_wiFiNetwork.IsPasspoint, "IsPasspoint is not bool"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test MaxSpeed property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.MaxSpeed A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task MaxSpeed_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var maxSpeed = _wiFiNetwork.MaxSpeed; - Assert.Greater(maxSpeed, 0, "MaxSpeed doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test Rssi property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Rssi A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Rssi_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - * Get Rssi of WiFi - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var rssi = _wiFiNetwork.Rssi; - Assert.IsInstanceOf(rssi, "Rssi doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test RssiLevel property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.RssiLevel A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task RssiLevel_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - * Get RssiLevel of WiFi - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var rssiLevel = _wiFiNetwork.RssiLevel; - Assert.IsInstanceOf(rssiLevel, "RssiLevel doesn't get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test ProxyAddress property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ProxyAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ProxyAddress_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - var proxyAddress = "192.168.1.109"; - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - _wiFiNetwork.ProxyAddress = proxyAddress; - _wifiAP.Update(); - - Assert.AreEqual(proxyAddress, _wiFiNetwork.ProxyAddress, "ProxyAddress doesn't set and get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test ProxyType property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ProxyType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task ProxyType_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - _wiFiNetwork.ProxyType = WiFiProxyType.Manual; - _wifiAP.Update(); - - Assert.AreEqual((int)WiFiProxyType.Manual, (int)(_wiFiNetwork.ProxyType), "ProxyType doesn't set and get successful"); - - Log.Info(Globals.LogTag, "Successfully done"); - } - 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("P1")] - [Description("Test Ipv4Setting property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IPv4Setting A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IPv4Setting_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var ipv4Setting = _wiFiNetwork.IPv4Setting; - Assert.IsNotNull(ipv4Setting, "Ipv4Setting should be return not null"); - var ip = "192.168.192.23"; - var subnet = "255.255.255.0"; - var gateway = "192.168.192.1"; - var dns1 = "8.8.8.8"; - var dns2 = "8.8.4.4"; - ipv4Setting.IPConfigType = IPConfigType.Static; - ipv4Setting.IP = IPAddress.Parse(ip); - ipv4Setting.SubnetMask = IPAddress.Parse(subnet); - ipv4Setting.Gateway = IPAddress.Parse(gateway); - ipv4Setting.DnsConfigType = DnsConfigType.Static; - ipv4Setting.Dns1 = IPAddress.Parse(dns1); - ipv4Setting.Dns2 = IPAddress.Parse(dns2); - _wifiAP.Update(); - await Task.Delay(3000); - - Assert.AreEqual(ip.ToString(), ipv4Setting.IP.ToString(), "Ip of Ipv4Setting get should be same set"); - Assert.AreEqual(gateway.ToString(), ipv4Setting.Gateway.ToString(), "Gateway of Ipv4Setting get should be same set"); - Assert.AreEqual(subnet.ToString(), ipv4Setting.SubnetMask.ToString(), "SubnetMask of Ipv4Setting get should be same set"); - Assert.AreEqual(dns1.ToString(), ipv4Setting.Dns1.ToString(), "Dns1 of Ipv4Setting get should be same set"); - Assert.AreEqual(dns2.ToString(), ipv4Setting.Dns2.ToString(), "Dns2 of Ipv4Setting get should be same set"); - Assert.AreEqual((int)(IPConfigType.Static), (int)(ipv4Setting.IPConfigType), "IpConfigType of Ipv4Setting get should be same set"); - - Log.Info(Globals.LogTag, "Successfully done"); - - await _wifiAP.ForgetAPAsync(); - await setUp(); - Log.Info(Globals.LogTag, "Finished"); - } - 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("P1")] - [Description("Test Ipv6Setting property of WiFiNetwork")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IPv6Setting A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task IPv6Setting_PROPERTY() - { - WiFiAP _wifiAP = null; - WiFiNetwork _wiFiNetwork = null; - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - */ - await setUp(); - - /* - * TEST CODE - */ - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - _wiFiNetwork = _wifiAP.NetworkInformation; - var ipv6Setting = _wiFiNetwork.IPv6Setting; - Assert.IsNotNull(ipv6Setting, "Ipv6Setting should be return not null"); - var ip = "fe80::202:b3ff:fe1e:8329"; - ipv6Setting.IPConfigType = IPConfigType.Static; - ipv6Setting.IP = IPAddress.Parse(ip); - _wifiAP.Update(); - - bool found = false; - - var IPList = _wiFiNetwork.GetAllIPv6Addresses(); - foreach(IPAddress item in IPList) - { - Log.Info(Globals.LogTag, "IPv6 Address: " + item.ToString()); - if (item.ToString().Equals(ip)) - { - found = true; - break; - } - } - Assert.AreEqual((int)(IPConfigType.Static), (int)(ipv6Setting.IPConfigType), "IpConfigType of Ipv6Setting get should be same set"); - Assert.IsTrue(found, "Can't find IPv6 "); - - Log.Info(Globals.LogTag, "Successfully done"); - - await _wifiAP.ForgetAPAsync(); - await setUp(); - Log.Info(Globals.LogTag, "Finished"); - } - 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("P1")] - [Description("Get all IPv6 addresses of device: dynamic")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.GetAllIPv6Addresses M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public async Task GetAllIPv6Addresses_GET() - { - WiFiAP _wifiAP = null; - try - { - /* - * PRECONDITION - * 1. Activate WiFi then connect to a AP. - * 2. Get connect AP - */ - Log.Info(Globals.LogTag, "GetAllIPv6Addresses_ALL_TYPE start"); - await setUp(); - _wifiAP = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wifiAP, "No WiFi connection"); - - /* TEST CODE */ - var list = _wifiAP.NetworkInformation.GetAllIPv6Addresses(); - Assert.IsNotNull(list, "GetAllIPv6Address fails"); - } - 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(); - } - } - } - - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiProfile.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiProfile.cs deleted file mode 100755 index bbdf63524..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiProfile.cs +++ /dev/null @@ -1,583 +0,0 @@ -using System; -using NUnit.Framework; -using Tizen.Network.WiFi; -using System.Threading.Tasks; -using networkUtils; -using Tizen.System; - -namespace Tizen.Network.Connection.Tests -{ - [TestFixture] - [Description("Tizen.Network.Connection.WiFiProfile Tests")] - class WiFiProfileTests - { - private ConnectionProfile _connectionProfile; - private WiFiAP _wiFiAp; - private WiFiNetwork _wiFiNetwork; - private WiFiProfile _wiFiProfile; - private WiFiSecurity _wiFiSecurity; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - _connectionProfile = null; - _wiFiAp = null; - _wiFiNetwork = null; - _wiFiSecurity = null; - _wiFiProfile = null; - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - - _connectionProfile = null; - _wiFiAp = null; - _wiFiNetwork = null; - _wiFiSecurity = null; - _wiFiProfile = null; - } - - public async Task setUp() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - _wiFiAp = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wiFiAp, "No WiFi connection"); - _wiFiNetwork = _wiFiAp.NetworkInformation; - _wiFiSecurity = _wiFiAp.SecurityInformation; - var list = await ConnectionProfileManager.GetProfileListAsync(ProfileListType.Registered); - foreach (var item in list) - { - _connectionProfile = item; - break; - } - _wiFiProfile = (WiFiProfile)_connectionProfile; - } - - [Test] - [Category("P1")] - [Description("Test Essid property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Essid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Essid_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare Essid property between two object WiFiNetwork and WiFiProfile - */ - var essid = _wiFiProfile.Essid; - Log.Info(Globals.LogTag, "Essid_PROPERTY essid: " + essid); - Assert.AreEqual(essid, _wiFiNetwork.Essid, "Essid doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Bssid property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Bssid A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Bssid_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare Bssid property between two object WiFiNetwork and WiFiProfile - */ - var bssid = _wiFiProfile.Bssid; - Assert.AreEqual(bssid, _wiFiNetwork.Bssid, "Bssid doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Rssi property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Rssi A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Rssi_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Get Rssi of WiFi - * Disconnected WiFi - * Connected to that WiFi - * Then get again Rssi of WiFi - * Compare Rssi between two times get - */ - var rssid1 = _wiFiProfile.Rssi; - Assert.IsNotNull(rssid1, "RSSI is NULL"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Frequency property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.Frequency A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task Frequency_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare Frequency property between two object WiFiNetwork and WiFiProfile - */ - var frequency = _wiFiProfile.Frequency; - Assert.AreEqual(frequency, _wiFiNetwork.Frequency, "Frequency doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test MaxSpeed property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.MaxSpeed A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task MaxSpeed_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiNetwork object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare MaxSpeed property between two object WiFiNetwork and WiFiProfile - */ - int _maxSpeed = _wiFiProfile.MaxSpeed; - Log.Info(Globals.LogTag, "_wiFiProfile.MaxSpeed: " + _maxSpeed); - Log.Info(Globals.LogTag, "_wiFiNetwork.MaxSpeed: " + _wiFiNetwork.MaxSpeed); - Assert.AreEqual(_maxSpeed, _wiFiNetwork.MaxSpeed, "MaxSpeed doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test SecureType property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.SecurityType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SecurityType_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiSecurity object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare SecureType property between two object WiFiSecurity and WiFiProfile - */ - var secureType = _wiFiProfile.SecurityType; - Assert.AreEqual(secureType.ToString(), _wiFiSecurity.SecurityType.ToString(), "SecurityType doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test EncryptionType property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.EncryptionType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task EncryptionType_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiSecurity object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare EncryptionType property between two object WiFiSecurity and WiFiProfile - */ - var encryptionType = _wiFiProfile.EncryptionType; - Assert.AreEqual(encryptionType.ToString(), _wiFiSecurity.EncryptionType.ToString(), "EncryptionType doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test PassphraseRequired property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.PassphraseRequired A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task PassphraseRequired_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiSecurity object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare PassphraseRequired property between two object WiFiSecurity and WiFiProfile - */ - var passphraseRequired = _wiFiProfile.PassphraseRequired; - Assert.AreEqual(passphraseRequired.ToString(), _wiFiSecurity.IsPassphraseRequired.ToString(), "PassphraseRequired doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test WpsSupported property")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.WpsSupported A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task WpsSupported_PROPERTY() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiSecurity object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - * Compare PassphraseRequired property between two object WiFiSecurity and WiFiProfile - */ - var wpsSupported = _wiFiProfile.WpsSupported; - Assert.AreEqual(wpsSupported.ToString(), _wiFiSecurity.IsWpsSupported.ToString(), "WpsSupported doesn't get successful"); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test SetPassphrase method")] - [Property("SPEC", "Tizen.Network.Connection.WiFiProfile.SetPassphrase M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] - public async Task SetPassphrase_CHECK_STATUS() - { - try - { - /* - * PRECONDITION - * Activate WiFi then get WiFi connected - * Create a WiFiSecurity object - * Create a WiFiProfile object - */ - await setUp(); - - /* - * TEST CODE - */ - var passphrase = "pass12345"; - - _wiFiProfile.SetPassphrase(passphrase); - } - 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(); - } - if (_wiFiProfile != null) - { - _wiFiProfile.Dispose(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiSecurity.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiSecurity.cs deleted file mode 100755 index 9511e32cd..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWiFiSecurity.cs +++ /dev/null @@ -1,367 +0,0 @@ -using NUnit.Framework; -using System; -using Tizen.Network.Connection; -using networkUtils; -using System.Threading.Tasks; -using Tizen.System; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WiFiSecurity Tests")] - public class WiFiSecurityTests - { - private WiFiSecurity _wiFiSecurity; - private string _wiFiName; - private WiFiEncryptionType _wiFiEncryptionType; - private WiFiSecurityType _wiFiSecuType; - bool isWiFiSupported = false; - - [OneTimeSetUp] - public void InitFixture() - { - networkParameter.SetPrecondition(); - } - - [SetUp] - public void Init() - { - Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); - } - - [TearDown] - public void Destroy() - { - _wiFiSecurity = null; - _wiFiName = null; - } - - public void init() - { - _wiFiName = networkParameter.wnPRIVATE; - } - - public async Task setup() - { - await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); - } - - [Test] - [Category("P1")] - [Description("Test EncryptionType")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.EncryptionType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] - public void EncryptionType_SET_GET() - { - WiFiAP _wiFiAp = null; - try - { - init(); - /** - * PRECONDITION: - * - Creat an SecurityInformation. - */ - _wiFiAp = new WiFiAP(_wiFiName); - _wiFiSecurity = _wiFiAp.SecurityInformation; - - /* TEST CODE */ - /* Aes */ - _wiFiSecurity.EncryptionType = WiFiEncryptionType.Aes; - _wiFiEncryptionType = _wiFiSecurity.EncryptionType; - Assert.AreEqual((int)(WiFiEncryptionType.Aes), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Aes."); - /* None */ - _wiFiSecurity.EncryptionType = WiFiEncryptionType.None; - _wiFiEncryptionType = _wiFiSecurity.EncryptionType; - Assert.AreEqual((int)(WiFiEncryptionType.None), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is None."); - - /* Tkip */ - _wiFiSecurity.EncryptionType = WiFiEncryptionType.Tkip; - _wiFiEncryptionType = _wiFiSecurity.EncryptionType; - Assert.AreEqual((int)(WiFiEncryptionType.Tkip), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Tkip."); - - /* TkipAesMixed */ - _wiFiSecurity.EncryptionType = WiFiEncryptionType.TkipAesMixed; - _wiFiEncryptionType = _wiFiSecurity.EncryptionType; - Assert.AreEqual((int)(WiFiEncryptionType.TkipAesMixed), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is TkipAesMixed."); - - /* Wep */ - _wiFiSecurity.EncryptionType = WiFiEncryptionType.Wep; - _wiFiEncryptionType = _wiFiSecurity.EncryptionType; - Assert.AreEqual((int)(WiFiEncryptionType.Wep), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Wep."); - } - 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("P1")] - [Description("Test SecurityType")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.SecurityType A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] - public void SecurityType_SET_GET() - { - WiFiAP _wiFiAp = null; - try - { - init(); - /** - * PRECONDITION: - * - Creat an SecurityInformation. - */ - _wiFiAp = new WiFiAP(_wiFiName); - _wiFiSecurity = _wiFiAp.SecurityInformation; - - /* TEST CODE */ - /* Eap */ - _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; - _wiFiSecuType = _wiFiSecurity.SecurityType; - Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiSecuType), "SecurityType has gotten should be is Eap."); - /* None */ - _wiFiSecurity.SecurityType = WiFiSecurityType.None; - _wiFiSecuType = _wiFiSecurity.SecurityType; - Assert.AreEqual((int)(WiFiSecurityType.None), (int)(_wiFiSecuType), "SecurityType has gotten should be is None."); - /* Wep */ - _wiFiSecurity.SecurityType = WiFiSecurityType.Wep; - _wiFiSecuType = _wiFiSecurity.SecurityType; - Assert.AreEqual((int)(WiFiSecurityType.Wep), (int)(_wiFiSecuType), "SecurityType has gotten should be is Wep."); - /* Wpa2Psk */ - _wiFiSecurity.SecurityType = WiFiSecurityType.Wpa2Psk; - _wiFiSecuType = _wiFiSecurity.SecurityType; - Assert.AreEqual((int)(WiFiSecurityType.Wpa2Psk), (int)(_wiFiSecuType), "SecurityType has gotten should be is Wpa2Psk."); - - /* WpaPsk */ - _wiFiSecurity.SecurityType = WiFiSecurityType.WpaPsk; - _wiFiSecuType = _wiFiSecurity.SecurityType; - Assert.AreEqual((int)(WiFiSecurityType.WpaPsk), (int)(_wiFiSecuType), "SecurityType has gotten should be is WpaPsk."); - } - 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("P1")] - [Description("Test SetPassphrase")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.SetPassphrase M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] - public async Task SetPassphrase_CHECK_STATUS() - { - try - { - init(); - /** - * PRECONDITION: - * - Creat an SecurityInformation. - */ - await setup(); - await Task.Delay(1500); - Log.Info(Globals.LogTag, "WiFiConnectionState=" + WiFiConnectionState.Connected.ToString()); - Log.Info(Globals.LogTag, "WiFiConnectionState=" + WiFiManager.ConnectionState.ToString()); - - Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not connected"); - } - 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()); - } - } - - [Test] - [Category("P1")] - [Description("Test EapInformation")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.EapInformation A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] - public void EapInformation_SET_GET() - { - WiFiAP _wiFiAp = null; - try - { - init(); - /** - * PRECONDITION: - * - Creat an SecurityInformation. - */ - _wiFiAp = new WiFiAP(_wiFiName); - _wiFiSecurity = _wiFiAp.SecurityInformation; - var setEap = _wiFiSecurity.EapInformation; - Assert.IsInstanceOf(setEap); - Assert.IsNotNull(_wiFiSecurity, "EapInformation should be return not null"); - _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; - setEap.AuthenticationType = WiFiAuthenticationType.Pap; - setEap.CaCertificationFile = "File"; - setEap.EapType = WiFiEapType.Peap; - - /* TEST CODE */ - Assert.AreEqual((int)(setEap.AuthenticationType), (int)(setEap.AuthenticationType), "AuthenticationType set and get should be equal."); - Assert.AreEqual((int)(setEap.EapType), (int)(setEap.EapType), "EapType set and get should be equal."); - Assert.AreEqual(setEap.CaCertificationFile, setEap.CaCertificationFile, "CaCertificationFile set and get should be equal."); - } - 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("P1")] - [Description("Test IsWpsSupported")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.IsWpsSupported A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] - public async Task IsWpsSupported_GET() - { - WiFiAP _wiFiAp = null; - try - { - init(); - /** - * PRECONDITION: - * Turn on and connect to a wifi private - * -example scenario: connect to a ROUTER which support a PUSH BUTTON - * -manual test: push the BUTTON (on the UI or the physic button) to start connection transaction - */ - await setup(); - /* TEST CODE */ - _wiFiAp = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wiFiAp, "Can't get a wifi ap"); - _wiFiSecurity = _wiFiAp.SecurityInformation; - Assert.IsNotNull(_wiFiSecurity, "WifiSecurity is NULL"); - Log.Info(Globals.LogTag, "IsWpsSupported=" + _wiFiSecurity.IsWpsSupported); - } - 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("P1")] - [Description("Test whether the passphrase is required or not")] - [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.IsPassphraseRequired A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Ngo Thi Huong, huong.nt1@samsung.com")] - public async Task IsPassphraseRequired_GET() - { - WiFiAP _wiFiAp = null; - try - { - init(); - /** - * PRECONDITION: - * Turn on and connect to a wifi private - * -example scenario: connect to a ROUTER which support a PUSH BUTTON - * -manual test: push the BUTTON (on the UI or the physic button) to start connection transaction - */ - await setup(); - /* TEST CODE */ - _wiFiAp = WiFiManager.GetConnectedAP(); - Assert.IsNotNull(_wiFiAp, "Can't get a wifi ap"); - _wiFiSecurity = _wiFiAp.SecurityInformation; - Assert.IsNotNull(_wiFiSecurity, "WifiSecurity is NULL"); - Log.Info(Globals.LogTag, "IsPassphraseRequired=" + _wiFiSecurity.IsPassphraseRequired); - Assert.IsFalse(_wiFiSecurity.IsPassphraseRequired, "Wifi doesn't require passphase"); - } - 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(); - } - } - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsInfo.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsInfo.cs deleted file mode 100755 index 2c2cc5ab7..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -using NUnit.Framework; -using networkUtils; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WpsInfo Tests")] - public class WpsInfoTests - { - [OneTimeSetUp] - public void InitFixture() - { - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test WpsInfo constructor")] - [Property("SPEC", "Tizen.Network.WiFi.WpsInfo.WpsInfo C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void WpsInfo_INIT() - { - WpsInfo info = new WpsPbcInfo(); - Assert.IsInstanceOf(info, "Creating WpsInfo is failed"); - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPbcInfo.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPbcInfo.cs deleted file mode 100755 index f3a44d08d..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPbcInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -using NUnit.Framework; -using networkUtils; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WpsPbcInfo Tests")] - public class WpsPbcInfoTests - { - [OneTimeSetUp] - public void InitFixture() - { - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test WpsPbcInfo constructor")] - [Property("SPEC", "Tizen.Network.WiFi.WpsPbcInfo.WpsPbcInfo C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - public void WpsPbcInfo_INIT() - { - WpsPbcInfo info = new WpsPbcInfo(); - Assert.IsInstanceOf(info, "Creating WpsPbcInfo is failed"); - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPinInfo.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPinInfo.cs deleted file mode 100755 index f384fec16..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/TSWpsPinInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -using NUnit.Framework; -using networkUtils; - -namespace Tizen.Network.WiFi.Tests -{ - [TestFixture] - [Description("Tizen.Network.WiFi.WpsPinInfo Tests")] - public class WpsPinInfoTests - { - [OneTimeSetUp] - public void InitFixture() - { - } - - [SetUp] - public void Init() - { - Log.Info(Globals.LogTag, "Preconditions for each TEST"); - } - - [TearDown] - public void Destroy() - { - Log.Info(Globals.LogTag, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Test WpsPinInfo constructor")] - [Property("SPEC", "Tizen.Network.WiFi.WpsPinInfo.WpsPinInfo C")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "CONSTR")] - [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] - [Property("COVPARAM", "string")] - public void WpsPinInfo_INIT() - { - WpsPinInfo info = new WpsPinInfo("12345678"); - Assert.IsInstanceOf(info, "Creating WpsPinInfo is failed"); - } - } -} - diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkParameter.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkParameter.cs deleted file mode 100755 index 327fd0b1e..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkParameter.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System; -using System.IO; - -namespace networkUtils -{ - /* ***********************************************************************/ - // ** - // ** Setup: name/securetype for an AP, using as precondition for testing - // ** - /* ***********************************************************************/ - public class networkParameter - { - public enum wType - { - wPublic = 0, - wPrivate = 1, - wHidden = 2, - wEap = 3, - } - - /*----------Setup belowing APs for testing:-----------*/ - - /*SQE configuration*/ - public static string wnPUBLIC = null; - public static string wnPRIVATE = null; - public static string wnPRIVATE1 = null; - public static string wnHIDDEN = null; - public static string wnEAP = null; - public static string wPASS = null; - /*This password string should be not exceeded 8 characters as API's description, so pls replace "happy12345" by "abc13579"*/ - /*This password string "wPASS = "abc13579" should be using for all of 2 private APs "DPT_Part01" and "DPT_Part02", because it was configured inside Testing code - *If you wanna change wPASS string, pls modified related TCs also*/ - - /*svmc setup*/ - //public static string wnPUBLIC = "SVMC_12F_LAP_TEST_IPTIME24"; - public static void SetPrecondition() - { - int index = 0; - string result = RequestGET("/opt/usr/home/owner/share/tct/preconfigure.json"); - if (result == null) - { - Tizen.Log.Error(Globals.LogTag, "RequestGET failed"); - return; - } - string[] resultArray = ResultParser(result); - if (resultArray == null) - { - Tizen.Log.Error(Globals.LogTag, "ResultParser failed"); - return; - } - Tizen.Log.Info(Globals.LogTag, "========== Precondition =========="); - foreach (string item in resultArray) - { - switch (item) - { - case "PUBLIC_AP": - wnPUBLIC = resultArray[index + 1]; - Tizen.Log.Info(Globals.LogTag, "PUBLIC AP : " + wnPUBLIC); - break; - case "PRIVATE_AP_1_2": - wnPRIVATE = resultArray[index + 1]; - wnEAP = resultArray[index + 1]; - Tizen.Log.Info(Globals.LogTag, "EAP : " + wnEAP); - Tizen.Log.Info(Globals.LogTag, "PRIVATE1 AP : " + wnPRIVATE); - break; - case "PRIVATE_AP_2_2": - wnPRIVATE1 = resultArray[index + 1]; - Tizen.Log.Info(Globals.LogTag, "PRIVATE2 AP : " + wnPRIVATE1); - break; - case "HIDDEN_AP": - wnHIDDEN = resultArray[index + 1]; - Tizen.Log.Info(Globals.LogTag, "HIDDEN AP : " + wnHIDDEN); - break; - case "PASSWORD_FOR_ALL_PRIVATE_AP": - wPASS = resultArray[index + 1]; - Tizen.Log.Info(Globals.LogTag, "PASSWORD : " + wPASS); - break; - default: - break; - } - index++; - } - } - - private static string RequestGET(string path) - { - string result = null; - string url = path; - StreamReader reader = null; - - Tizen.Log.Info(Globals.LogTag, "RequestGET url: " + url); - - try - { - reader = File.OpenText(path); - result = reader.ReadToEnd(); - Tizen.Log.Info(Globals.LogTag, "RequestGET Result: " + result); - } - catch (Exception e) - { - Tizen.Log.Info(Globals.LogTag, "RequestGET error: " + e.Message); - } - finally - { - if (reader != null) - { - reader.Dispose(); - } - } - - return result; - } - private static string[] ResultParser(string TCID) - { - string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; - string[] stringPieces = null; - - try - { - stringPieces = TCID.Split(delimiter, StringSplitOptions.None); - } - catch (Exception e) - { - Tizen.Log.Info(Globals.LogTag, "ResultParser error: " + e.Message); - } - - return stringPieces; - } - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkSetup.cs b/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkSetup.cs deleted file mode 100755 index a037eaaa3..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/testcase/support/networkSetup.cs +++ /dev/null @@ -1,137 +0,0 @@ -using Tizen.Network.WiFi; -using System.Threading.Tasks; - -namespace networkUtils -{ - /* ***********************************************************************/ - // ** - // ** Common library for connect/disconnect to/from WiFi: hidden, private, eap, public - // ** - /* ***********************************************************************/ - static internal class Globals - { - internal const string LogTag = "NetworkTC"; - } - - public class networkSetup - { - private static int MAX_SCAN_TRY = 3; - - private networkSetup() - { - } - - public static async Task ForgetCurrentAP() - { - Tizen.Log.Info(Globals.LogTag, "networkSetup.ForgetCurrentAP"); - WiFiAP ap = WiFiManager.GetConnectedAP(); - if (ap != null) - { - Tizen.Log.Info(Globals.LogTag, "Forget AP " + ap.NetworkInformation.Essid); - await ap.ForgetAPAsync(); - ap.Dispose(); - } - } - - public static async Task ActivateWiFi() - { - Tizen.Log.Info(Globals.LogTag, "networkSetup.ActivateWiFi"); - if (!WiFiManager.IsActive) - { - await WiFiManager.ActivateAsync(); - await Task.Delay(1500); - } - Tizen.Log.Info(Globals.LogTag, "WiFi is Activated"); - } - - public static async Task DeactivateWiFi() - { - Tizen.Log.Info(Globals.LogTag, "networkSetup.DeactivateWiFi"); - if (WiFiManager.IsActive) - { - await ForgetCurrentAP(); - await WiFiManager.DeactivateAsync(); - Tizen.Log.Info(Globals.LogTag, "Deactivated"); - } - } - - - private static WiFiAP FindAP(string WiFiName) - { - Tizen.Log.Info(Globals.LogTag, "Find AP " + WiFiName + " from scan results"); - var list = WiFiManager.GetFoundAPs(); - - foreach (WiFiAP item in list) - { - if (item.NetworkInformation.Essid == WiFiName) - { - Tizen.Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString()); - return item; - } - item.Dispose(); - } - return null; - } - - /* Connect to a WANTED AP */ - public static async Task ConnectWiFi(string WiFiName, networkParameter.wType type, string WiFiPass) - { - Tizen.Log.Info(Globals.LogTag, "ConnectWiFi (AP: " + WiFiName + ", Password: " + WiFiPass + ")"); - - await ActivateWiFi(); - - WiFiAP ap = WiFiManager.GetConnectedAP(); - // Already connected - if (ap != null && ap.NetworkInformation.Essid == WiFiName) - { - return; - } - - /** - * Connected to another AP - * We need to forget it - */ - if (ap != null) - { - Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid); - await ForgetCurrentAP(); - ap = WiFiManager.GetConnectedAP(); - if (ap != null) - { - Tizen.Log.Error(Globals.LogTag, "AP must be null"); - return; - } - } - Tizen.Log.Info(Globals.LogTag, "No connected AP"); - - /** - * Find AP from scan results - * If it fails, scan Wi-Fi APs maximum three times - */ - ap = FindAP(WiFiName); - for (int i = 0; i < MAX_SCAN_TRY && ap == null; i++) - { - await Task.Delay(1000); - await WiFiManager.ScanAsync(); - ap = FindAP(WiFiName); - } - - // Scan Failure - if (ap == null) - { - Tizen.Log.Error(Globals.LogTag, "AP " + WiFiName + " is not found"); - return; - } - - // Connect to AP - if (type != networkParameter.wType.wPublic) - { - Tizen.Log.Info(Globals.LogTag, "Set passphrase " + WiFiPass); - ap.SecurityInformation.SetPassphrase(WiFiPass); - } - - await ap.ConnectAsync(); - Tizen.Log.Info(Globals.LogTag, "Connected"); - } // ConnectWiFi() - } -} diff --git a/tct-suite-vs/Tizen.Network.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.Network.Tests/tizen-manifest.xml deleted file mode 100644 index b1fb51ac0..000000000 --- a/tct-suite-vs/Tizen.Network.Tests/tizen-manifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Tizen.Network.Tests.png - - - - http://tizen.org/privilege/network.get - http://tizen.org/privilege/network.set - http://tizen.org/privilege/network.profile - http://tizen.org/privilege/appmanager.launch - - \ No newline at end of file diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/Program.cs b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Program.cs new file mode 100755 index 000000000..9f326eff2 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Program.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnit.Framework; +using Xamarin.Forms; + +namespace XamarinApplication.Tizen +{ + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private Application _app; + protected override void OnCreate() + { + Console.WriteLine("TCT : OnCreate()"); + base.OnCreate(); + if (ManualTest.IsWearable()) + { + _app = new WearableTemplate.MainPage(); + } + else + { + _app = new ManualTemplate.MainPage(); + } + LoadApplication(_app); + } + + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.csproj b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.csproj new file mode 100755 index 000000000..a171ef771 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.sln b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.sln new file mode 100755 index 000000000..6afc5c245 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/Tizen.WiFi.Manual.Tests.sln @@ -0,0 +1,92 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WiFi.Manual.Tests", "Tizen.WiFi.Manual.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplate", "..\Template\ManualTemplate\ManualTemplate.csproj", "{269F89A7-E648-4811-8421-844E00ACF5F0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ManualTemplateForWearable", "..\Template\ManualTemplateForWearable\ManualTemplateForWearable.csproj", "{D36CED01-29BD-4EB3-8903-62E0BF2A822D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x64.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.ActiveCfg = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Debug|x86.Build.0 = Debug|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|Any CPU.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x64.Build.0 = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.ActiveCfg = Release|Any CPU + {269F89A7-E648-4811-8421-844E00ACF5F0}.Release|x86.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x64.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.ActiveCfg = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Debug|x86.Build.0 = Debug|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|Any CPU.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x64.Build.0 = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.ActiveCfg = Release|Any CPU + {D36CED01-29BD-4EB3-8903-62E0BF2A822D}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/shared/res/Tizen.WiFi.Manual.Tests.png b/tct-suite-vs/Tizen.WiFi.Manual.Tests/shared/res/Tizen.WiFi.Manual.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.WiFi.Manual.Tests/shared/res/Tizen.WiFi.Manual.Tests.png differ diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/TSWiFiAP.cs b/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/TSWiFiAP.cs new file mode 100755 index 000000000..0007b4e13 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/TSWiFiAP.cs @@ -0,0 +1,261 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using Xamarin.Forms; +using Tizen.System; +using Tizen.Network.WiFi; +using networkUtils; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiAP Tests")] + public class WiFiAPTests + { + bool isWiFiSupported = false; + private bool _flag = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + PreconditionUtils.SetPrecondition(); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test a connection to a WpsPbs WiFi")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "Prepare a WiFi AP with WPS PBC support")] + [Precondition(2, "Activate WiFi")] + [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] + [Precondition(4, "Check if your WPS PBC support AP is scanned")] + [Step(1, "Tap the Run button")] + [Step(2, "Go to the AP and push the PBC button")] + [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] + [Postcondition(1, "Forget the connected AP")] + [Postcondition(2, "Deactivate WiFi")] + public async Task ConnectWpsAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON() + { + WiFiAP ap = null; + try + { + /** + * PRE CONDITION + * turn off WiFi + * */ + + /** TEST CODE */ + var list = WiFiManager.GetFoundAPs(); + foreach (var item in list) + { + if (item.NetworkInformation.Essid.ToString() == PreconditionUtils.WPS_PBC_AP) + { + Log.Info(Globals.LogTag, "Find " + item.NetworkInformation.Essid.ToString()); + ap = item; + break; + } + } + + Assert.IsNotNull(ap, "Can't find a WiFi AP"); + WpsInfo info = new WpsPbcInfo(); + await ap.ConnectWpsAsync(info); + Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't turn on"); + Log.Info(Globals.LogTag, "Successfully done"); + + /** + * POST CONDITION + * */ + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Check a connection to a WiFi, which has a password")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsAsync M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "Prepare a WiFi AP with WPS PIN support")] + [Precondition(2, "Activate WiFi")] + [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] + [Precondition(4, "Check if your WPS PIN support AP is scanned")] + [Step(1, "Tap the Run button")] + [Step(2, "Go to the AP and input the WPS PIN number")] + [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] + [Postcondition(1, "Forget the connected AP")] + [Postcondition(2, "Deactivate WiFi")] + public async Task ConnectWpsAsync_CONNECT_TO_A_AP_SUPPORTED_PIN() + { + WiFiAP ap = null; + try + { + /** TEST CODE */ + var list = WiFiManager.GetFoundAPs(); + Log.Info(Globals.LogTag, "WPS PIN AP: " + PreconditionUtils.WPS_PIN_AP); + foreach (var item in list) + { + Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString()); + if (item.NetworkInformation.Essid.ToString() == PreconditionUtils.WPS_PIN_AP) + { + Log.Info(Globals.LogTag, "Find " + item.NetworkInformation.Essid.ToString()); + ap = item; + break; + } + } + + Assert.IsNotNull(ap, "Can't find a WiFi AP"); + WpsInfo info = new WpsPinInfo(PreconditionUtils.PIN_NUMBER_OF_WPS_PIN_AP); + await ap.ConnectWpsAsync(info); + Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't turn on"); + Log.Info(Globals.LogTag, "Successfully done"); + + /** + * POST CONDITION + * */ + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test a connection to a WpsPbs WiFi")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsWithoutSsidAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "Prepare a WiFi AP with WPS PBC support")] + [Precondition(2, "Activate WiFi")] + [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] + [Precondition(4, "Check if your WPS PBC support AP is scanned")] + [Step(1, "Tap the Run button")] + [Step(2, "Go to the AP and push the PBC button")] + [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] + [Postcondition(1, "Forget the connected AP")] + [Postcondition(2, "Deactivate WiFi")] + public async Task ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON() + { + try + { + Log.Info(Globals.LogTag, "ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PUSH_BUTTON"); + + WpsInfo info = new WpsPbcInfo(); + var connectedAP = await WiFiAP.ConnectWpsWithoutSsidAsync(info); + Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); + Assert.IsNotNull(connectedAP, "There is no connected AP"); + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't connect"); + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Check a connection to a WiFi, which has a password")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectWpsWithoutSsidAsync M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + [Precondition(1, "Prepare a WiFi AP with WPS PIN support")] + [Precondition(2, "Activate WiFi")] + [Precondition(3, "Check if the device already connect to an AP. If so, forget it. There should not be any connected AP")] + [Precondition(4, "Check if your WPS PIN support AP is scanned")] + [Step(1, "Tap the Run button")] + [Step(2, "Go to the AP and input the WPS PIN number")] + [Step(3, "Testcase will pass automatically if the device is successfully connected to the AP")] + [Postcondition(1, "Forget the connected AP")] + [Postcondition(2, "Deactivate WiFi")] + public async Task ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PIN() + { + try + { + Log.Info(Globals.LogTag, "ConnectWpsWithoutSsidAsync_CONNECT_TO_A_AP_SUPPORTED_PIN"); + + WpsInfo info = new WpsPinInfo(PreconditionUtils.PIN_NUMBER_OF_WPS_PIN_AP); + var connectedAP = await WiFiAP.ConnectWpsWithoutSsidAsync(info); + Log.Info(Globals.LogTag, "WiFi ConnectionState: " + WiFiManager.ConnectionState.ToString()); + Assert.IsNotNull(connectedAP, "There is no connected AP"); + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi doesn't connect"); + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + } +} + + + diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/support/PreconditionUtils.cs b/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/support/PreconditionUtils.cs new file mode 100755 index 000000000..4a6d8678d --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/testcase/support/PreconditionUtils.cs @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using NUnit.Framework.TUnit; +using System; +using System.IO; + +namespace networkUtils +{ + static internal class Globals + { + internal const string LogTag = "NetworkTC"; + } + + public class PreconditionUtils + { + public static string WPS_PBC_AP = null; + public static string WPS_PIN_AP = null; + public static string PIN_NUMBER_OF_WPS_PIN_AP = null; + public static void SetPrecondition() + { + int index = 0; + string result = ReadFile("/opt/usr/home/owner/share/tct/preconfigure.json"); + if (result == null) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ReadFile failed"); + return; + } + string[] resultArray = StringParser(result); + if (resultArray == null) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "StringParser failed " + result); + return; + } + foreach (string item in resultArray) + { + switch (item) + { + case "WPS_PBC_AP": + // Remove backslash + resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); + WPS_PBC_AP = resultArray[index + 1]; + break; + case "WPS_PIN_AP": + // Remove backslash + resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); + WPS_PIN_AP = resultArray[index + 1]; + break; + case "PIN_NUMBER_OF_WPS_PIN_AP": + // Remove backslash + resultArray[index + 1] = resultArray[index + 1].Replace("\\", ""); + PIN_NUMBER_OF_WPS_PIN_AP = resultArray[index + 1]; + break; + default: + break; + } + index++; + } + } + + private static string ReadFile(string path) + { + string result = null; + string url = path; + StreamReader reader = null; + + try + { + reader = File.OpenText(path); + result = reader.ReadToEnd(); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "File read error : " + e.Message); + } + finally + { + if (reader != null) + { + reader.Dispose(); + } + } + + return result; + } + private static string[] StringParser(string TCID) + { + string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; + string[] stringPieces = null; + + try + { + stringPieces = TCID.Split(delimiter, StringSplitOptions.None); + } + catch (Exception e) + { + LogUtils.Write(LogUtils.ERROR, LogUtils.TAG, "ResultParser : " + e.Message); + } + + return stringPieces; + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Manual.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.WiFi.Manual.Tests/tizen-manifest.xml new file mode 100755 index 000000000..40f33f186 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Manual.Tests/tizen-manifest.xml @@ -0,0 +1,19 @@ + + + + + Tizen.WiFi.Manual.Tests.png + + + + http://tizen.org/privilege/network.get + http://tizen.org/privilege/network.set + http://tizen.org/privilege/network.profile + http://tizen.org/privilege/appmanager.launch + + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/Program.cs b/tct-suite-vs/Tizen.WiFi.Tests/Program.cs new file mode 100755 index 000000000..87d9f975a --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/Program.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using NUnitLite.TUnit; +using AutoTemplate; + +namespace XamarinForTizen.Tizen +{ + + class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication + { + private static App _app; + protected override void OnCreate() + { + base.OnCreate(); + + Console.WriteLine("TCT : OnCreate()"); + _app = new App(); + LoadApplication(_app); + + TRunner t = new TRunner(); + t.LoadTestsuite(); + t.Execute(); + } + + public static App getApp() + { + return _app; + } + static void Main(string[] args) + { + Console.WriteLine("TCT : Main()"); + var app = new Program(); + global::Xamarin.Forms.Platform.Tizen.Forms.Init(app); + app.Run(args); + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.csproj b/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.csproj new file mode 100755 index 000000000..1c4ad04fc --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.csproj @@ -0,0 +1,39 @@ + + + + + Exe + tizen60 + + + + + true + + + + portable + + + None + + + + + + + + + + + Runtime + + + + + + + + + + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.sln b/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.sln new file mode 100755 index 000000000..fe0275569 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/Tizen.WiFi.Tests.sln @@ -0,0 +1,78 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.15 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WiFi.Tests", "Tizen.WiFi.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU + {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU + {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU + {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU + {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680} + EndGlobalSection +EndGlobal diff --git a/tct-suite-vs/Tizen.WiFi.Tests/shared/res/Tizen.WiFi.Tests.png b/tct-suite-vs/Tizen.WiFi.Tests/shared/res/Tizen.WiFi.Tests.png new file mode 100755 index 000000000..9765b1bda Binary files /dev/null and b/tct-suite-vs/Tizen.WiFi.Tests/shared/res/Tizen.WiFi.Tests.png differ diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSConnectionStateChangedEventArgs.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSConnectionStateChangedEventArgs.cs new file mode 100755 index 000000000..09faff39e --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSConnectionStateChangedEventArgs.cs @@ -0,0 +1,149 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.ConnectionStateChangedEventArgs test")] + public class ConnectionStateChangedEventArgsTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + private void EventHandlerConnectionStateChangedCBState(object sender, ConnectionStateChangedEventArgs e) + { + if (e.State == WiFiManager.ConnectionState) + _flag = true; + } + + private void EventHandlerConnectionStateChangedCBAp(object sender, ConnectionStateChangedEventArgs e) + { + if (e.AP.NetworkInformation.Essid == networkParameter.wnPRIVATE) + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Test State property of ConnectionStateChangedEventArgs")] + [Property("SPEC", "Tizen.Network.WiFi.ConnectionStateChangedEventArgs.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task State_PROPERTY() + { + try + { + /* + * PRECONDITION + * Activate WiFi then connect to an AP. + */ + await setUp(); + Assert.IsFalse(_flag, "Flag should be fail before checking"); + + /* + * TEST CODE + */ + WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBState; + await Task.Delay(1500); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + Assert.IsTrue(_flag, "Flag should be true after checking"); + + /** + * POSTCONDITION + * */ + WiFiManager.ConnectionStateChanged -= EventHandlerConnectionStateChangedCBState; + // 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test Ap property of ConnectionStateChangedEventArgs")] + [Property("SPEC", "Tizen.Network.WiFi.ConnectionStateChangedEventArgs.AP A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task AP_PROPERTY() + { + try + { + /* + * PRECONDITION + * The first, connect to WiFi private1 + */ + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + } + await networkSetup.ForgetCurrentAP(); + + /* + * TEST CODE + * Then, connect to WiFi private2, changed WiFiApjk + */ + WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBAp; + await Task.Delay(1500); + await setUp(); + await Task.Delay(1500); + WiFiManager.ConnectionStateChanged -= EventHandlerConnectionStateChangedCBAp; + // 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()); + } + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSDeviceStateChangedEventArgs.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSDeviceStateChangedEventArgs.cs new file mode 100755 index 000000000..fec3bc6d4 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSDeviceStateChangedEventArgs.cs @@ -0,0 +1,92 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.DeviceStateChangedEventArgs test")] + public class DeviceStateChangedEventArgsTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Posconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + public async Task tearDown() + { + await networkSetup.DeactivateWiFi(); + } + + private void EventHandlerDeviceStateChangedCB(object sender, DeviceStateChangedEventArgs e) + { + Log.Info(Globals.LogTag, "Device state is changed: " + e.State); + if (e.State == WiFiDeviceState.Deactivated) + _flag = true; + } + + [Test] + [Category("P1")] + [Description("Test State property of DeviceStateChangedEventArgs")] + [Property("SPEC", "Tizen.Network.WiFi.DeviceStateChangedEventArgs.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task State_PROPERTY() + { + try + { + /* + * TEST CODE + */ + WiFiManager.DeviceStateChanged += EventHandlerDeviceStateChangedCB; + await Task.Delay(1500); + await tearDown(); + await Task.Delay(1500); + await setUp(); + await Task.Delay(1500); + Assert.IsTrue(_flag, "Flag should be true after checking"); + + WiFiManager.DeviceStateChanged -= EventHandlerDeviceStateChangedCB; + } + 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()); + } + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSRssiLevelChangedEventArgs.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSRssiLevelChangedEventArgs.cs new file mode 100755 index 000000000..98fe4f833 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSRssiLevelChangedEventArgs.cs @@ -0,0 +1,89 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.RssiLevelChangedEventArgs test")] + public class RssiLevelChangedEventArgsTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditional for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + private void EventHandlerRssiLevelChangedCB(object sender, RssiLevelChangedEventArgs e) + { + Log.Info(Globals.LogTag, "RSSI Level " + e.Level); + if (e.Level >= WiFiRssiLevel.Level0) + { + _flag = true; + } + } + + [Test] + [Category("P1")] + [Description("Test Level property of RssiLevelChangedEventArgs")] + [Property("SPEC", "Tizen.Network.WiFi.RssiLevelChangedEventArgs.Level A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Level_PROPERTY() + { + try + { + /* + * TEST CODE + */ + WiFiManager.RssiLevelChanged += EventHandlerRssiLevelChangedCB; + await Task.Delay(1500); + await networkSetup.ForgetCurrentAP(); + await Task.Delay(1500); + await setUp(); + Assert.IsTrue(_flag, "Flag should be true after checking"); + + WiFiManager.RssiLevelChanged -= EventHandlerRssiLevelChangedCB; + } + 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()); + } + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSScanStateChangedEventArgs.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSScanStateChangedEventArgs.cs new file mode 100755 index 000000000..153d8415d --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSScanStateChangedEventArgs.cs @@ -0,0 +1,88 @@ +using System; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.ScanStateChangedEventArgs test")] + public class ScanStateChangedEventArgsTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _flag = false; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditional for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + private void EventHandlerScanStateChangedCB(object sender, ScanStateChangedEventArgs State) + { + if (!_flag && (State.State == WiFiScanState.Scanning)) + { + _flag = true; + } + } + + [Test] + [Category("P1")] + [Description("Test State property of ScanStateChangedEventArgs")] + [Property("SPEC", "Tizen.Network.WiFi.ScanStateChangedEventArgs.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] + public async Task State_PROPERTY() + { + try + { + /* + * TEST CODE + */ + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + } + WiFiManager.ScanStateChanged += EventHandlerScanStateChangedCB; + await Task.Delay(1500); + await WiFiManager.ScanAsync(); + WiFiManager.ScanStateChanged -= EventHandlerScanStateChangedCB; + + Assert.IsTrue(_flag, "Flag should be true after checking"); + } + 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()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiAP.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiAP.cs new file mode 100755 index 000000000..59e33f3db --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiAP.cs @@ -0,0 +1,738 @@ +using System; +using NUnit.Framework; +using Tizen.Network.Connection; +using System.Net; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + /************************************************************************/ + // ** Scenario - Create/get/dispose an AP. + // ** + // ** create a public AP + // ** create a hidden AP + // ** connect to that AP + // ** get network information from that AP + // ** refesh AP + // ** + /************************************************************************/ + + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiAP Tests")] + public class WiFiAPTests + { + private string _essid = "WiFi_AP1"; + private string _essid_UTF8 = "안녕하세요"; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + [Test] + [Category("P1")] + [Description("Create a WiFi AP")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Ngo Van Hai, hai.nv3@samsung.com")] + [Property("COVPARAM", "string")] + public void WiFiAP_INIT() + { + WiFiAP _wifiAP = null; + try + { + _wifiAP = new WiFiAP(_essid); + Assert.AreEqual(_essid, _wifiAP.NetworkInformation.Essid, "WiFiAp init do not successfully, NetworkInformation.Essid should be not null"); + } + 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("P1")] + [Description("Create a WiFi AP")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + [Property("COVPARAM", "string")] + public void WiFiAP_INIT_UTF_8_NAME() + { + WiFiAP _wifiAP = null; + try + { + _wifiAP = new WiFiAP(_essid_UTF8); + Assert.AreEqual(_essid_UTF8, _wifiAP.NetworkInformation.Essid, "WiFiAp init do not successfully, NetworkInformation.Essid should be not null"); + } + 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("P1")] + [Description("Create a WiFi AP")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.WiFiAP C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + [Property("COVPARAM", "string, bool")] + public void WiFiAP_INIT_HIDDEN() + { + WiFiAP _wifiAP = null; + try + { + _wifiAP = new WiFiAP("WiFi_hidden", true); + Assert.IsNotNull(_wifiAP, "created object should be not null"); + } + 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("P1")] + [Description("Info of WiFi access point must to be refreshed after call REFRESH method")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.Refresh M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + [Property("MODIFIER", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task Refresh_REFRESH() + { + Log.Info(Globals.LogTag, "Start Refresh_REFRESH"); + WiFiAP _wifiAP = null; + try + { + /* Precondition + * Setup WiFi type public + * */ + await setUp(); + + /** + * TEST CODE + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + Log.Info(Globals.LogTag, "Connected AP: " + _wifiAP.NetworkInformation.Essid); + + var typeSecurity = _wifiAP.SecurityInformation.SecurityType; + _wifiAP.SecurityInformation.SecurityType = WiFiSecurityType.Wpa2Psk; + + _wifiAP.Refresh(); + } + 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("P1")] + [Description("Check a connection to a WiFi")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ConnectAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ConnectAsync_CONNECT_TO_AN_AP() + { + WiFiAP _wifiAP = null; + WiFiAP _wifiAP2 = null; + try + { + if (!WiFiManager.IsActive) + await WiFiManager.ActivateAsync(); + await networkSetup.ForgetCurrentAP(); + + await WiFiManager.ScanAsync(); + var list = WiFiManager.GetFoundAPs(); + Log.Info(Globals.LogTag, "Got found aps"); + foreach (var ap in list) + { + if (ap.NetworkInformation.Essid == networkParameter.wnPRIVATE) + { + _wifiAP = ap; + break; + } + } + Assert.IsNotNull(_wifiAP, "Can't create a WiFi ap"); + Log.Info(Globals.LogTag, "Try to Connect to " + _wifiAP.NetworkInformation.Essid.ToString()); + _wifiAP.SecurityInformation.SetPassphrase(networkParameter.wPASS); + await _wifiAP.ConnectAsync(); + _wifiAP2 = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP2, "No WiFi connection"); + Assert.AreEqual(_wifiAP.NetworkInformation.Essid.ToString(), _wifiAP2.NetworkInformation.Essid.ToString(), "Can't connect to a WiFi"); + + 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(); + } + if (_wifiAP2 != null) + { + _wifiAP2.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test: Disconnect to a WiFi, PASS if disconnect success otherwise Fail ")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.DisconnectAsync M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task DisconnectAsync_DISCONNECT_FROM_AP() + { + WiFiAP _wifiAP = null; + try + { + /** + * PRE CONDITION + * */ + await setUp(); + /** TEST CODE **/ + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not connected"); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "Failed to connect WiFi"); + await _wifiAP.DisconnectAsync(); + await Task.Delay(1500); + Assert.AreEqual(WiFiConnectionState.Disconnected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not disconnected"); + Log.Info(Globals.LogTag, "Successfully done"); + /** + * POST CONDITION + * */ + await _wifiAP.ConnectAsync(); + } + 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("P1")] + [Description("Test NetworkInformation property of WiFiAp")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.NetworkInformation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void NetworkInformation_PROPERTY() + { + WiFiAP _wifiAP = null; + try + { + var proxyAddress = "192.168.1.105"; + _wifiAP = new WiFiAP(_essid); + _wifiAP.NetworkInformation.ProxyType = WiFiProxyType.Manual; + _wifiAP.NetworkInformation.ProxyAddress = proxyAddress; + Assert.AreEqual((int)(WiFiProxyType.Manual), (int)(_wifiAP.NetworkInformation.ProxyType), "NetworkInformation.ProxyType doens't set and get successful"); + Assert.AreEqual(proxyAddress, _wifiAP.NetworkInformation.ProxyAddress, "NetworkInformation.ProxyAddress doens't set and get successful"); + } + 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("P1")] + [Description("Test SecurityInformation property of WiFiAp")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.SecurityInformation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void SecurityInformation_PROPERTY() + { + WiFiAP _wifiAP = null; + try + { + _wifiAP = new WiFiAP(_essid); + _wifiAP.SecurityInformation.EncryptionType = WiFiEncryptionType.Aes; + _wifiAP.SecurityInformation.SecurityType = WiFiSecurityType.Eap; + Assert.AreEqual((int)(WiFiEncryptionType.Aes), (int)(_wifiAP.SecurityInformation.EncryptionType), "SecurityInformation.EncryptionType doens't set and get successful"); + Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wifiAP.SecurityInformation.SecurityType), "SecurityInformation.SecurityType doens't set and get successful"); + } + 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("P1")] + [Description("Remove AP. Check some information and state of this access point.")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.ForgetAP M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ForgetAP_FORGET_AP() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wifiAP.ForgetAP(); + await Task.Delay(1500); + Assert.AreEqual((int)(WiFiConnectionState.Disconnected), (int)(WiFiManager.ConnectionState), "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("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 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(); + await Task.Delay(1500); + 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 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(); + 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 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 networkSetup.DeactivateWiFi(); + await _wifiAP.ForgetAPAsync(); + Assert.IsTrue(false, "InvalidOperationException should be thrown"); + + 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 (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", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task Update_UPDATE() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + Log.Info(Globals.LogTag, "Update_UPDATE start"); + await setUp(); + /* TEST CODE */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var ipv4Setting = _wiFiNetwork.IPv4Setting; + Assert.IsNotNull(ipv4Setting, "Ipv4Setting should be return not null"); + + var oldIP = ipv4Setting.IP.ToString(); + var ip = "192.168.192.23"; + + ipv4Setting.IPConfigType = IPConfigType.Static; + ipv4Setting.IP = IPAddress.Parse(ip); + + _wifiAP.Update(); + await Task.Delay(3000); + Assert.AreEqual(ip.ToString(), ipv4Setting.IP.ToString(), "Ip of Ipv4Setting get should be same set"); + Log.Info(Globals.LogTag, "Successfully done"); + + /* + * POSTCONDITION + */ + await networkSetup.ForgetCurrentAP(); + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Cancel the request to connect by WPS")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task CancelWps_CANCELWPS() + { + Log.Info(Globals.LogTag, "CancelWps_CANCELWPS"); + + try + { + WpsInfo info = new WpsPbcInfo(); + var task = WiFiAP.ConnectWpsWithoutSsidAsync(info); + await Task.Delay(5000); + WiFiAP.CancelWps(); + await Task.Delay(5000); + + Assert.IsTrue(task.IsCanceled, "ConnectWpsWithoutSsidAsync() isn't cancelled"); + + // 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()); + } + } + + [Test] + [Category("P2")] + [Description("Cancel WPS without the request to connect by WPS")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiAP.CancelWps M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task CancelWps_INVALID_OPERATION_EXCEPTION() + { + Log.Info(Globals.LogTag, "CancelWps_CANCELWPS"); + + try + { + WiFiAP.CancelWps(); + Assert.IsTrue(false, "InvalidOperationException must be thrown"); + + // Postcondition + await setUp(); + } + catch (InvalidOperationException ex) + { + Assert.IsTrue(true, "Exception occurs. Msg: " + ex.ToString()); + } + 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()); + } + } + + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiConfiguration.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiConfiguration.cs new file mode 100755 index 000000000..cb8d5dff9 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiConfiguration.cs @@ -0,0 +1,609 @@ +using System; +using NUnit.Framework; +using Tizen.Network.Connection; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Tizen.Network.WiFi.WiFiConfiguration Test class for managing the configuration of WiFi")] + public class WiFiConfigurationTests + { + private string _wants; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + _wants = null; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + _wants = networkParameter.wnPRIVATE; + } + + [Test] + [Category("P1")] + [Description("Test WiFiConfiguration method initialization")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WiFiConfiguration_INITIALIZE_SECURE_NONE() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /** + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + * */ + await setUp(); + + /** + * Test contructor + * Test 2 properties: Name + SecurityType + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); + Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); + Assert.AreEqual((int)(WiFiSecurityType.None), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test WiFiConfiguration method initialization")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WiFiConfiguration_INITIALIZE_SECURE_WEP() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test contructor + * Test 2 properties: Name + SecurityType + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Wep); + Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); + Assert.AreEqual((int)(WiFiSecurityType.Wep), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test WiFiConfiguration method initialization")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WiFiConfiguration_INITIALIZE_SECURE_WPAPSK() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test contructor + * Test 2 properties: Name + SecurityType + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.WpaPsk); + Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); + Assert.AreEqual((int)(WiFiSecurityType.WpaPsk), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test WiFiConfiguration method initialization")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WiFiConfiguration_INITIALIZE_SECURE_WPA2PSK() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test contructor + * Test 2 properties: Name + SecurityType + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Wpa2Psk); + Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); + Assert.AreEqual((int)(WiFiSecurityType.Wpa2Psk), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test WiFiConfiguration method initialization")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.WiFiConfiguration C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task WiFiConfiguration_INITIALIZE_SECURE_EAP() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test contructor + * Test 2 properties: Name + SecurityType + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); + Assert.AreEqual(_wants, _wiFiConfig.Name, "WiFiConfiguration initialize not success, _wants of _wiFiConfig not true"); + Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "WiFiConfiguration initialize not success,WiFiSecureType of _wiFiConfig not true"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property Name of WiFiConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.Name A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Name_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test property IsHidden + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); + Assert.AreEqual(_wants, _wiFiConfig.Name, "Name doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property SecurityType of WiFiConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.SecurityType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SecurityType_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test property IsHidden + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); + Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "SecurityType doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property IsHidden of WiFiConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.IsHidden A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IsHidden_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test property IsHidden + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); + Assert.False(_wiFiConfig.IsHidden, "IsHidden return true when doesn't hidden"); + _wiFiConfig.IsHidden = true; + Assert.True(_wiFiConfig.IsHidden, "IsHidden return false when does hidden"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property ProxyAddress of WiFiConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.ProxyAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ProxyAddress_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test property ProxyAddress + * */ + var proxyAddress = "192.168.1.105"; + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.None); + _wiFiConfig.ProxyAddress = proxyAddress; + Assert.AreEqual(proxyAddress, _wiFiConfig.ProxyAddress, "ProxyAddress doesn't set and get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property EapConfiguration of WiFiConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiConfiguration.EapConfiguration A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task EapConfiguration_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiConfiguration _wiFiConfig = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to an AP. + * 2. Get connected AP. + */ + await setUp(); + + /** + * Test property EapConfiguration + * */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); + _wiFiConfig.EapConfiguration.EapType = WiFiEapType.Peap; + Assert.AreEqual((int)(WiFiEapType.Peap), (int)(_wiFiConfig.EapConfiguration.EapType), "EapConfiguration doesn't set and get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEap.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEap.cs new file mode 100755 index 000000000..1a5439f7f --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEap.cs @@ -0,0 +1,492 @@ +using System; +using NUnit.Framework; +using Tizen.Network.Connection; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + /************************************************************************/ + // ** Scenario - get SECURITY info of an EAP. + // ** + // ** set/get certificate of EAP (a type of enterprise secure for an access point) + // ** set/get other secure info + // ** + // ** Step: + // ** connect to an EAP hotspot AP + // ** get secure networkInformation from that AP + // ** set/get and validate eapinformation + /************************************************************************/ + + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiEap Test class for managing the EAP information of access point(AP)")] + public class WiFiEapTests + { + private WiFiAP _wiFiAp = null; + private WiFiSecurity _wiFiSecurity = null; + private WiFiEap _wiFiEap = null; + private string _clientCertFile; + private string _userName; + private string _privateKeyFile; + private string _passWrd; + private string _wants; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + //Console.WriteLine("HYUKIN Postconditions for each TEST"); + //LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Postconditions for each TEST"); + if (_wiFiAp != null) + { + _wiFiAp = null; + } + if (_wiFiSecurity != null) + { + _wiFiSecurity = null; + } + if (_wiFiEap != null) + { + _wiFiEap = null; + } + } + + public void setUp() + { + //Console.WriteLine("HYUKIN Preconditions for each TEST"); + //LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Preconditions for each TEST"); + _wants = networkParameter.wnEAP; + _wiFiAp = new WiFiAP(_wants); + _wiFiSecurity = _wiFiAp.SecurityInformation; + _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; + _wiFiEap = _wiFiSecurity.EapInformation; + _clientCertFile = "/path/certFile"; + _userName = "WiFiEap"; + _passWrd = "abc12345"; + _privateKeyFile = "/path/key"; + } + + [Test] + [Category("P1")] + [Description("Test SetClientCertFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetClientCertFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void SetClientCertFile_SET_VALUE() + { + try + { + setUp(); + var clientCertFileDefault = _wiFiEap.GetClientCertFile(); + _wiFiEap.SetClientCertFile(_clientCertFile); + Assert.AreNotEqual(clientCertFileDefault, _wiFiEap.GetClientCertFile(), "ClientCertFile doesn't set successful"); + } + 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("P1")] + [Description("Test GetClientCertFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetClientCertFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void GetClientCertFile_GET_VALUE() + { + try + { + setUp(); + _wiFiEap.SetClientCertFile(_clientCertFile); + Assert.AreEqual(_clientCertFile, _wiFiEap.GetClientCertFile(), "ClientCertFile doesn't get properly"); + } + 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("P1")] + [Description("Test SetUserName")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetUserName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void SetUserName_SET_VALUE() + { + try + { + setUp(); + var userNameDefault = _wiFiEap.GetUserName(); + _wiFiEap.SetUserName(_userName); + _wiFiEap.SetPassword(_passWrd); + Assert.AreNotEqual(userNameDefault, _wiFiEap.GetUserName(), "Username doesn't set successful"); + Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Password is not set properly"); + } + 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("P1")] + [Description("Test SetPassword")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetPassword M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void SetPassword_SET_VALUE() + { + try + { + setUp(); + _wiFiEap.SetUserName(_userName); + _wiFiEap.SetPassword(_passWrd); + Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Password is not set properly"); + } + 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("P1")] + [Description("Test GetUserName")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetUserName M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void GetUserName_GET_VALUE() + { + try + { + setUp(); + _wiFiEap.SetUserName(_userName); + _wiFiEap.SetPassword(_passWrd); + Assert.AreEqual(_userName, _wiFiEap.GetUserName(), "EapUserName doesn't get properly"); + } + 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("P1")] + [Description("Test SetPrivateKeyFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.SetPrivateKeyFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void SetPrivateKeyFile_SET_VALUE() + { + try + { + setUp(); + var privateKeyDefault = _wiFiEap.GetPrivateKeyFile(); + _wiFiEap.SetPrivateKeyFile(_privateKeyFile, _passWrd); + Assert.AreNotEqual(privateKeyDefault, _wiFiEap.GetPrivateKeyFile(), "PrivateKeyInfo doesn't set succesful"); + } + 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("P1")] + [Description("Test GetPrivateKeyFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.GetPrivateKeyFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void GetPrivateKeyFile_GET_VALUE() + { + try + { + setUp(); + _wiFiEap.SetPrivateKeyFile(_privateKeyFile, _passWrd); + Assert.AreEqual(_privateKeyFile, _wiFiEap.GetPrivateKeyFile(), "PrivateKeyInfo doesn't get properly"); + } + 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("P1")] + [Description("Test IsPasswordSet")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.IsPasswordSet M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void IsPasswordSet_RETURN() + { + try + { + setUp(); + var user = "asavin"; + var passwordPhrase = ""; + _wiFiEap.SetUserName(user); + _wiFiEap.SetPassword(passwordPhrase); + Assert.IsFalse(_wiFiEap.IsPasswordSet(), "Return true when don't set password"); + passwordPhrase = "a1b2c3d4e5"; + _wiFiEap.SetUserName(user); + _wiFiEap.SetPassword(passwordPhrase); + Assert.IsTrue(_wiFiEap.IsPasswordSet(), "Return false when set password"); + } + 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("P1")] + [Description("Test EapType property of WiFiEap")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.EapType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void EapType_PROPERTY() + { + try + { + setUp(); + _wiFiEap.EapType = WiFiEapType.Aka; + Assert.AreEqual((int)(WiFiEapType.Aka), (int)(_wiFiEap.EapType), "EapType doesn't set and get successful"); + } + 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("P1")] + [Description("Test AuthenticationType property of WiFiEap")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.AuthenticationType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void AuthenticationType_PROPERTY() + { + try + { + setUp(); + _wiFiEap.AuthenticationType = WiFiAuthenticationType.Pap; + Assert.AreEqual((int)(WiFiAuthenticationType.Pap), (int)(_wiFiEap.AuthenticationType), "AuthenticationType doesn't set and get successful"); + } + 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("P1")] + [Description("Test CaCertificationFile property of WiFiEap")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEap.CaCertificationFile A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public void CaCertificationFile_PROPERTY() + { + try + { + setUp(); + var caCertification = "certification"; + _wiFiEap.CaCertificationFile = caCertification; + Assert.AreEqual(caCertification, _wiFiEap.CaCertificationFile, "CaCertificationFile doesn't set and get successful"); + } + 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(); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEapConfiguration.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEapConfiguration.cs new file mode 100755 index 000000000..62fea2460 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiEapConfiguration.cs @@ -0,0 +1,451 @@ +using System; +using NUnit.Framework; +using Tizen.Network.Connection; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + /* ***********************************************************************/ + // ** Scenario - get SECURITY info of an EAP. + // ** + // ** set/get certificate of EAP (a type of enterprise secure for an access point) + // ** + /* ***********************************************************************/ + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiEapConfiguration Test class for managing the EAP configuration")] + class WiFiEapConfigurationTests + { + + private WiFiConfiguration _wiFiConfig = null; + private WiFiAP _wifiAP = null; + private WiFiEapConfiguration _wiFiEapConfig = null; + private string _privateKey; + private string _clientCert; + private string _wants; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + _wants = networkParameter.wnPRIVATE; + _privateKey = "privatekey"; + _clientCert = "clientcert"; + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + _wifiAP = null; + _wiFiConfig = null; + _wiFiEapConfig = null; + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(_wants, networkParameter.wType.wPrivate, networkParameter.wPASS); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap); + Assert.AreEqual(_wants, _wiFiConfig.Name, "Initialize WiFiConfiguration not successfully, Name of WiFiConfiguration is not true"); + Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiConfig.SecurityType), "Initialize WiFiConfiguration not successfully, WiFiSecureType of WiFiConfiguration is not true"); + } + + [Test] + [Category("P1")] + [Description("Test SetClientCertFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.SetClientCertFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SetClientCertFile_SET_VALUE() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test code + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + var clientCertDefault = _wiFiEapConfig.GetClientCertFile(); + _wiFiEapConfig.SetClientCertFile(_privateKey, _clientCert); + Assert.AreNotEqual(clientCertDefault, _wiFiEapConfig.GetClientCertFile(), "ClientCertFile doesn't set successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test GetClientCertFile")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.GetClientCertFile M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task GetClientCertFile_GET_VALUE() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test code + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + _wiFiEapConfig.SetClientCertFile(_privateKey, _clientCert); + Assert.AreEqual(_clientCert, _wiFiEapConfig.GetClientCertFile(), "ClientCertFile doesn't get properly"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property AnonymousIdentify of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.AnonymousIdentify A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task AnonymousIdentify_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test property AnonymousIdentify + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + var anonymousIdentify = "anonymous"; + _wiFiEapConfig.AnonymousIdentify = anonymousIdentify; + Assert.AreEqual(_wiFiEapConfig.AnonymousIdentify, anonymousIdentify, "AnonymousIdentify doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property AuthenticationType of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.AuthenticationType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task AuthenticationType_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test properties + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + _wiFiEapConfig.AuthenticationType = WiFiAuthenticationType.Gtc; + Assert.AreEqual((int)(_wiFiEapConfig.AuthenticationType), (int)(WiFiAuthenticationType.Gtc), "AuthenticationType doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property CaCertificationFile of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.CaCertificationFile A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task CaCertificationFile_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test properties + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + var caCertificationFile = "cacertification"; + _wiFiEapConfig.CaCertificationFile = caCertificationFile; + Assert.AreEqual(_wiFiEapConfig.CaCertificationFile, caCertificationFile, "CaCertificationFile doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property EapType of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.EapType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task EapType_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test properties + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + _wiFiEapConfig.EapType = WiFiEapType.Peap; + Assert.AreEqual((int)(_wiFiEapConfig.EapType), (int)(WiFiEapType.Peap), "EapType doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property Identity of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.Identity A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Identity_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test properties + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + var identity = "identity"; + _wiFiEapConfig.Identity = identity; + Assert.AreEqual(_wiFiEapConfig.Identity, identity, "Identity doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("Test property SubjectMatch of WiFiEapConfiguration")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiEapConfiguration.SubjectMatch A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SubjectMatch_PROPERTY() + { + try + { + /** Precondition + * Settup WiFi type WiFiEap + * */ + await setUp(); + + /** + * Test properties + * */ + _wiFiEapConfig = _wiFiConfig.EapConfiguration; + var subjectMatch = "subjectmatch"; + _wiFiEapConfig.SubjectMatch = subjectMatch; + Assert.AreEqual(_wiFiEapConfig.SubjectMatch, subjectMatch, "SubjectMatch doesn't set and get successfully"); + } + 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(); + } + if (_wiFiConfig != null) + { + _wiFiConfig.Dispose(); + } + } + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiManager.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiManager.cs new file mode 100755 index 000000000..15c272ef6 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiManager.cs @@ -0,0 +1,1059 @@ +using System; +using NUnit.Framework; +using System.Threading.Tasks; +using networkUtils; +using Tizen.System; +using System.Threading; + +namespace Tizen.Network.WiFi.Tests +{ + /************************************************************************/ + // ** Class WiFiManagertest1 + // ** Scenario - Manage/Scan/Connect/Disconnect all available APs. + // ** + // ** connect to an AP before run this class: example: "WiFi_public" + // ** setUp 2 APs: name/securetype as + // ** "WiFi_hidden"/Wpa2Psk/isHidden true + // ** + // ** Test: + // ** get found APs ; scan/get specific AP; get WiFiConfig; save WiFiConfig (hidden)/get WiFiConfig + // ** deActivate; disconnect; removeAp + // ** + // ** Note: related to async method, if some TC fail --> please increase waiting time: using Thread.Sleep(time) + // ** + /************************************************************************/ + [TestFixture] + [Description("Tizen.Network.WiFiManager Tests")] + public class WiFiManagerTests + { + private bool _flag; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + _flag = false; + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + await Task.Delay(1500); + } + + public async Task tearDown() + { + await networkSetup.DeactivateWiFi(); + await Task.Delay(1500); + } + + public void EventHandlerRssi(object sender, RssiLevelChangedEventArgs Rssi) + { + var wiFiRssiLevel = WiFiRssiLevel.Level0; + if (Rssi.Level != wiFiRssiLevel) + _flag = true; + wiFiRssiLevel = Rssi.Level; + } + + public void EventHandlerDevice(object sender, DeviceStateChangedEventArgs Event) + { + if (Event.State == WiFiDeviceState.Activated) + _flag = true; + } + + [Test] + [Category("P1")] + [Description("A task indicates whether the Activate WiFi")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ActivateAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ActivateAsync_OPEN_WiFi() + { + try + { + /** + * PRE CONDITION + * turn off WiFi + * */ + if (WiFiManager.IsActive) + await tearDown(); + + /** TEST CODE */ + await WiFiManager.ActivateAsync(); + Assert.IsTrue(WiFiManager.IsActive, "WiFi is off"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("check indicates whether the ActivateWithPickerAsync method is done or not")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ActivateWithPickerAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task ActivateWithPickerAsync_OPEN() + { + try + { + /** + * PRE CONDITION + * turn off WiFi + * */ + if (WiFiManager.IsActive) + await tearDown(); + + /** TEST CODE */ + await WiFiManager.ActivateWithPickerAsync(); + Assert.IsTrue(WiFiManager.IsActive, "WiFi is off"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: deactive a WiFi ")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.DeactivateAsync M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task DeactivateAsync_DEACTIVE_WIFI() + { + try + { + /** + * PRE CONDITION + * */ + await setUp(); + + /** TEST CODE **/ + Assert.IsTrue(WiFiManager.IsActive, "WiFi doesn't turn on"); + WiFiAP ap = WiFiManager.GetConnectedAP(); + await networkSetup.ForgetCurrentAP(); + await WiFiManager.DeactivateAsync(); + Assert.IsFalse(WiFiManager.IsActive, "WiFi doesn't turn off"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets the handle of the connected access point.")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetConnectedAP M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetConnectedAP_GET_CURRENT_AP() + { + try + { + /** + * PRE CONDITION + * */ + await setUp(); + + /** TEST CODE **/ + var connection = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(connection, "No WiFi connection"); + Assert.AreEqual(networkParameter.wnPRIVATE, connection.NetworkInformation.Essid.ToString(), "GetConnectedAp is fail"); + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), connection.NetworkInformation.ConnectionState.ToString(), "GetConnectedAp is fail"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets the result of the scan asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundAPs M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetFoundAPs_SCAN_AND_GET_ALL_AP() + { + try + { + /** + * PRE CONDITION + * turn off WiFi + * */ + if (!WiFiManager.IsActive) + await WiFiManager.ActivateAsync(); + + /** TEST CODE **/ + var count = 0; + await WiFiManager.ScanAsync(); + var listApp = WiFiManager.GetFoundAPs(); + foreach (var item in listApp) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "GetFoundAps is fail"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets the result of the scan asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundSpecificAPs M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetFoundSpecificAPs_GET_A_CERTAIN_AP() + { + try + { + /** TEST CODE **/ + var count = 0; + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + } + await WiFiManager.ScanSpecificAPAsync(networkParameter.wnPRIVATE); + var listApp = WiFiManager.GetFoundSpecificAPs(); + await Task.Delay(1500); + foreach (var item in listApp) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "GetFoundSpecificAps is fail"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets the result of the scan asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetWiFiConfigurations M ")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task GetWiFiConfigurations_GETlist_OF_WIFI_CONFIG() + { + try + { + /** + * PRE CONDITION + * */ + await setUp(); + + /** TEST CODE **/ + var count = 0; + var listConfig = WiFiManager.GetWiFiConfigurations(); + foreach (var item in listConfig) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "GetWiFiConfigurations is fail"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P3")] + [Description("Saves Wi-Fi configuration of access point . Then gets the list of WiFi configuration. Check access point be saved")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.SaveWiFiConfiguration M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task SaveWiFiConfiguration_SAVE_GET() + { + WiFiConfiguration _wiFiConfiguration = null; + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiConfiguration = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, _wifiAP.SecurityInformation.SecurityType); + var proxyAddress = _wiFiConfiguration.ProxyAddress; + _wiFiConfiguration.ProxyAddress = "192.168.1.105"; + _wiFiConfiguration.IsHidden = true; + Assert.AreNotEqual(proxyAddress, _wiFiConfiguration.ProxyAddress, "Proxyaddress fail"); + WiFiManager.SaveWiFiConfiguration(_wiFiConfiguration); + var list = WiFiManager.GetWiFiConfigurations(); + WiFiConfiguration _WiFiConfiguration = null; + foreach (var _itemWiFiAp in list) + { + if (_itemWiFiAp.Name.Contains(networkParameter.wnPRIVATE)) + { + _WiFiConfiguration = _itemWiFiAp; + break; + } + _itemWiFiAp.Dispose(); + } + Assert.IsNotNull(_WiFiConfiguration, "No WiFi Configuration"); + Assert.AreEqual(_wiFiConfiguration.ProxyAddress, _WiFiConfiguration.ProxyAddress, "GetWiFiConfigurations is fail"); + Assert.True(_WiFiConfiguration.IsHidden, "GetWiFiConfigurations is fail"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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 (_wiFiConfiguration != null) + { + _wiFiConfiguration.Dispose(); + } + if (_wifiAP != null) + { + _wifiAP.Dispose(); + } + } + } + + [Test] + [Category("P1")] + [Description("DeviceStateChanged is raised when the device state is changed")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.DeviceStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task DeviceStateChanged_CHECK_CB() + { + try + { + WiFiManager.DeviceStateChanged += EventHandlerDevice; + await Task.Delay(1500); + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + await Task.Delay(1500); + await tearDown(); + await Task.Delay(1500); + Assert.True(_flag, "Event DeviceStateChanged hasn't been call."); + } + else + { + await networkSetup.ForgetCurrentAP(); + await WiFiManager.DeactivateAsync(); + await Task.Delay(1500); + await WiFiManager.ActivateAsync(); + await Task.Delay(1500); + Assert.True(_flag, "Event DeviceStateChanged hasn't been call."); + } + WiFiManager.DeviceStateChanged -= EventHandlerDevice; + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("RssiLevelChanged is rasied when the RSSI of connected Wi-Fi is changed")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.RssiLevelChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task RssiLevelChanged_CHECK_CB() + { + try + { + /* + * TEST CODE + */ + WiFiManager.RssiLevelChanged += EventHandlerRssi; + await Task.Delay(1500); + if (WiFiManager.IsActive) + { + Log.Info(Globals.LogTag, "WiFi is activated"); + await networkSetup.ForgetCurrentAP(); + } + await setUp(); + Assert.True(_flag, "Event RssiLevelChanged hasn't been call."); + WiFiManager.RssiLevelChanged -= EventHandlerRssi; + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test ConnectionState property")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ConnectionState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ConnectionState_PROPERTY() + { + try + { + /* + * PRECONDITION + */ + await setUp(); + + /** TEST CODE */ + Assert.AreEqual((int)(WiFiConnectionState.Connected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return connected after connect to WiFiAp"); + await networkSetup.ForgetCurrentAP(); + Assert.AreEqual((int)(WiFiConnectionState.Disconnected), (int)(WiFiManager.ConnectionState), "ConnectionState didn't return disconnected after discnnect"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test IsActivated property")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.IsActive A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IsActive_PROPERTY() + { + try + { + /** TEST CODE */ + await setUp(); + Assert.True(WiFiManager.IsActive, "IsActivated return false after connected"); + await tearDown(); + Assert.False(WiFiManager.IsActive, "IsActivated return true after disconnected"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test InterfaceName property")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.InterfaceName A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task InterfaceName_PROPERTY() + { + try + { + /* + * PRECONDITION + */ + await setUp(); + Assert.IsInstanceOf(WiFiManager.InterfaceName); + Assert.IsNotNull(WiFiManager.InterfaceName, "After connect to an AP. InterfaceName should be not null."); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test MacAddress property")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.MacAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task MacAddress_PROPERTY() + { + try + { + /* + * PRECONDITION + */ + await setUp(); + + /** TEST CODE */ + Assert.IsInstanceOf(WiFiManager.MacAddress); + Assert.IsNotNull(WiFiManager.MacAddress, "After connect to an AP. MacAddress should be not null."); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("starts scan asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ScanAsync_SCAN() + { + try + { + /* + * PRECONDITION + */ + await setUp(); + + /* + * TEST CODE + */ + var count = 0; + await WiFiManager.ScanAsync(); + var listAp = WiFiManager.GetFoundAPs(); + foreach (var item in listAp) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "ScanAsync can't scan WiFiAp"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("starts specific ap scan, asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanSpecificAPAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ScanSpecificAPAsync_SCAN() + { + try + { + /* + * PRECONDITION + */ + await setUp(); + + /* + * TEST CODE + */ + var count = 0; + await WiFiManager.ScanSpecificAPAsync(networkParameter.wnPRIVATE1); + var listAp = WiFiManager.GetFoundSpecificAPs(); + foreach (var item in listAp) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "ScanSpecificApAsync can't scan WiFi private"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("starts specific ap scan, asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanSpecificAPAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Nguyen Thao, nguyen.tthao@samsung.com")] + public async Task ScanSpecificAPAsync_SCAN_HIDDEN_AP() + { + try + { + /* + * PRECONDITION + * Activate WiFi then connect to an AP. + */ + await setUp(); + + /* + * TEST CODE + * Scan all HIDDEN APs which have name containing a given certain phrase. + */ + var count = 0; + await WiFiManager.ScanSpecificAPAsync(networkParameter.wnHIDDEN); + var listAp = WiFiManager.GetFoundSpecificAPs(); + foreach (var item in listAp) + { + count++; + item.Dispose(); + } + Assert.Greater(count, 0, "ScanSpecificApAsync can't scan WiFi HIDDEN"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test ConnectionStateChanged event of WiFiManager")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ConnectionStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ConnectionStateChanged_CHECK_CB() + { + try + { + /* + * PRECONDITION + */ + if (WiFiManager.IsActive) + await networkSetup.ForgetCurrentAP(); + Assert.IsFalse(_flag, "Flag should be fail before checking"); + + /* + * TEST CODE + */ + EventHandler connectionStateChanged = (s, e) => + { + _flag = true; + }; + WiFiManager.ConnectionStateChanged += connectionStateChanged; + await Task.Delay(1500); + await setUp(); + await Task.Delay(1500); + Assert.IsTrue(_flag, "Flag should be true after checking"); + + WiFiManager.ConnectionStateChanged -= connectionStateChanged; + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test BackgroundScanFinished event of WiFiManager")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.BackgroundScanFinished E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Cheoleun Moon chleun.moon@samsung.com")] + public async Task BackgroundScanFinished_CHECK_CB_EVENT() + { + try + { + CancellationTokenSource tSource = new CancellationTokenSource(); + EventHandler backgroundScanFinished = (s, e) => + { + _flag = true; + tSource.Cancel(); + }; + + WiFiManager.BackgroundScanFinished += backgroundScanFinished; + await Task.Delay(1500); + await setUp(); + WiFiAP ap = WiFiManager.GetConnectedAP(); + ap.ForgetAP(); + + await Task.Delay(TimeSpan.FromSeconds(200), tSource.Token).ContinueWith(tsk => {}); + tSource.Dispose(); + WiFiManager.BackgroundScanFinished -= backgroundScanFinished; + + Assert.IsTrue(_flag, "No BackgroundScan"); + + 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()); + } + } + + [Test] + [Category("P1")] + [Description("starts BSSID scan asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.BssidScanAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task BssidScanAsync_BSSIDSCAN() + { + try + { + await setUp(); + + var count = 0; + await WiFiManager.BssidScanAsync(); + var listAp = WiFiManager.GetFoundBssids(); + foreach (var item in listAp) + count++; + Assert.Greater(count, 0, "BssidScanAsync can't scan any WiFiAp"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test: Gets the result of the BssidScanAsync asynchronously")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.GetFoundBssids M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetFoundBssids_BSSIDSCAN_AND_GET_ALL_AP() + { + try + { + await setUp(); + + var count = 0; + await WiFiManager.BssidScanAsync(); + var listAp = WiFiManager.GetFoundBssids(); + foreach (var item in listAp) + count++; + Assert.Greater(count, 0, "GetFoundBssids fail"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + public void EventHandlerScanState(object sender, ScanStateChangedEventArgs State) + { + if (State.State == WiFiScanState.Scanning) + _flag = true; + } + + + [Test] + [Category("P1")] + [Description("Test ScanStateChanged event of WiFiManager")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] + public async Task ScanStateChanged_CHECK_CB_EVENT() + { + try + { + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + } + WiFiManager.ScanStateChanged += EventHandlerScanState; + await Task.Delay(1500); + await WiFiManager.ScanAsync(); + await Task.Delay(1500); + WiFiManager.ScanStateChanged -= EventHandlerScanState; + Assert.IsTrue(_flag, "ScanState is not changed."); + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test ScanState property")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiManager.ScanState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Seonah Moon, seonah1.moon@samsung.com")] + public async Task ScanState_PROPERTY() + { + try + { + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + await Task.Delay(3000); + } + Assert.AreEqual(WiFiScanState.NotScanning, WiFiManager.ScanState, "ScanState didn't return NotScanning"); + Log.Info(Globals.LogTag, "Successfully done"); + } + 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()); + } + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiNetwork.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiNetwork.cs new file mode 100755 index 000000000..076eb9d2f --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiNetwork.cs @@ -0,0 +1,976 @@ +using System; +using System.Text; +using Tizen.Network.Connection; +using System.Threading.Tasks; +using networkUtils; +using NUnit.Framework; +using System.Net; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiNetwork Tests")] + public class WiFiNetworkTests + { + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Console.WriteLine("Preconditions for each TESTCASE"); + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + Console.WriteLine("Postconditions for each TESTCASE"); + } + + public async Task setUp() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + [Test] + [Category("P1")] + [Description("Test Essid property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Essid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Essid_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var essid = _wiFiNetwork.Essid; + Assert.AreEqual(networkParameter.wnPRIVATE, essid, "Essid doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test RawSsid property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.RawSsid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun, chleun.moon@samsung.com")] + public async Task RawSsid_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var rawSsid = _wiFiNetwork.RawSsid; + string ssid = Encoding.UTF8.GetString(rawSsid); + Log.Info(Globals.LogTag, "Converted SSID: " + ssid); + Assert.AreEqual(networkParameter.wnPRIVATE, ssid, "Invalid RawSsid"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test Bssid property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Bssid A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Bssid_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var bssid = _wiFiNetwork.Bssid; + Assert.IsNotNull(bssid, "Bssid doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Get all BSSIDs of a WiFiAp")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.GetBssids M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetBssids_GET() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Get connect AP + */ + Log.Info(Globals.LogTag, "GetBssids_GET start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + + /* TEST CODE */ + var list = _wifiAP.NetworkInformation.GetBssids(); + Assert.IsNotNull(list, "GetBssids fails"); + } + 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("P1")] + [Description("Test CountryCode property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.CountryCode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task CountryCode_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var code = _wiFiNetwork.CountryCode; + + /* + * The country code can be NULL if AP or M/W do not have the country code. + * Therefore, we check only if there is no exception when CountryCode is accessed. + */ + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test ConnectionState property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ConnectionState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ConnectionState_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + Assert.AreEqual((int)(WiFiConnectionState.Connected), (int)(_wiFiNetwork.ConnectionState), "ConnectionState doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test Frequency property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Frequency A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Frequency_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var frequency = _wiFiNetwork.Frequency; + Assert.Greater(frequency, 0, "Frequency doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test IsFavorite property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IsFavorite A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IsFavorite_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + Assert.IsTrue(_wiFiNetwork.IsFavorite, "IsFavorite doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test IsPasspoint property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IsPasspoint A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IsPasspoint_PROPERTY() + { + Log.Info(Globals.LogTag, "Start IsPasspoint_PROPERTY"); + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + Assert.IsInstanceOf(_wiFiNetwork.IsPasspoint, "IsPasspoint is not bool"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test MaxSpeed property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.MaxSpeed A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task MaxSpeed_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var maxSpeed = _wiFiNetwork.MaxSpeed; + Assert.Greater(maxSpeed, 0, "MaxSpeed doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test Rssi property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.Rssi A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task Rssi_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + * Get Rssi of WiFi + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var rssi = _wiFiNetwork.Rssi; + Assert.IsInstanceOf(rssi, "Rssi doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test RssiLevel property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.RssiLevel A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task RssiLevel_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + * Get RssiLevel of WiFi + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var rssiLevel = _wiFiNetwork.RssiLevel; + Assert.IsInstanceOf(rssiLevel, "RssiLevel doesn't get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test ProxyAddress property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ProxyAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ProxyAddress_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + var proxyAddress = "192.168.1.109"; + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + _wiFiNetwork.ProxyAddress = proxyAddress; + _wifiAP.Update(); + + Assert.AreEqual(proxyAddress, _wiFiNetwork.ProxyAddress, "ProxyAddress doesn't set and get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test ProxyType property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.ProxyType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task ProxyType_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + _wiFiNetwork.ProxyType = WiFiProxyType.Manual; + _wifiAP.Update(); + + Assert.AreEqual((int)WiFiProxyType.Manual, (int)(_wiFiNetwork.ProxyType), "ProxyType doesn't set and get successful"); + + Log.Info(Globals.LogTag, "Successfully done"); + } + 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("P1")] + [Description("Test Ipv4Setting property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IPv4Setting A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IPv4Setting_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var ipv4Setting = _wiFiNetwork.IPv4Setting; + Assert.IsNotNull(ipv4Setting, "Ipv4Setting should be return not null"); + var ip = "192.168.192.23"; + var subnet = "255.255.255.0"; + var gateway = "192.168.192.1"; + var dns1 = "8.8.8.8"; + var dns2 = "8.8.4.4"; + ipv4Setting.IPConfigType = IPConfigType.Static; + ipv4Setting.IP = IPAddress.Parse(ip); + ipv4Setting.SubnetMask = IPAddress.Parse(subnet); + ipv4Setting.Gateway = IPAddress.Parse(gateway); + ipv4Setting.DnsConfigType = DnsConfigType.Static; + ipv4Setting.Dns1 = IPAddress.Parse(dns1); + ipv4Setting.Dns2 = IPAddress.Parse(dns2); + _wifiAP.Update(); + await Task.Delay(3000); + + Assert.AreEqual(ip.ToString(), ipv4Setting.IP.ToString(), "Ip of Ipv4Setting get should be same set"); + Assert.AreEqual(gateway.ToString(), ipv4Setting.Gateway.ToString(), "Gateway of Ipv4Setting get should be same set"); + Assert.AreEqual(subnet.ToString(), ipv4Setting.SubnetMask.ToString(), "SubnetMask of Ipv4Setting get should be same set"); + Assert.AreEqual(dns1.ToString(), ipv4Setting.Dns1.ToString(), "Dns1 of Ipv4Setting get should be same set"); + Assert.AreEqual(dns2.ToString(), ipv4Setting.Dns2.ToString(), "Dns2 of Ipv4Setting get should be same set"); + Assert.AreEqual((int)(IPConfigType.Static), (int)(ipv4Setting.IPConfigType), "IpConfigType of Ipv4Setting get should be same set"); + + Log.Info(Globals.LogTag, "Successfully done"); + + await _wifiAP.ForgetAPAsync(); + await setUp(); + Log.Info(Globals.LogTag, "Finished"); + } + 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("P1")] + [Description("Test Ipv6Setting property of WiFiNetwork")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.IPv6Setting A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nhu Anh, anh.vn@samsung.com")] + public async Task IPv6Setting_PROPERTY() + { + WiFiAP _wifiAP = null; + WiFiNetwork _wiFiNetwork = null; + try + { + /* + * PRECONDITION + * Activate WiFi then get WiFi connected + * Create a WiFiNetwork object + */ + await setUp(); + + /* + * TEST CODE + */ + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + _wiFiNetwork = _wifiAP.NetworkInformation; + var ipv6Setting = _wiFiNetwork.IPv6Setting; + Assert.IsNotNull(ipv6Setting, "Ipv6Setting should be return not null"); + var ip = "fe80::202:b3ff:fe1e:8329"; + ipv6Setting.IPConfigType = IPConfigType.Static; + ipv6Setting.IP = IPAddress.Parse(ip); + _wifiAP.Update(); + + bool found = false; + + var IPList = _wiFiNetwork.GetAllIPv6Addresses(); + foreach(IPAddress item in IPList) + { + Log.Info(Globals.LogTag, "IPv6 Address: " + item.ToString()); + if (item.ToString().Equals(ip)) + { + found = true; + break; + } + } + Assert.AreEqual((int)(IPConfigType.Static), (int)(ipv6Setting.IPConfigType), "IpConfigType of Ipv6Setting get should be same set"); + Assert.IsTrue(found, "Can't find IPv6 "); + + Log.Info(Globals.LogTag, "Successfully done"); + + await _wifiAP.ForgetAPAsync(); + await setUp(); + Log.Info(Globals.LogTag, "Finished"); + } + 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("P1")] + [Description("Get all IPv6 addresses of device: dynamic")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiNetwork.GetAllIPv6Addresses M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public async Task GetAllIPv6Addresses_GET() + { + WiFiAP _wifiAP = null; + try + { + /* + * PRECONDITION + * 1. Activate WiFi then connect to a AP. + * 2. Get connect AP + */ + Log.Info(Globals.LogTag, "GetAllIPv6Addresses_ALL_TYPE start"); + await setUp(); + _wifiAP = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wifiAP, "No WiFi connection"); + + /* TEST CODE */ + var list = _wifiAP.NetworkInformation.GetAllIPv6Addresses(); + Assert.IsNotNull(list, "GetAllIPv6Address fails"); + } + 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(); + } + } + } + + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiSecurity.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiSecurity.cs new file mode 100755 index 000000000..9511e32cd --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWiFiSecurity.cs @@ -0,0 +1,367 @@ +using NUnit.Framework; +using System; +using Tizen.Network.Connection; +using networkUtils; +using System.Threading.Tasks; +using Tizen.System; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WiFiSecurity Tests")] + public class WiFiSecurityTests + { + private WiFiSecurity _wiFiSecurity; + private string _wiFiName; + private WiFiEncryptionType _wiFiEncryptionType; + private WiFiSecurityType _wiFiSecuType; + bool isWiFiSupported = false; + + [OneTimeSetUp] + public void InitFixture() + { + networkParameter.SetPrecondition(); + } + + [SetUp] + public void Init() + { + Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported); + } + + [TearDown] + public void Destroy() + { + _wiFiSecurity = null; + _wiFiName = null; + } + + public void init() + { + _wiFiName = networkParameter.wnPRIVATE; + } + + public async Task setup() + { + await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS); + } + + [Test] + [Category("P1")] + [Description("Test EncryptionType")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.EncryptionType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] + public void EncryptionType_SET_GET() + { + WiFiAP _wiFiAp = null; + try + { + init(); + /** + * PRECONDITION: + * - Creat an SecurityInformation. + */ + _wiFiAp = new WiFiAP(_wiFiName); + _wiFiSecurity = _wiFiAp.SecurityInformation; + + /* TEST CODE */ + /* Aes */ + _wiFiSecurity.EncryptionType = WiFiEncryptionType.Aes; + _wiFiEncryptionType = _wiFiSecurity.EncryptionType; + Assert.AreEqual((int)(WiFiEncryptionType.Aes), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Aes."); + /* None */ + _wiFiSecurity.EncryptionType = WiFiEncryptionType.None; + _wiFiEncryptionType = _wiFiSecurity.EncryptionType; + Assert.AreEqual((int)(WiFiEncryptionType.None), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is None."); + + /* Tkip */ + _wiFiSecurity.EncryptionType = WiFiEncryptionType.Tkip; + _wiFiEncryptionType = _wiFiSecurity.EncryptionType; + Assert.AreEqual((int)(WiFiEncryptionType.Tkip), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Tkip."); + + /* TkipAesMixed */ + _wiFiSecurity.EncryptionType = WiFiEncryptionType.TkipAesMixed; + _wiFiEncryptionType = _wiFiSecurity.EncryptionType; + Assert.AreEqual((int)(WiFiEncryptionType.TkipAesMixed), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is TkipAesMixed."); + + /* Wep */ + _wiFiSecurity.EncryptionType = WiFiEncryptionType.Wep; + _wiFiEncryptionType = _wiFiSecurity.EncryptionType; + Assert.AreEqual((int)(WiFiEncryptionType.Wep), (int)(_wiFiEncryptionType), "EncryptionType has gotten should be is Wep."); + } + 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("P1")] + [Description("Test SecurityType")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.SecurityType A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] + public void SecurityType_SET_GET() + { + WiFiAP _wiFiAp = null; + try + { + init(); + /** + * PRECONDITION: + * - Creat an SecurityInformation. + */ + _wiFiAp = new WiFiAP(_wiFiName); + _wiFiSecurity = _wiFiAp.SecurityInformation; + + /* TEST CODE */ + /* Eap */ + _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; + _wiFiSecuType = _wiFiSecurity.SecurityType; + Assert.AreEqual((int)(WiFiSecurityType.Eap), (int)(_wiFiSecuType), "SecurityType has gotten should be is Eap."); + /* None */ + _wiFiSecurity.SecurityType = WiFiSecurityType.None; + _wiFiSecuType = _wiFiSecurity.SecurityType; + Assert.AreEqual((int)(WiFiSecurityType.None), (int)(_wiFiSecuType), "SecurityType has gotten should be is None."); + /* Wep */ + _wiFiSecurity.SecurityType = WiFiSecurityType.Wep; + _wiFiSecuType = _wiFiSecurity.SecurityType; + Assert.AreEqual((int)(WiFiSecurityType.Wep), (int)(_wiFiSecuType), "SecurityType has gotten should be is Wep."); + /* Wpa2Psk */ + _wiFiSecurity.SecurityType = WiFiSecurityType.Wpa2Psk; + _wiFiSecuType = _wiFiSecurity.SecurityType; + Assert.AreEqual((int)(WiFiSecurityType.Wpa2Psk), (int)(_wiFiSecuType), "SecurityType has gotten should be is Wpa2Psk."); + + /* WpaPsk */ + _wiFiSecurity.SecurityType = WiFiSecurityType.WpaPsk; + _wiFiSecuType = _wiFiSecurity.SecurityType; + Assert.AreEqual((int)(WiFiSecurityType.WpaPsk), (int)(_wiFiSecuType), "SecurityType has gotten should be is WpaPsk."); + } + 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("P1")] + [Description("Test SetPassphrase")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.SetPassphrase M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] + public async Task SetPassphrase_CHECK_STATUS() + { + try + { + init(); + /** + * PRECONDITION: + * - Creat an SecurityInformation. + */ + await setup(); + await Task.Delay(1500); + Log.Info(Globals.LogTag, "WiFiConnectionState=" + WiFiConnectionState.Connected.ToString()); + Log.Info(Globals.LogTag, "WiFiConnectionState=" + WiFiManager.ConnectionState.ToString()); + + Assert.AreEqual(WiFiConnectionState.Connected.ToString(), WiFiManager.ConnectionState.ToString(), "WiFi is not connected"); + } + 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()); + } + } + + [Test] + [Category("P1")] + [Description("Test EapInformation")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.EapInformation A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Pham Phuong Dong, dong.phuong@samsung.com")] + public void EapInformation_SET_GET() + { + WiFiAP _wiFiAp = null; + try + { + init(); + /** + * PRECONDITION: + * - Creat an SecurityInformation. + */ + _wiFiAp = new WiFiAP(_wiFiName); + _wiFiSecurity = _wiFiAp.SecurityInformation; + var setEap = _wiFiSecurity.EapInformation; + Assert.IsInstanceOf(setEap); + Assert.IsNotNull(_wiFiSecurity, "EapInformation should be return not null"); + _wiFiSecurity.SecurityType = WiFiSecurityType.Eap; + setEap.AuthenticationType = WiFiAuthenticationType.Pap; + setEap.CaCertificationFile = "File"; + setEap.EapType = WiFiEapType.Peap; + + /* TEST CODE */ + Assert.AreEqual((int)(setEap.AuthenticationType), (int)(setEap.AuthenticationType), "AuthenticationType set and get should be equal."); + Assert.AreEqual((int)(setEap.EapType), (int)(setEap.EapType), "EapType set and get should be equal."); + Assert.AreEqual(setEap.CaCertificationFile, setEap.CaCertificationFile, "CaCertificationFile set and get should be equal."); + } + 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("P1")] + [Description("Test IsWpsSupported")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.IsWpsSupported A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Nguyen Van Tan, nguyen.vtan@samsung.com")] + public async Task IsWpsSupported_GET() + { + WiFiAP _wiFiAp = null; + try + { + init(); + /** + * PRECONDITION: + * Turn on and connect to a wifi private + * -example scenario: connect to a ROUTER which support a PUSH BUTTON + * -manual test: push the BUTTON (on the UI or the physic button) to start connection transaction + */ + await setup(); + /* TEST CODE */ + _wiFiAp = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wiFiAp, "Can't get a wifi ap"); + _wiFiSecurity = _wiFiAp.SecurityInformation; + Assert.IsNotNull(_wiFiSecurity, "WifiSecurity is NULL"); + Log.Info(Globals.LogTag, "IsWpsSupported=" + _wiFiSecurity.IsWpsSupported); + } + 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("P1")] + [Description("Test whether the passphrase is required or not")] + [Property("SPEC", "Tizen.Network.WiFi.WiFiSecurity.IsPassphraseRequired A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Ngo Thi Huong, huong.nt1@samsung.com")] + public async Task IsPassphraseRequired_GET() + { + WiFiAP _wiFiAp = null; + try + { + init(); + /** + * PRECONDITION: + * Turn on and connect to a wifi private + * -example scenario: connect to a ROUTER which support a PUSH BUTTON + * -manual test: push the BUTTON (on the UI or the physic button) to start connection transaction + */ + await setup(); + /* TEST CODE */ + _wiFiAp = WiFiManager.GetConnectedAP(); + Assert.IsNotNull(_wiFiAp, "Can't get a wifi ap"); + _wiFiSecurity = _wiFiAp.SecurityInformation; + Assert.IsNotNull(_wiFiSecurity, "WifiSecurity is NULL"); + Log.Info(Globals.LogTag, "IsPassphraseRequired=" + _wiFiSecurity.IsPassphraseRequired); + Assert.IsFalse(_wiFiSecurity.IsPassphraseRequired, "Wifi doesn't require passphase"); + } + 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(); + } + } + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsInfo.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsInfo.cs new file mode 100755 index 000000000..2c2cc5ab7 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsInfo.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using networkUtils; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WpsInfo Tests")] + public class WpsInfoTests + { + [OneTimeSetUp] + public void InitFixture() + { + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test WpsInfo constructor")] + [Property("SPEC", "Tizen.Network.WiFi.WpsInfo.WpsInfo C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void WpsInfo_INIT() + { + WpsInfo info = new WpsPbcInfo(); + Assert.IsInstanceOf(info, "Creating WpsInfo is failed"); + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPbcInfo.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPbcInfo.cs new file mode 100755 index 000000000..f3a44d08d --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPbcInfo.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using networkUtils; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WpsPbcInfo Tests")] + public class WpsPbcInfoTests + { + [OneTimeSetUp] + public void InitFixture() + { + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test WpsPbcInfo constructor")] + [Property("SPEC", "Tizen.Network.WiFi.WpsPbcInfo.WpsPbcInfo C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + public void WpsPbcInfo_INIT() + { + WpsPbcInfo info = new WpsPbcInfo(); + Assert.IsInstanceOf(info, "Creating WpsPbcInfo is failed"); + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPinInfo.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPinInfo.cs new file mode 100755 index 000000000..f384fec16 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/TSWpsPinInfo.cs @@ -0,0 +1,42 @@ +using NUnit.Framework; +using networkUtils; + +namespace Tizen.Network.WiFi.Tests +{ + [TestFixture] + [Description("Tizen.Network.WiFi.WpsPinInfo Tests")] + public class WpsPinInfoTests + { + [OneTimeSetUp] + public void InitFixture() + { + } + + [SetUp] + public void Init() + { + Log.Info(Globals.LogTag, "Preconditions for each TEST"); + } + + [TearDown] + public void Destroy() + { + Log.Info(Globals.LogTag, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Test WpsPinInfo constructor")] + [Property("SPEC", "Tizen.Network.WiFi.WpsPinInfo.WpsPinInfo C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Cheoleun Moon, chleun.moon@samsung.com")] + [Property("COVPARAM", "string")] + public void WpsPinInfo_INIT() + { + WpsPinInfo info = new WpsPinInfo("12345678"); + Assert.IsInstanceOf(info, "Creating WpsPinInfo is failed"); + } + } +} + diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkParameter.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkParameter.cs new file mode 100755 index 000000000..9b1ced8bf --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkParameter.cs @@ -0,0 +1,123 @@ +using System; +using System.IO; + +namespace networkUtils +{ + /* ***********************************************************************/ + // ** + // ** Setup: name/securetype for an AP, using as precondition for testing + // ** + /* ***********************************************************************/ + public class networkParameter + { + public enum wType + { + wPrivate = 1, + wHidden = 2, + wEap = 3, + } + + /*----------Setup belowing APs for testing:-----------*/ + + /*SQE configuration*/ + public static string wnPRIVATE = null; + public static string wnPRIVATE1 = null; + public static string wnHIDDEN = null; + public static string wnEAP = null; + public static string wPASS = null; + /*This password string should be not exceeded 8 characters as API's description, so pls replace "happy12345" by "abc13579"*/ + /*This password string "wPASS = "abc13579" should be using for all of 2 private APs "DPT_Part01" and "DPT_Part02", because it was configured inside Testing code + *If you wanna change wPASS string, pls modified related TCs also*/ + + /*svmc setup*/ + public static void SetPrecondition() + { + int index = 0; + string result = RequestGET("/opt/usr/home/owner/share/tct/preconfigure.json"); + if (result == null) + { + Tizen.Log.Error(Globals.LogTag, "RequestGET failed"); + return; + } + string[] resultArray = ResultParser(result); + if (resultArray == null) + { + Tizen.Log.Error(Globals.LogTag, "ResultParser failed"); + return; + } + Tizen.Log.Info(Globals.LogTag, "========== Precondition =========="); + foreach (string item in resultArray) + { + switch (item) + { + case "PRIVATE_AP_1_2": + wnPRIVATE = resultArray[index + 1]; + wnEAP = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "EAP : " + wnEAP); + Tizen.Log.Info(Globals.LogTag, "PRIVATE1 AP : " + wnPRIVATE); + break; + case "PRIVATE_AP_2_2": + wnPRIVATE1 = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "PRIVATE2 AP : " + wnPRIVATE1); + break; + case "HIDDEN_AP": + wnHIDDEN = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "HIDDEN AP : " + wnHIDDEN); + break; + case "PASSWORD_FOR_ALL_PRIVATE_AP": + wPASS = resultArray[index + 1]; + Tizen.Log.Info(Globals.LogTag, "PASSWORD : " + wPASS); + break; + default: + break; + } + index++; + } + } + + private static string RequestGET(string path) + { + string result = null; + string url = path; + StreamReader reader = null; + + Tizen.Log.Info(Globals.LogTag, "RequestGET url: " + url); + + try + { + reader = File.OpenText(path); + result = reader.ReadToEnd(); + Tizen.Log.Info(Globals.LogTag, "RequestGET Result: " + result); + } + catch (Exception e) + { + Tizen.Log.Info(Globals.LogTag, "RequestGET error: " + e.Message); + } + finally + { + if (reader != null) + { + reader.Dispose(); + } + } + + return result; + } + private static string[] ResultParser(string TCID) + { + string[] delimiter = { "[{\"", "\":\"", "\",\"", "\":", ",\"", "\"}]", "}" }; + string[] stringPieces = null; + + try + { + stringPieces = TCID.Split(delimiter, StringSplitOptions.None); + } + catch (Exception e) + { + Tizen.Log.Info(Globals.LogTag, "ResultParser error: " + e.Message); + } + + return stringPieces; + } + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs new file mode 100755 index 000000000..9d91e3bb2 --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs @@ -0,0 +1,134 @@ +using Tizen.Network.WiFi; +using System.Threading.Tasks; + +namespace networkUtils +{ + /* ***********************************************************************/ + // ** + // ** Common library for connect/disconnect to/from WiFi: hidden, private, eap, public + // ** + /* ***********************************************************************/ + static internal class Globals + { + internal const string LogTag = "NetworkTC"; + } + + public class networkSetup + { + private static int MAX_SCAN_TRY = 3; + + private networkSetup() + { + } + + public static async Task ForgetCurrentAP() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.ForgetCurrentAP"); + WiFiAP ap = WiFiManager.GetConnectedAP(); + if (ap != null) + { + Tizen.Log.Info(Globals.LogTag, "Forget AP " + ap.NetworkInformation.Essid); + await ap.ForgetAPAsync(); + ap.Dispose(); + } + } + + public static async Task ActivateWiFi() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.ActivateWiFi"); + if (!WiFiManager.IsActive) + { + await WiFiManager.ActivateAsync(); + await Task.Delay(1500); + } + Tizen.Log.Info(Globals.LogTag, "WiFi is Activated"); + } + + public static async Task DeactivateWiFi() + { + Tizen.Log.Info(Globals.LogTag, "networkSetup.DeactivateWiFi"); + if (WiFiManager.IsActive) + { + await ForgetCurrentAP(); + await WiFiManager.DeactivateAsync(); + Tizen.Log.Info(Globals.LogTag, "Deactivated"); + } + } + + + private static WiFiAP FindAP(string WiFiName) + { + Tizen.Log.Info(Globals.LogTag, "Find AP " + WiFiName + " from scan results"); + var list = WiFiManager.GetFoundAPs(); + + foreach (WiFiAP item in list) + { + if (item.NetworkInformation.Essid == WiFiName) + { + Tizen.Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString()); + return item; + } + item.Dispose(); + } + return null; + } + + /* Connect to a WANTED AP */ + public static async Task ConnectWiFi(string WiFiName, networkParameter.wType type, string WiFiPass) + { + Tizen.Log.Info(Globals.LogTag, "ConnectWiFi (AP: " + WiFiName + ", Password: " + WiFiPass + ")"); + + await ActivateWiFi(); + + WiFiAP ap = WiFiManager.GetConnectedAP(); + // Already connected + if (ap != null && ap.NetworkInformation.Essid == WiFiName) + { + return; + } + + /** + * Connected to another AP + * We need to forget it + */ + if (ap != null) + { + Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid); + await ForgetCurrentAP(); + ap = WiFiManager.GetConnectedAP(); + if (ap != null) + { + Tizen.Log.Error(Globals.LogTag, "AP must be null"); + return; + } + } + Tizen.Log.Info(Globals.LogTag, "No connected AP"); + + /** + * Find AP from scan results + * If it fails, scan Wi-Fi APs maximum three times + */ + ap = FindAP(WiFiName); + for (int i = 0; i < MAX_SCAN_TRY && ap == null; i++) + { + await Task.Delay(1000); + await WiFiManager.ScanAsync(); + ap = FindAP(WiFiName); + } + + // Scan Failure + if (ap == null) + { + Tizen.Log.Error(Globals.LogTag, "AP " + WiFiName + " is not found"); + return; + } + + // Connect to AP + Tizen.Log.Info(Globals.LogTag, "Set passphrase " + WiFiPass); + ap.SecurityInformation.SetPassphrase(WiFiPass); + + await ap.ConnectAsync(); + Tizen.Log.Info(Globals.LogTag, "Connected"); + } // ConnectWiFi() + } +} diff --git a/tct-suite-vs/Tizen.WiFi.Tests/tizen-manifest.xml b/tct-suite-vs/Tizen.WiFi.Tests/tizen-manifest.xml new file mode 100755 index 000000000..a800dce4c --- /dev/null +++ b/tct-suite-vs/Tizen.WiFi.Tests/tizen-manifest.xml @@ -0,0 +1,19 @@ + + + + + Tizen.WiFi.Tests.png + + + + http://tizen.org/privilege/network.get + http://tizen.org/privilege/network.set + http://tizen.org/privilege/network.profile + http://tizen.org/privilege/appmanager.launch + +