From: DoHyun Pyun Date: Thu, 10 Jan 2019 02:03:00 +0000 (+0900) Subject: [Non-ACR][Bluetooth][Add Bluetooth OPP Server TCs] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d29512271d8843e526b0cdd1c9fd57bb42050644;p=test%2Ftct%2Fcsharp%2Fapi.git [Non-ACR][Bluetooth][Add Bluetooth OPP Server TCs] Change-Id: I9a50ffef17673309d5a5289a44131e2e5e2d01a3 Signed-off-by: DoHyun Pyun --- diff --git a/tct-suite-vs/Tizen.Bluetooth.Tests/testcase/TSBluetoothOppServer.cs b/tct-suite-vs/Tizen.Bluetooth.Tests/testcase/TSBluetoothOppServer.cs new file mode 100644 index 000000000..f61cd9281 --- /dev/null +++ b/tct-suite-vs/Tizen.Bluetooth.Tests/testcase/TSBluetoothOppServer.cs @@ -0,0 +1,176 @@ +using BluetoothNetworkUtils; +using NUnit.Framework; +using NUnit.Framework.TUnit; +using System; +using System.Linq; +using System.Threading.Tasks; +using Tizen.System; + +namespace Tizen.Network.Bluetooth.Tests +{ + [TestFixture] + [Description("BluetoothOppServer Tests")] + public class BluetoothOppServerTests + { + BluetoothOppServer _oppServer = null; + string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads"; + bool isBluetoothOppSupported = false; + + [SetUp] + public void Init() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for each TEST"); + Information.TryGetValue("tizen.org/feature/network.bluetooth.opp", out isBluetoothOppSupported); + } + [TearDown] + public void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST"); + } + + [Test] + [Category("P1")] + [Description("Create a BluetoothOppServer Object")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.BluetoothOppServer C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] + public void BluetoothOppServer_INIT() + { + try + { + var bluetoothOppServer = new BluetoothOppServer(); + + Assert.IsInstanceOf(bluetoothOppServer, "Should return BluetoothOppServer instance."); + Assert.IsNotNull(bluetoothOppServer, "BluetoothOppServer instance should not be null"); + } + catch (Exception ex) + { + if (ex is NotSupportedException) + { + Assert.IsTrue(isBluetoothOppSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.Fail("Throwing exception " + ex.ToString()); + } + } + } + + [Test] + [Category("P1")] + [Description("Test StartServer, check if StartServer method works properly")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.StartServer M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] + public void StartServer_CHECK_START_SERVER() + { + try + { + _oppServer = BluetoothOppServer.StartServer(filePath); + + Assert.IsInstanceOf(_oppServer, "Should return BluetoothOppServer instance."); + Assert.IsNotNull(_oppServer, "BluetoothOppServer instance should not be null"); + + _oppServer.StopServer(); + } + catch (Exception ex) + { + if (ex is NotSupportedException) + { + Assert.IsTrue(isBluetoothOppSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.Fail("Throwing exception " + ex.ToString()); + } + } + finally + { + if (_oppServer != null) + { + _oppServer = null; + } + } + } + + [Test] + [Category("P1")] + [Description("Test StopServer, check if StopServer method works properly")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.StopServer M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] + public void StopServer_CHECK_STOP_SERVER() + { + try + { + _oppServer = BluetoothOppServer.StartServer(filePath); + + Assert.IsInstanceOf(_oppServer, "Should return BluetoothOppServer instance."); + Assert.IsNotNull(_oppServer, "BluetoothOppServer instance should not be null"); + + _oppServer.StopServer(); + } + catch (Exception ex) + { + if (ex is NotSupportedException) + { + Assert.IsTrue(isBluetoothOppSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.Fail("Throwing exception " + ex.ToString()); + } + } + finally + { + if (_oppServer != null) + { + _oppServer = null; + } + } + } + + [Test] + [Category("P1")] + [Description("Test SetDestinationPath, check if SetDestinationPath method works properly")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.SetDestinationPath M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")] + public void SetDestinationPath_CHECK_SET_DESTINATION() + { + try + { + _oppServer = BluetoothOppServer.StartServer(filePath); + + Assert.IsInstanceOf(_oppServer, "Should return BluetoothOppServer instance."); + Assert.IsNotNull(_oppServer, "BluetoothOppServer instance should not be null"); + + _oppServer.SetDestinationPath(filePath); + + _oppServer.StopServer(); + } + catch (Exception ex) + { + if (ex is NotSupportedException) + { + Assert.IsTrue(isBluetoothOppSupported == false, "Invalid NotSupportedException"); + } + else + { + Assert.Fail("Throwing exception " + ex.ToString()); + } + } + finally + { + if (_oppServer != null) + { + _oppServer = null; + } + } + } + } +}