using NUnit.Framework.TUnit;
using System.Collections.Generic;
using Tizen.System;
-using Xamarin.Forms;
namespace Tizen.Network.Bluetooth.Tests
{
[Description("BluetoothOppServer Tests")]
public class BluetoothOppServerTests
{
- static bool _acceptPush = false;
- static bool _canceltransfer = false;
- static bool _flagTransferFinished = false;
- static bool _flagConnectionRequested = false;
static BluetoothOppServer _oppServer = null;
- const string filePath = "/opt/usr/home/owner/media/";
- static string _fileName = "test1";
- static string _nullfileName = null;
+ static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
+ static string fileName = "test1.jpg";
static int _transferId;
static bool isBluetoothOppSupported = false;
[TearDown]
public static void Destroy()
{
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
- _oppServer.StopServer();
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static void EventHandlerTransferProgress(object sender, TransferProgressEventArgs e)
- {
- if (e.Size > 0)
- {
- Log.Info(Globals.LogTag, "EventHandlerTransferProgress");
- if (_canceltransfer)
- {
- _oppServer.CancelTransfer(_transferId);
- ManualTest.Confirm();
- }
- }
- }
-
- public static void EventHandlerTransferFinished(object sender, TransferFinishedEventArgs e)
- {
- int _result = e.Result;
- if (_result == 0)
- {
- Log.Info(Globals.LogTag, "EventHandlerTransferFinished");
- _flagTransferFinished = true;
- ManualTest.Confirm();
- }
- }
-
- public static void EventHandlerConnectionRequested(object sender, ConnectionRequestedEventArgs e)
- {
-
- if (e.Address != null)
+ if (_oppServer != null)
{
- try
- {
- Log.Info(Globals.LogTag, "EventHandlerConnectionRequested");
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- if (_acceptPush)
- {
- _oppServer.SetDestinationPath(filePath);
- _transferId = _oppServer.AcceptPush(_fileName);
- }
- else
- {
- _oppServer.RejectPush();
- ManualTest.Confirm();
- }
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][BluetoothOppServer] FAIL " + ex.Message);
- }
- _flagConnectionRequested = true;
- }
- }
-
- public static void EventHandlerConnectionRequested1(object sender, ConnectionRequestedEventArgs e)
- {
- if (e.Address != null)
- {
- try
- {
- Log.Info(Globals.LogTag, "EventHandlerConnectionRequested");
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- _oppServer.SetDestinationPath(filePath);
- _transferId = _oppServer.AcceptPush(_nullfileName);
- ManualTest.Confirm();
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][BluetoothOppServer] FAIL " + ex.Message);
- }
+ _oppServer.StopServer();
+ _oppServer = null;
}
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
}
- //[Test]
+ [Test]
[Category("P1")]
- [Description("Test StartServer, check if StartServer method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.StartServer M")]
+ [Description("Test AcceptPush, check if AcceptPush method works properly")]
+ [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.AcceptPush M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Run this only on test device which acts as Server")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button" )]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
- public static void StartServer_CHECK_FOR_OPPSERVER_START_SERVER()
+ public static async Task AcceptPush_CHECK_FOR_ACCEPT_PUSH()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("StartServer_CHECK_FOR_OPPSERVER_START_SERVER");
- ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("StartServer_CHECK_FOR_OPPSERVER_START_SERVER");
- ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- //[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")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Run this only on test device which acts as Server")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
- [Postcondition(1, "NA")]
- public static void BluetoothOppServer_INIT()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
- //TEST CODE
- Assert.IsInstanceOf<BluetoothOppServer>(_oppServer, "Should return BluetoothOppServer instance.");
- Assert.IsNotNull(_oppServer, "BluetoothOppServer instance should not be null");
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("BluetoothOppServer_INIT");
- ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("BluetoothOppServer_INIT");
- ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
- //[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")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Run this only on test device which acts as Server")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
- [Postcondition(1, "NA")]
- public static void StopServer_CHECK_FOR_OPPSERVER_STOP_SERVER()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
+ _transferId = _oppServer.AcceptPush(fileName);
- //TEST CODE
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _oppServer.StopServer();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("StopServer_CHECK_FOR_OPPSERVER_STOP_SERVER");
- ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("StopServer_CHECK_FOR_OPPSERVER_STOP_SERVER");
- ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
+ BluetoothHelper.DisplayPassLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][AcceptPush_CHECK_FOR_ACCEPT_PUSH] FAIL " + ex.Message);
+ }
+ };
- //[Test]
- [Category("P1")]
- [Description("Test AcceptPush, check if AcceptPush method works properly")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.AcceptPush M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
- [Postcondition(1, "NA")]
- public static async Task AcceptPush_CHECK_FOR_OPPSERVER_ACCEPT_PUSH()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _acceptPush = true;
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_OPPSERVER_ACCEPT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_OPPSERVER_ACCEPT_PUSH");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- //[Test]
- [Category("P1")]
- [Description("Test AcceptPush, check if AcceptPush method throws InvalidOperationException")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.AcceptPush M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Gowtham Anandha Babu, gowtham.ab@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
- [Postcondition(1, "NA")]
- public static async Task AcceptPush_CHECK_FOR_EXCEPTION()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested1;
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
{
if (isBluetoothOppSupported == false)
{
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_EXCEPTION");
+ BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
await ManualTest.WaitForConfirm();
}
}
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_EXCEPTION");
+ {
+ BluetoothHelper.DisplayLabel("AcceptPush_CHECK_FOR_ACCEPT_PUSH");
await ManualTest.WaitForConfirm();
}
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test RejectPush, check if RejectPush method works properly")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.RejectPush M")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
- public static async Task RejectPush_CHECK_FOR_OPPSERVER_REJECT_PUSH()
+ public static async Task RejectPush_CHECK_FOR_REJECT_PUSH()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _oppServer.RejectPush();
+
+ BluetoothHelper.DisplayPassLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][RejectPush_CHECK_FOR_REJECT_PUSH] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
{
if (isBluetoothOppSupported == false)
{
- BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_OPPSERVER_REJECT_PUSH");
+ BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
await ManualTest.WaitForConfirm();
}
}
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_OPPSERVER_REJECT_PUSH");
+ {
+ BluetoothHelper.DisplayLabel("RejectPush_CHECK_FOR_REJECT_PUSH");
await ManualTest.WaitForConfirm();
}
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test CancelTransfer, check if CancelTransfer method works properly")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.CancelTransfer M")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
- public static async Task CancelTransfer_CHECK_FOR_OPPSERVER_CANCEL_TRANSFER()
+ public static async Task CancelTransfer_CHECK_FOR_CANCEL_TRANSFER()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
- _oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _canceltransfer = true;
- await ManualTest.WaitForConfirm();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothOppSupported == false)
- {
- BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_OPPSERVER_CANCEL_TRANSFER");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_OPPSERVER_CANCEL_TRANSFER");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- //[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")]
- [Precondition(1, "Turn on the bluetooth")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
- [Postcondition(1, "NA")]
- public static async Task SetDestinationPath_CHECK_FOR_OPPSERVER_SET_DESTINATION()
- {
- try
- {
- _oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ /* Wait to start the current transfer */
+ Task.Delay(100).Wait();
+
+ _oppServer.CancelTransfer(_transferId);
+
+ BluetoothHelper.DisplayPassLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][CancelTransfer_CHECK_FOR_CANCEL_TRANSFER] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _acceptPush = true;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
{
if (isBluetoothOppSupported == false)
{
- BluetoothHelper.DisplayLabel("SetDestinationPath_CHECK_FOR_OPPSERVER_SET_DESTINATION");
+ BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
await ManualTest.WaitForConfirm();
}
}
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("SetDestinationPath_CHECK_FOR_OPPSERVER_SET_DESTINATION");
+ {
+ BluetoothHelper.DisplayLabel("CancelTransfer_CHECK_FOR_CANCEL_TRANSFER");
await ManualTest.WaitForConfirm();
}
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test ConnectionRequested, check if ConnectionRequested event is proper")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.ConnectionRequested E")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task ConnectionRequested_CHECK_EVENT()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ BluetoothHelper.DisplayPassLabel("ConnectionRequested_CHECK_EVENT");
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][ConnectionRequested_CHECK_EVENT] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _acceptPush = true;
+
await ManualTest.WaitForConfirm();
- Assert.IsTrue(_flagConnectionRequested, "[TestCase][BluetoothOppServer][ConnectionRequested_CHECK_EVENT] FAIL ");
}
catch (NotSupportedException)
{
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("ConnectionRequested_CHECK_EVENT");
await ManualTest.WaitForConfirm();
}
{
Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
}
-
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test TransferProgress, check if TransferProgressis proper")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferProgress E")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task TransferProgress_CHECK_EVENT()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
- _acceptPush = true;
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
+
+ EventHandlerTransferProgress = (sender, e) => {
+ if (e.Percent >= 0)
+ {
+ _oppServer.TransferProgress -= EventHandlerTransferProgress;
+ BluetoothHelper.DisplayPassLabel("TransferProgress_CHECK_EVENT");
+ }
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferProgress += EventHandlerTransferProgress;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][TransferProgress_CHECK_EVENT] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
- Assert.IsTrue(_flagTransferFinished, "[TestCase][BluetoothOppServer][TransferProgress] FAIL");
}
catch (NotSupportedException)
{
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("TransferProgress_CHECK_EVENT");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test TransferFinished, check if TransferFinished event is proper")]
[Property("SPEC", "Tizen.Network.Bluetooth.BluetoothOppServer.TransferFinished E")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task TransferFinished_CHECK_EVENT()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
+
+ EventHandlerTransferFinished = (sender, e) => {
+ if (e.Result == 0)
+ {
+ _oppServer.TransferFinished -= EventHandlerTransferFinished;
+
+ BluetoothHelper.DisplayPassLabel("TransferFinished_CHECK_EVENT");
+ }
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferFinished += EventHandlerTransferFinished;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][TransferFinished_CHECK_EVENT] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
- _acceptPush = true;
+
await ManualTest.WaitForConfirm();
- Assert.IsTrue(_flagTransferFinished, "[TestCase][BluetoothOppServer][TransferFinished_CHECK_EVENT] FAIL");
}
catch (NotSupportedException)
{
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("TransferFinished_CHECK_EVENT");
await ManualTest.WaitForConfirm();
}
using NUnit.Framework.TUnit;
using System;
using Tizen.System;
-using Xamarin.Forms;
+using System.Linq;
namespace Tizen.Network.Bluetooth.Tests
{
[Description("TransferFinishedEventArgs Tests")]
public class TransferFinishedEventArgsTests
{
- static bool _flagTransferFinished = false;
static BluetoothOppServer _oppServer = null;
- const string filePath = "/opt/usr/home/owner/media/";
- const string fileName = "test1";
+ static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
+ const string fileName = "test1.jpg";
+ static int _transferId;
static bool isBluetoothOppSupported = false;
[SetUp]
[TearDown]
public static void Destroy()
{
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
- _oppServer.StopServer();
- }
-
- public static void EventHandlerTransferProgress(object sender, TransferProgressEventArgs e)
- {
- if (e.Size > 0 && e.File != null && e.Percent > 0)
- {
- Log.Info(Globals.LogTag, "EventHandlerTransferProgress");
- }
- }
-
- public static void EventHandlerTransferFinished(object sender, TransferFinishedEventArgs e)
- {
- if (e.Result == 0 && e.File != null && e.Size > 0)
- {
- Log.Info(Globals.LogTag, "BluetoothOppServerTransferFinishedEventArgs");
- _flagTransferFinished = true;
- ManualTest.Confirm();
- }
- else
+ if (_oppServer != null)
{
- Assert.IsTrue(_flagTransferFinished, "[TestCase][TransferFinishedEventArgs] FAIL");
- }
- }
-
- public static void EventHandlerConnectionRequested(object sender, ConnectionRequestedEventArgs e)
- {
-
- if (e.Address != null)
- {
- try
- {
- Log.Info(Globals.LogTag, "EventHandlerConnectionRequested");
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- _oppServer.AcceptPush(fileName);
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][BluetoothOppServerTransferFinishedEventArgs] FAIL " + ex.Message);
- }
+ _oppServer.StopServer();
+ _oppServer = null;
}
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test File, check if File has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.File A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task File_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
+
+ EventHandlerTransferFinished = (sender, e) => {
+ _oppServer.TransferFinished -= EventHandlerTransferFinished;
+
+ Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+ Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+ Assert.True(String.Equals(e.File, fileName), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferFinished += EventHandlerTransferFinished;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test Size, check if Size has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Size A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task Size_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
+
+ EventHandlerTransferFinished = (sender, e) => {
+ _oppServer.TransferFinished -= EventHandlerTransferFinished;
+
+ Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+ Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferFinished += EventHandlerTransferFinished;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
{
if (isBluetoothOppSupported == false)
{
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
+ BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
}
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
+ {
+ BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test Result, check if Result has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferFinishedEventArgs.Result A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task Result_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferFinishedEventArgs> EventHandlerTransferFinished = null;
+
+ EventHandlerTransferFinished = (sender, e) => {
+ _oppServer.TransferFinished -= EventHandlerTransferFinished;
+
+ Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferFinished += EventHandlerTransferFinished;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][Result_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
using NUnit.Framework.TUnit;
using System;
using Tizen.System;
-using Xamarin.Forms;
+using System.Linq;
namespace Tizen.Network.Bluetooth.Tests
{
[Description("TransferProgressEventArgs Tests")]
public class TransferProgressEventArgsTests
{
- static bool _flagTransferProgress = false;
static BluetoothOppServer _oppServer = null;
- const string filePath = "/opt/usr/home/owner/media/";
- const string fileName = "test1";
+ static string filePath = StorageManager.Storages.Where(s => s.StorageType == StorageArea.Internal).FirstOrDefault().RootDirectory + "/Downloads";
+ const string fileName = "test1.jpg";
+ static int _transferId;
static bool isBluetoothOppSupported = false;
[SetUp]
[TearDown]
public static void Destroy()
{
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
- _oppServer.TransferProgress -= EventHandlerTransferProgress;
- _oppServer.TransferFinished -= EventHandlerTransferFinished;
- _oppServer.StopServer();
-
- }
-
- public static void EventHandlerTransferProgress(object sender, TransferProgressEventArgs e)
- {
- if (e.Size > 0 && e.File != null && e.Percent > 0)
- {
- _flagTransferProgress = true;
- }
- else
+ if (_oppServer != null)
{
- _flagTransferProgress = false;
- }
- }
-
- public static void EventHandlerTransferFinished(object sender, TransferFinishedEventArgs e)
- {
- int _result = e.Result;
- if (_result == 0)
- {
- Log.Info(Globals.LogTag, "TransferProgressEventArgs");
- Assert.IsTrue(_flagTransferProgress, "[TestCase][TransferProgressEventArgs] FAIL");
- ManualTest.Confirm();
- }
- }
-
- public static void EventHandlerConnectionRequested(object sender, ConnectionRequestedEventArgs e)
- {
-
- if (e.Address != null)
- {
- try
- {
- Log.Info(Globals.LogTag, "EventHandlerConnectionRequested");
- _oppServer.TransferProgress += EventHandlerTransferProgress;
- _oppServer.TransferFinished += EventHandlerTransferFinished;
- _oppServer.AcceptPush(fileName);
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][TransferProgressEventArgs] FAIL " + ex.Message);
- }
+ _oppServer.StopServer();
+ _oppServer = null;
}
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test File, check if File has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.File A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task File_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
+
+ EventHandlerTransferProgress = (sender, e) => {
+ _oppServer.TransferProgress -= EventHandlerTransferProgress;
+
+ Assert.IsNotNull(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+ Assert.IsInstanceOf<string>(e.File, "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+ Assert.True(String.Equals(e.File, fileName), "[TestCase][File_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("File_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferProgress += EventHandlerTransferProgress;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][File_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("File_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test Size, check if Size has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Size A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task Size_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
+
+ EventHandlerTransferProgress = (sender, e) => {
+ _oppServer.TransferProgress -= EventHandlerTransferProgress;
+
+ Assert.IsInstanceOf<long>(e.Size, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+ Assert.IsTrue(e.Size >= 0, "[TestCase][Size_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("Size_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferProgress += EventHandlerTransferProgress;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][Size_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("Size_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}
}
}
- //[Test]
+ [Test]
[Category("P1")]
[Description("Test Percent, check if Percent has proper value")]
[Property("SPEC", "Tizen.Network.Bluetooth.TransferProgressEventArgs.Percent A")]
[Property("AUTHOR", "Sandeep H, h.sandeep@samsung.com")]
[Precondition(1, "Turn on the bluetooth")]
[Step(1, "Tap the Run button")]
- [Step(2, "Open the bluetooth setting on server device, which makes the device visible")]
- [Step(3, "Share a file from Opp Client device over bluetooth")]
- [Step(4, "When permission request popup appears, tap accept on server device.")]
- [Step(5, "If testcase is working properly, TCT is passed automatically. Otherwise, please press fail button")]
+ [Step(2, "Share a file from Opp Client device over bluetooth")]
+ [Step(3, "When permission request popup appears, tap accept on server device.")]
[Postcondition(1, "NA")]
public static async Task Percent_PROPERTY_READ_ONLY()
{
try
{
_oppServer = BluetoothOppServer.StartServer(filePath);
- //TEST CODE
+
+ EventHandler<ConnectionRequestedEventArgs> EventHandlerConnectionRequested = null;
+ EventHandler<TransferProgressEventArgs> EventHandlerTransferProgress = null;
+
+ EventHandlerTransferProgress = (sender, e) => {
+ _oppServer.TransferProgress -= EventHandlerTransferProgress;
+
+ Assert.IsInstanceOf<int>(e.Percent, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
+ Assert.IsTrue(e.Percent >= 0, "[TestCase][Percent_PROPERTY_READ_ONLY] Failed");
+
+ BluetoothHelper.DisplayPassLabel("Percent_PROPERTY_READ_ONLY");
+ };
+
+ EventHandlerConnectionRequested = (sender, e) => {
+ try
+ {
+ _oppServer.ConnectionRequested -= EventHandlerConnectionRequested;
+
+ _transferId = _oppServer.AcceptPush(fileName);
+
+ _oppServer.TransferProgress += EventHandlerTransferProgress;
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail("[TestCase][Percent_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+ }
+ };
+
_oppServer.ConnectionRequested += EventHandlerConnectionRequested;
+
await ManualTest.WaitForConfirm();
}
catch (NotSupportedException)
catch (TypeInitializationException e)
{
if (isBluetoothOppSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
+ {
BluetoothHelper.DisplayLabel("Percent_PROPERTY_READ_ONLY");
await ManualTest.WaitForConfirm();
}