[Bluetooth][Non-ACR] Add precondition check logic 68/206468/4
authorWootak Jung <wootak.jung@samsung.com>
Mon, 20 May 2019 07:23:17 +0000 (16:23 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 22 May 2019 04:26:38 +0000 (13:26 +0900)
Remove unused discovery logic

Change-Id: I4c8e864d996379bf395fd0af2eb2911a88001aec

tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/BluetoothSetup.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSIBluetoothClientSocket.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSIBluetoothServerSocket.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSNotificationSentEventArg.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnection.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketConnectionStateChangedEventArgs.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketData.cs
tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSSocketDataReceivedEventArgs.cs

index 8821d44..15d1ba3 100644 (file)
@@ -33,7 +33,6 @@ namespace BluetoothNetworkUtils
         public static bool FlagAcceptStateChanged = false;
         public static bool FlagConnected = false;
         public static bool FlagDisconnected = false;
-        public static bool FlagDeviceFound = false;
         public static string ServiceUuid = "00001101-0000-1000-8000-00805F9B7777";
         public static SocketConnection AcceptConnection = null;
         public static BluetoothError AcceptResult;
@@ -58,7 +57,6 @@ namespace BluetoothNetworkUtils
         public static string A2dpSnkUuid = "0000110B-0000-1000-8000-00805F9B34FB";
 
         private static bool flagCreateSocketDone = false;
-        private static bool flagCreateClientDone = false;
         private static bool flagAcceptSocketDone = false;
         private static bool flagConnectSocketDone = false;
         private static bool flagDisconnectSocketDone = false;
@@ -122,80 +120,16 @@ namespace BluetoothNetworkUtils
             }
         }
 
-        public static void DiscoveryStateChangedEventHandler(object sender, DiscoveryStateChangedEventArgs args)
+        public static void CreateClientSocketUtil()
         {
-            Log.Info(Globals.LogTag, "DiscoverySateChanged callback "+ args.DiscoveryState);
-            if (args.DiscoveryState == BluetoothDeviceDiscoveryState.Found && args.DeviceFound.IsPaired)
-            {
-                if (FlagDeviceFound == true)
-                    return;
-
-                if (remote_addr.Equals(default_remote_addr))
-                {
-                    LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Use the first found device");
-                }
-                else if (args.DeviceFound.Address.Equals(remote_addr))
-                {
-                    LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Found the matching device: " + args.DeviceFound.Address);
-                }
-                else
-                {
-                    LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "Exception: " + args.DeviceFound.Address);
-                    return;
-                }
-
-                Log.Info(Globals.LogTag, "DiscoverySateChanged callback device found: "+ args.DeviceFound.Name);
-                Client = args.DeviceFound.CreateSocket(ServiceUuid);
-
-                if (Client != null)
-                {
-                    FlagDeviceFound = true;
-                    BluetoothAdapter.StopDiscovery();
-                }
-            }
-        }
-
-        public static async Task WaitDiscoveryFlag()
-        {
-            int count = 0;
-            while(true)
-            {
-                await Task.Delay(2000);
-                count++;
-                if (FlagDeviceFound)
-                    break;
-                if (count == 15)
-                    break;
-            }
-        }
-
-        public static async Task CreateClientSocketUtil()
-        {
-            pairedDevice = BluetoothAdapter.GetBondedDevice(remote_addr);
-
-            if (pairedDevice == null)
+            try
             {
-                BluetoothAdapter.DiscoveryStateChanged += DiscoveryStateChangedEventHandler;
-                BluetoothAdapter.StartDiscovery ();
-                await WaitDiscoveryFlag ();
-
-                if (BluetoothAdapter.IsDiscoveryInProgress)
-                    BluetoothAdapter.StopDiscovery ();
-
-                BluetoothAdapter.DiscoveryStateChanged -= DiscoveryStateChangedEventHandler;
-
-                if (FlagDeviceFound)
-                    flagCreateClientDone = true;
+                pairedDevice = BluetoothAdapter.GetBondedDevice(remote_addr);
+                Client = pairedDevice.CreateSocket(ServiceUuid);
             }
-            else
+            catch (Exception e)
             {
-                Client = pairedDevice.CreateSocket(ServiceUuid);
-
-                if (Client != null)
-                {
-                    FlagDeviceFound = true;
-                    flagCreateClientDone = true;
-                }
+                Log.Error(Globals.LogTag, "Failed to get bonded device(" + remote_addr + "), Exception: " + e.ToString());
             }
         }
 
@@ -203,14 +137,12 @@ namespace BluetoothNetworkUtils
         {
             Client = null;
             ClientConnection = null;
-            flagCreateClientDone = false;
-            FlagDeviceFound = false;
         }
 
         public static async Task WaitAcceptFlag()
         {
             int count = 0;
-            while(true)
+            while (true)
             {
                 await Task.Delay(2000);
                 count++;
@@ -268,13 +200,13 @@ namespace BluetoothNetworkUtils
                 FlagDisconnected = true;
                 flagDisconnectSocketDone = true;
             }
-            //ManualTest.Confirm();
+            ManualTest.Confirm();
         }
 
         public static async Task WaitConnectedFlag()
         {
             int count = 0;
-            while(true)
+            while (true)
             {
                 await Task.Delay(1000);
                 count++;
@@ -290,10 +222,10 @@ namespace BluetoothNetworkUtils
             if (flagConnectSocketDone == false)
             {
                 Client.ConnectionStateChanged += ConnectionStateChangedEventHandler;
-                Client.Connect ();
+                Client.Connect();
 
-                await WaitConnectedFlag ();
-                //await ManualTest.WaitForConfirm();
+                //await WaitConnectedFlag ();
+                await ManualTest.WaitForConfirm();
                 //Client.ConnectionStateChanged -= ConnectionStateChangedEventHandler;
                 if (FlagConnected)
                 {
@@ -307,7 +239,7 @@ namespace BluetoothNetworkUtils
         public static async Task WaitDisconnectedFlag()
         {
             int count = 0;
-            while(true)
+            while (true)
             {
                 await Task.Delay(1000);
                 count++;
@@ -324,7 +256,9 @@ namespace BluetoothNetworkUtils
             {
                 //Client.ConnectionStateChanged += ConnectionStateChangedEventHandler;
                 Client.Disconnect();
-                await WaitDisconnectedFlag();
+
+                //await WaitDisconnectedFlag();
+                await ManualTest.WaitForConfirm();
                 if (FlagDisconnected)
                 {
                     Client.ConnectionStateChanged -= ConnectionStateChangedEventHandler;
@@ -339,7 +273,7 @@ namespace BluetoothNetworkUtils
         {
             BluetoothDevice bondedDevice = e.Device;
 
-            if(bondedDevice != null && bondedDevice.IsPaired)
+            if (bondedDevice != null && bondedDevice.IsPaired)
             {
                 pairedDevice = bondedDevice;
             }
@@ -347,7 +281,7 @@ namespace BluetoothNetworkUtils
 
         public static void EventHandlerDiscoveryStateChanged(object sender, DiscoveryStateChangedEventArgs e)
         {
-            if(e.DiscoveryState == BluetoothDeviceDiscoveryState.Found)
+            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found)
             {
                 BluetoothDevice resultDevice = e.DeviceFound;
                 BluetoothClass btClass = resultDevice.Class;
@@ -365,13 +299,13 @@ namespace BluetoothNetworkUtils
 
         public static void EventHandlerHidDiscoveryStateChanged(object sender, DiscoveryStateChangedEventArgs e)
         {
-            if(hidDevice != null)
+            if (hidDevice != null)
             {
                 LogUtils.Write (LogUtils.DEBUG, LogUtils.TAG, "hidDevice instance already exist");
                 return;
             }
 
-            if(e.DiscoveryState == BluetoothDeviceDiscoveryState.Found)
+            if (e.DiscoveryState == BluetoothDeviceDiscoveryState.Found)
             {
                 BluetoothDevice resultDevice = e.DeviceFound;
                 BluetoothClass btClass = resultDevice.Class;
index 7e209ea..cbcbc9a 100755 (executable)
@@ -12,17 +12,17 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("IBluetoothClientSocket Tests")]
     public class IBluetoothClientSocketTests
     {
-        static bool isBluetoothSupported = false;
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for IBluetoothClientSocket TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
         }
 
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
@@ -30,9 +30,9 @@ namespace Tizen.Network.Bluetooth.Tests
         [Test]
         [Category("P1")]
         [Description("Connects to a remote device, establishing socket connection and acts as a client.")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothClientSocket.Connect ME")]
+        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothClientSocket.Connect M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEVENT")]
+        [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
         [Precondition(2, "Run this only on test device which acts as client")]
@@ -41,10 +41,17 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Connect_SOCKET_CONNECTION_TEST()
+        public async Task Connect_SOCKET_CONNECTION_TEST()
         {
             try {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
 
                 await Task.Delay(1000);
@@ -59,7 +66,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Connect_SOCKET_CONNECTION_TEST");
                     await ManualTest.WaitForConfirm();
@@ -67,7 +74,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Connect_SOCKET_CONNECTION_TEST");
                     await ManualTest.WaitForConfirm();
@@ -83,9 +90,9 @@ namespace Tizen.Network.Bluetooth.Tests
         [Test]
         [Category("P1")]
         [Description("Disconnects the socket connection.")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothClientSocket.Disconnect ME")]
+        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothClientSocket.Disconnect M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEVENT")]
+        [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
         [Precondition(2, "Run this only on test device which acts as client")]
@@ -94,10 +101,17 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Disconnect_SOCKET_DISCONNECTION_TEST()
+        public async Task Disconnect_SOCKET_DISCONNECTION_TEST()
         {
             try {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
 
                 await Task.Delay(1000);
@@ -115,7 +129,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Disconnect_SOCKET_DISCONNECTION_TEST");
                     await ManualTest.WaitForConfirm();
@@ -123,7 +137,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Disconnect_SOCKET_DISCONNECTION_TEST");
                     await ManualTest.WaitForConfirm();
index 1b8d578..4843edc 100755 (executable)
@@ -12,23 +12,23 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("IBluetoothServerSocket Tests")]
     public class IBluetoothServerSocketTests
     {
-        private static string dataFromClient = "Test from client";
-        static bool isBluetoothSupported = false;
+        private string _dataFromClient = "Test from client";
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for IBluetoothServerSocket TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
         }
 
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        [Test] //pass, fail
+        [Test]
         [Category("P1")]
         [Description("Check ConnectionStateChanged event")]
         [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.ConnectionStateChanged E")]
@@ -42,11 +42,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task ConnectionStateChanged_EVENT()
+        public async Task ConnectionStateChanged_EVENT()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 Assert.IsTrue(BluetoothSetup.FlagConnected, "[TestCase][ConnectionStateChanged][Socket] Failed");
 
@@ -58,7 +65,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("ConnectionStateChanged_EVENT");
                     await ManualTest.WaitForConfirm();
@@ -66,7 +73,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("ConnectionStateChanged_EVENT");
                     await ManualTest.WaitForConfirm();
@@ -82,16 +89,16 @@ namespace Tizen.Network.Bluetooth.Tests
         [Test]
         [Category("P1")]
         [Description("Sends data to the connected device")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.SendData ME")]
+        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.SendData M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEVENT")]
+        [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
         [Precondition(2, "Run this only on server device")]
         [Precondition(3, "Test device(server) should be paired only with client device")]
         [Step(1, "Tap the Run button in server device")]
         [Step(2, "Run IBluetoothServerSocketTests.DataReceived_CLIENT_EVENT in the client device immediately")]
-        public static async Task SendData_SEND_DATA_TEST_SERVER()
+        public async Task SendData_SEND_DATA_TEST_SERVER()
         {
             try
             {
@@ -105,7 +112,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("SendData_SEND_DATA_TEST_SERVER");
                     await ManualTest.WaitForConfirm();
@@ -113,7 +120,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("SendData_SEND_DATA_TEST_SERVER");
                     await ManualTest.WaitForConfirm();
@@ -132,9 +139,9 @@ namespace Tizen.Network.Bluetooth.Tests
         [Test]
         [Category("P1")]
         [Description("Sends data to the connected device")]
-        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.SendData ME")]
+        [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.SendData M")]
         [Property("SPEC_URL", "-")]
-        [Property("CRITERIA", "MEVENT")]
+        [Property("CRITERIA", "MR")]
         [Property("AUTHOR", "Adhavan, adhavan.m@samsung.com")]
         [Precondition(1, "Turn on the bluetooth")]
         [Precondition(2, "Run this only on client device")]
@@ -143,17 +150,24 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button in client device")]
         [Step(2, "Check if log in server device shows \"DataReceived in server: Test from client\".")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task SendData_SEND_DATA_TEST_CLIENT()
+        public async Task SendData_SEND_DATA_TEST_CLIENT()
         {
             try
             {
                 int writtenLength;
 
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 await Task.Delay(2000);
-                writtenLength = BluetoothSetup.Client.SendData(dataFromClient);
-                Assert.AreEqual(writtenLength, dataFromClient.Length);
+                writtenLength = BluetoothSetup.Client.SendData(_dataFromClient);
+                Assert.AreEqual(writtenLength, _dataFromClient.Length);
 
                 BluetoothHelper.DisplayPassLabel("SendData_SEND_DATA_TEST_CLIENT");
                 await ManualTest.WaitForConfirm();
@@ -163,7 +177,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("SendData_SEND_DATA_TEST_CLIENT");
                     await ManualTest.WaitForConfirm();
@@ -171,7 +185,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("SendData_SEND_DATA_TEST_CLIENT");
                     await ManualTest.WaitForConfirm();
@@ -184,7 +198,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        [Test] //pass, fail
+        [Test]
         [Category("P1")]
         [Description("Check DataReceived event")]
         [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.DataReceived E")]
@@ -196,7 +210,7 @@ namespace Tizen.Network.Bluetooth.Tests
         [Precondition(3, "Test device(server) should be paired only with client device")]
         [Step(1, "Tap the Run button in server device")]
         [Step(2, "Run IBluetoothServerSocketTests.SendData_SEND_DATA_TEST_CLIENT in the client device immediately")]
-        public static async Task DataReceived_SERVER_EVENT()
+        public async Task DataReceived_SERVER_EVENT()
         {
             try
             {
@@ -212,7 +226,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("DataReceived_SERVER_EVENT");
                     await ManualTest.WaitForConfirm();
@@ -220,7 +234,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("DataReceived_SERVER_EVENT");
                     await ManualTest.WaitForConfirm();
@@ -236,7 +250,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        [Test] //pass, fail
+        [Test]
         [Category("P1")]
         [Description("Check DataReceived event")]
         [Property("SPEC", "Tizen.Network.Bluetooth.IBluetoothServerSocket.DataReceived E")]
@@ -254,12 +268,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(2, "Check if log in client device shows \"DataReceived in client: Test from server\".")]
         [Postcondition(1, "Close the terminal")]
         [Postcondition(2, "Unpair the server device")]
-        public static async Task DataReceived_CLIENT_EVENT()
+        public async Task DataReceived_CLIENT_EVENT()
         {
             try
             {
-                //TEST CODE
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 BluetoothSetup.Client.DataReceived += (sender, args) =>
                 {
@@ -273,7 +293,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("DataReceived_SERVER_EVENT");
                     await ManualTest.WaitForConfirm();
@@ -281,7 +301,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("DataReceived_SERVER_EVENT");
                     await ManualTest.WaitForConfirm();
index b76f9d6..10a8857 100755 (executable)
@@ -12,17 +12,17 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("NotificationSentEventArg Tests")]
     public class NotificationSentEventArgTests
     {
-        bool isBluetoothGattServerSupported = false;
-        BluetoothGattServer server = null;
-        string svcUuid = "181D";
-        string charUuid = "2A20";
-        string valueChanged = "valueChanged";
+        private bool _isBluetoothGattServerSupported = false;
+        private BluetoothGattServer _server = null;
+        private string _svcUuid = "181D";
+        private string _charUuid = "2A20";
+        private string _valueChanged = "valueChanged";
 
         [SetUp]
         public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le.gatt.server", out isBluetoothGattServerSupported);
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le.gatt.server", out _isBluetoothGattServerSupported);
         }
 
         [TearDown]
@@ -52,20 +52,20 @@ namespace Tizen.Network.Bluetooth.Tests
                 string origin_val = null;
 
                 /* We can't occupy the precondition, if GATT Server feature is not supported in Manual TC */
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("ClientAddress_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                     return;
                 }
 
-                server = await BluetoothSetup.gatt_server_init();
-                Assert.IsNotNull(server, "Precondition failed: server instance should not be null");
+                _server = await BluetoothSetup.gatt_server_init();
+                Assert.IsNotNull(_server, "Precondition failed: server instance should not be null");
 
                 EventHandler<NotificationSentEventArg> Server_NotificationSent = null;
 
                 Server_NotificationSent = (sender, e) => {
-                    server.NotificationSent -= Server_NotificationSent;
+                    _server.NotificationSent -= Server_NotificationSent;
                     Assert.IsNotNull(e.ClientAddress, "[TestCase][ClientAddress_PROPERTY_READ_ONLY] Failed");
                     Assert.IsInstanceOf<string>(e.ClientAddress, "[TestCase][ClientAddress_PROPERTY_READ_ONLY] Failed");
                     BluetoothHelper.DisplayPassLabel("ClientAddress_PROPERTY_READ_ONLY");
@@ -77,11 +77,11 @@ namespace Tizen.Network.Bluetooth.Tests
                     try
                     {
                         Log.Info(Globals.LogTag, "Charc_NotificationStateChanged");
-                        server.NotificationSent += Server_NotificationSent;
+                        _server.NotificationSent += Server_NotificationSent;
 
                         origin_val = charc.GetValue(0);
-                        charc.SetValue(valueChanged);
-                        server.SendIndicationAsync(charc, null);
+                        charc.SetValue(_valueChanged);
+                        _server.SendIndicationAsync(charc, null);
 
                         charc.SetValue(origin_val);
                     }
@@ -91,8 +91,8 @@ namespace Tizen.Network.Bluetooth.Tests
                     }
                 };
 
-                srv = server.GetService(svcUuid);
-                charc = srv.GetCharacteristic(charUuid);
+                srv = _server.GetService(_svcUuid);
+                charc = srv.GetCharacteristic(_charUuid);
 
                 charc.NotificationStateChanged += Charc_NotificationStateChanged;
 
@@ -102,7 +102,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("ClientAddress_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -110,7 +110,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("ClientAddress_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -142,22 +142,22 @@ namespace Tizen.Network.Bluetooth.Tests
                 string origin_val = null;
 
                 /* We can't occupy the precondition, if GATT Server feature is not supported in Manual TC */
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Completed_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                     return;
                 }
 
-                server = await BluetoothSetup.gatt_server_init();
-                Assert.IsNotNull(server, "Precondition failed: server instance should not be null");
+                _server = await BluetoothSetup.gatt_server_init();
+                Assert.IsNotNull(_server, "Precondition failed: server instance should not be null");
 
                 EventHandler<NotificationSentEventArg> Server_NotificationSent = null;
 
                 Server_NotificationSent = (sender, e) => {
-                    server.NotificationSent -= Server_NotificationSent;
-                    Assert.IsTrue(e.Completed == true, "[TestCase][Completed_PROPERTY_READ_ONLY] Failed");
+                    _server.NotificationSent -= Server_NotificationSent;
                     Assert.IsInstanceOf<bool>(e.Completed, "[TestCase][Completed_PROPERTY_READ_ONLY] Failed");
+                    Assert.IsTrue(e.Completed == true, "[TestCase][Completed_PROPERTY_READ_ONLY] Failed");
                     BluetoothHelper.DisplayPassLabel("Completed_PROPERTY_READ_ONLY");
                 };
 
@@ -167,22 +167,22 @@ namespace Tizen.Network.Bluetooth.Tests
                     try
                     {
                         Log.Info(Globals.LogTag, "Charc_NotificationStateChanged");
-                        server.NotificationSent += Server_NotificationSent;
+                        _server.NotificationSent += Server_NotificationSent;
 
                         origin_val = charc.GetValue(0);
-                        charc.SetValue(valueChanged);
-                        server.SendIndicationAsync(charc, null);
+                        charc.SetValue(_valueChanged);
+                        _server.SendIndicationAsync(charc, null);
 
                         charc.SetValue(origin_val);
                     }
                     catch (Exception ex)
                     {
-                        Assert.Fail("[TestCase][ClientAddress_PROPERTY_READ_ONLY] FAIL " + ex.Message);
+                        Assert.Fail("[TestCase][Completed_PROPERTY_READ_ONLY] FAIL " + ex.Message);
                     }
                 };
 
-                srv = server.GetService(svcUuid);
-                charc = srv.GetCharacteristic(charUuid);
+                srv = _server.GetService(_svcUuid);
+                charc = srv.GetCharacteristic(_charUuid);
 
                 charc.NotificationStateChanged += Charc_NotificationStateChanged;
 
@@ -192,7 +192,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Completed_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -200,7 +200,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Completed_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -232,20 +232,20 @@ namespace Tizen.Network.Bluetooth.Tests
                 string origin_val = null;
 
                 /* We can't occupy the precondition, if GATT Server feature is not supported in Manual TC */
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                     return;
                 }
 
-                server = await BluetoothSetup.gatt_server_init();
-                Assert.IsNotNull(server, "Precondition failed: server instance should not be null");
+                _server = await BluetoothSetup.gatt_server_init();
+                Assert.IsNotNull(_server, "Precondition failed: server instance should not be null");
 
                 EventHandler<NotificationSentEventArg> Server_NotificationSent = null;
 
                 Server_NotificationSent = (sender, e) => {
-                    server.NotificationSent -= Server_NotificationSent;
+                    _server.NotificationSent -= Server_NotificationSent;
                     Assert.IsInstanceOf<int>(e.Result, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
                     Assert.IsTrue((int)e.Result == 0, "[TestCase][Result_PROPERTY_READ_ONLY] Failed");
                     BluetoothHelper.DisplayPassLabel("Result_PROPERTY_READ_ONLY");
@@ -257,11 +257,11 @@ namespace Tizen.Network.Bluetooth.Tests
                     try
                     {
                         Log.Info(Globals.LogTag, "Charc_NotificationStateChanged");
-                        server.NotificationSent += Server_NotificationSent;
+                        _server.NotificationSent += Server_NotificationSent;
 
                         origin_val = charc.GetValue(0);
-                        charc.SetValue(valueChanged);
-                        server.SendIndicationAsync(charc, null);
+                        charc.SetValue(_valueChanged);
+                        _server.SendIndicationAsync(charc, null);
 
                         charc.SetValue(origin_val);
                     }
@@ -271,8 +271,8 @@ namespace Tizen.Network.Bluetooth.Tests
                     }
                 };
 
-                srv = server.GetService(svcUuid);
-                charc = srv.GetCharacteristic(charUuid);
+                srv = _server.GetService(_svcUuid);
+                charc = srv.GetCharacteristic(_charUuid);
 
                 charc.NotificationStateChanged += Charc_NotificationStateChanged;
 
@@ -282,7 +282,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -290,7 +290,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Result_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -322,23 +322,23 @@ namespace Tizen.Network.Bluetooth.Tests
                 string origin_val = null;
 
                 /* We can't occupy the precondition, if GATT Server feature is not supported in Manual TC */
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Server_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                     return;
                 }
 
-                server = await BluetoothSetup.gatt_server_init();
-                Assert.IsNotNull(server, "Precondition failed: server instance should not be null");
+                _server = await BluetoothSetup.gatt_server_init();
+                Assert.IsNotNull(_server, "Precondition failed: server instance should not be null");
 
                 EventHandler<NotificationSentEventArg> Server_NotificationSent = null;
 
                 Server_NotificationSent = (sender, e) => {
-                    server.NotificationSent -= Server_NotificationSent;
+                    _server.NotificationSent -= Server_NotificationSent;
                     Assert.IsNotNull(e.Server, "[TestCase][Server_PROPERTY_READ_ONLY] Failed");
                     Assert.IsInstanceOf<BluetoothGattServer>(e.Server, "[TestCase][Server_PROPERTY_READ_ONLY] Failed");
-                    Assert.AreSame(server, e.Server);
+                    Assert.AreSame(_server, e.Server);
                     BluetoothHelper.DisplayPassLabel("Server_PROPERTY_READ_ONLY");
                 };
 
@@ -348,11 +348,11 @@ namespace Tizen.Network.Bluetooth.Tests
                     try
                     {
                         Log.Info(Globals.LogTag, "Charc_NotificationStateChanged");
-                        server.NotificationSent += Server_NotificationSent;
+                        _server.NotificationSent += Server_NotificationSent;
 
                         origin_val = charc.GetValue(0);
-                        charc.SetValue(valueChanged);
-                        server.SendIndicationAsync(charc, null);
+                        charc.SetValue(_valueChanged);
+                        _server.SendIndicationAsync(charc, null);
 
                         charc.SetValue(origin_val);
                     }
@@ -362,8 +362,8 @@ namespace Tizen.Network.Bluetooth.Tests
                     }
                 };
 
-                srv = server.GetService(svcUuid);
-                charc = srv.GetCharacteristic(charUuid);
+                srv = _server.GetService(_svcUuid);
+                charc = srv.GetCharacteristic(_charUuid);
 
                 charc.NotificationStateChanged += Charc_NotificationStateChanged;
 
@@ -373,7 +373,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothGattServerSupported == false)
+                if (_isBluetoothGattServerSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Server_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -381,7 +381,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothGattServerSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Server_PROPERTY_READ_ONLY");
                     await ManualTest.WaitForConfirm();
index aa3b224..5f81d7f 100644 (file)
@@ -12,16 +12,16 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("SocketConnection Tests")]
     public class SocketConnectionTests
     {
-        static bool isBluetoothSupported = false;
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
         }
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
             BluetoothSetup.DestroyClientSocketUtil();
@@ -41,11 +41,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task SocketFd_READ_ONLY()
+        public async Task SocketFd_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 if (BluetoothSetup.ClientConnection == null)
                 {
@@ -61,7 +68,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("SocketFd_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -69,8 +76,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("SocketFd_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -95,11 +102,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Address_READ_ONLY()
+        public async Task Address_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 if (BluetoothSetup.ClientConnection == null)
                 {
@@ -116,7 +130,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Address_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -124,8 +138,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("Address_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -150,11 +164,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task ServiceUuid_READ_ONLY()
+        public async Task ServiceUuid_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 if (BluetoothSetup.ClientConnection == null)
                 {
@@ -171,7 +192,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("ServiceUuid_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -179,8 +200,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("ServiceUuid_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -209,7 +230,14 @@ namespace Tizen.Network.Bluetooth.Tests
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 Assert.IsNotNull(BluetoothSetup.ClientConnection, "Connection data is null");
                 Assert.IsNotNull(BluetoothSetup.ClientConnection.Client, "Client is null");
@@ -222,7 +250,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Client_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -230,7 +258,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Client_READ_ONLY");
                     await ManualTest.WaitForConfirm();
index f0f1feb..2b5f4dc 100755 (executable)
@@ -12,16 +12,16 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("SocketConnectionStateChangedEventArgs Tests")]
     public class SocketConnectionStateChangedEventArgsTests
     {
-        static bool isBluetoothSupported = false;
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
         }
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
             BluetoothSetup.DestroyClientSocketUtil();
@@ -41,22 +41,27 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Connection_READ_ONLY()
+        public async Task Connection_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
-                await BluetoothSetup.ConnectSocketUtil();
-                Assert.IsNotNull(BluetoothSetup.ClientConnection, "[TestCase][Connection_READ_ONLY][Socket] Failed");
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
 
-                BluetoothHelper.DisplayPassLabel("Connection_READ_ONLY");
-                await ManualTest.WaitForConfirm();
+                await BluetoothSetup.ConnectSocketUtil();
+                Assert.IsNotNull(BluetoothSetup.ClientConnection, "ClientConnection is null");
+                Assert.IsInstanceOf<SocketConnection>(BluetoothSetup.ClientConnection, "ClientConnection is not type of SocketConnection");
 
                 await BluetoothSetup.DisconnectSocketUtil();
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Connection_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -64,8 +69,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("Connection_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -91,27 +96,27 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Step(3, "Check if log shows \"[TestCase][Result_READ_ONLY][Socket] Pass\".")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Result_READ_ONLY()
+        public async Task Result_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
-                await BluetoothSetup.ConnectSocketUtil();
-                if (BluetoothSetup.ClientResult == BluetoothError.None)
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
                 {
-                    Log.Debug(Globals.LogTag, "[TestCase][Result_READ_ONLY][Socket] Pass");
-                    BluetoothHelper.DisplayPassLabel("Result_READ_ONLY");
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
                     await ManualTest.WaitForConfirm();
+                    return;
                 }
-                else
-                {
-                    Assert.Fail("[TestCase][Result_READ_ONLY][Socket] Failed");
-                }
+
+                await BluetoothSetup.ConnectSocketUtil();
+                Assert.IsInstanceOf<BluetoothError>(BluetoothSetup.ClientResult, "ClientResult is not type of int");
+                Assert.AreEqual(BluetoothSetup.ClientResult, BluetoothError.None, "ClientResult is not Error.None");
+
                 await BluetoothSetup.DisconnectSocketUtil();
-               }
+            }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Result_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -119,8 +124,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("Result_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -145,28 +150,27 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task State_READ_ONLY()
+        public async Task State_READ_ONLY()
         {
             try
             {
-                //TEST CODE
-                await BluetoothSetup.CreateClientSocketUtil();
-                await BluetoothSetup.ConnectSocketUtil();
-                if (BluetoothSocketState.Connected == BluetoothSetup.ClientState)
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
                 {
-                    Log.Debug(Globals.LogTag, "[TestCase][State_READ_ONLY][Socket] Pass");
-                    BluetoothHelper.DisplayPassLabel("State_READ_ONLY");
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
                     await ManualTest.WaitForConfirm();
+                    return;
                 }
-                else
-                {
-                    Assert.Fail("[TestCase][State_READ_ONLY][Socket] Failed");
-                }
+
+                await BluetoothSetup.ConnectSocketUtil();
+                Assert.IsInstanceOf<BluetoothSocketState>(BluetoothSetup.ClientState, "ClientState is not type of BluetoothSocketState");
+                Assert.AreEqual(BluetoothSetup.ClientState, BluetoothSocketState.Connected, "ClientState is not Connected");
+
                 await BluetoothSetup.DisconnectSocketUtil();
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("State_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -174,8 +178,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("State_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
index 25510c4..63dd8c1 100755 (executable)
@@ -12,39 +12,39 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("SocketData Tests")]
     public class SocketDataTests
     {
-        private static bool flagDataReceived = false;
-        static bool isBluetoothSupported = false;
+        private bool _flagDataReceived = false;
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
-            flagDataReceived = false;
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
+            _flagDataReceived = false;
         }
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
             BluetoothSetup.DestroyClientSocketUtil();
             BluetoothSetup.Data = null;
-            flagDataReceived = false;
+            _flagDataReceived = false;
         }
 
-        public static void DataReceivedClientEventHandler(object sender, SocketDataReceivedEventArgs args)
+        public void DataReceivedClientEventHandler(object sender, SocketDataReceivedEventArgs args)
         {
             BluetoothSetup.Data = args.Data;
-            flagDataReceived = true;
+            _flagDataReceived = true;
         }
 
-        public static async Task WaitClientDataReceivedFlag()
+        public async Task WaitClientDataReceivedFlag()
         {
             int count = 0;
             while(true)
             {
                 await Task.Delay(2000);
                 count++;
-                if (flagDataReceived)
+                if (_flagDataReceived)
                     break;
                 if (count == 15)
                     break;
@@ -65,11 +65,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button in client device")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task SocketFd_READ_ONLY()
+        public async Task SocketFd_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 BluetoothSetup.Client.DataReceived += DataReceivedClientEventHandler;
                 await WaitClientDataReceivedFlag();
@@ -84,7 +91,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("SocketFd_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -92,8 +99,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("SocketFd_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -118,11 +125,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button in client device")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task DataSize_READ_ONLY()
+        public async Task DataSize_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 BluetoothSetup.Client.DataReceived += DataReceivedClientEventHandler;
                 await WaitClientDataReceivedFlag();
@@ -133,10 +147,10 @@ namespace Tizen.Network.Bluetooth.Tests
 
                 BluetoothSetup.Client.DataReceived -= DataReceivedClientEventHandler;
                 await BluetoothSetup.DisconnectSocketUtil();
-               }
+            }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("DataSize_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -144,8 +158,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("DataSize_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
@@ -170,11 +184,18 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button in client device")]
         [Step(2, "When permission request popup appears, tap accept on server device.")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Data_READ_ONLY()
+        public async Task Data_READ_ONLY()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 BluetoothSetup.Client.DataReceived += DataReceivedClientEventHandler;
                 await WaitClientDataReceivedFlag();
@@ -190,7 +211,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY");
                     await ManualTest.WaitForConfirm();
@@ -198,8 +219,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY");
                     await ManualTest.WaitForConfirm();
                 }
index 6f1b995..278a952 100755 (executable)
@@ -12,43 +12,43 @@ namespace Tizen.Network.Bluetooth.Tests
     [Description("SocketDataReceivedEventArgs Tests")]
     public class SocketDataReceivedEventArgsTests
     {
-        private static bool flagClientDataReceived = false;
-        private static bool flagServerDataReceived = false;
-        static bool isBluetoothSupported = false;
+        private bool _flagClientDataReceived = false;
+        private bool _flagServerDataReceived = false;
+        private bool _isBluetoothSupported = false;
 
         [SetUp]
-        public static void Init()
+        public void Init()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
-            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
-            flagClientDataReceived = false;
-            flagServerDataReceived = false;
+            Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out _isBluetoothSupported);
+            _flagClientDataReceived = false;
+            _flagServerDataReceived = false;
         }
         [TearDown]
-        public static void Destroy()
+        public void Destroy()
         {
             LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
         }
 
-        public static async Task WaitClientDataReceivedFlag()
+        public async Task WaitClientDataReceivedFlag()
         {
             int count = 0;
             while(true)
             {
                 await Task.Delay(2000);
                 count++;
-                if (flagClientDataReceived)
+                if (_flagClientDataReceived)
                     break;
                 if (count == 15)
                     break;
             }
         }
 
-        public static void DataReceivedClientEventHandler(object sender, SocketDataReceivedEventArgs args)
+        public void DataReceivedClientEventHandler(object sender, SocketDataReceivedEventArgs args)
         {
             BluetoothSetup.Data = args.Data;
             Log.Info(Globals.LogTag, "DataReceived in client: "+args.Data.Data);
-            flagClientDataReceived = true;
+            _flagClientDataReceived = true;
         }
 
         [Test]
@@ -64,15 +64,22 @@ namespace Tizen.Network.Bluetooth.Tests
         [Precondition(4, "Should run this only after the TC IBluetoothServerSocketTests.SendData_SEND_DATA_TEST_SERVER is started in the server device")]
         [Step(1, "Tap the Run button in client device")]
         [Postcondition(1, "Unpair the server device")]
-        public static async Task Data_READ_ONLY_CLIENT()
+        public async Task Data_READ_ONLY_CLIENT()
         {
             try
             {
-                await BluetoothSetup.CreateClientSocketUtil();
+                BluetoothSetup.CreateClientSocketUtil();
+                if (BluetoothSetup.Client == null)
+                {
+                    ManualTest.DisplayCustomLabel("Precondition failed: Test device should be paired to the remote device.");
+                    await ManualTest.WaitForConfirm();
+                    return;
+                }
+
                 await BluetoothSetup.ConnectSocketUtil();
                 BluetoothSetup.Client.DataReceived += DataReceivedClientEventHandler;
                 await WaitClientDataReceivedFlag();
-                Assert.IsTrue(flagClientDataReceived, "[TestCase][Data_READ_ONLY_CLIENT][Socket] Failed");
+                Assert.IsTrue(_flagClientDataReceived, "[TestCase][Data_READ_ONLY_CLIENT][Socket] Failed");
 
                 BluetoothHelper.DisplayPassLabel("Data_READ_ONLY_CLIENT");
                 await ManualTest.WaitForConfirm();
@@ -83,7 +90,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY_CLIENT");
                     await ManualTest.WaitForConfirm();
@@ -91,8 +98,8 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
-                               {
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY_CLIENT");
                     await ManualTest.WaitForConfirm();
                 }
@@ -103,25 +110,25 @@ namespace Tizen.Network.Bluetooth.Tests
             }
         }
 
-        public static async Task WaitServerDataReceivedFlag()
+        public async Task WaitServerDataReceivedFlag()
         {
             int count = 0;
             while(true)
             {
                 await Task.Delay(2000);
                 count++;
-                if (flagServerDataReceived)
+                if (_flagServerDataReceived)
                     break;
                 if (count == 15)
                     break;
             }
         }
 
-        public static void DataReceivedServerEventHandler(object sender, SocketDataReceivedEventArgs args)
+        public void DataReceivedServerEventHandler(object sender, SocketDataReceivedEventArgs args)
         {
             BluetoothSetup.Data = args.Data;
             Log.Info(Globals.LogTag, "DataReceived in client: "+args.Data.Data);
-            flagServerDataReceived = true;
+            _flagServerDataReceived = true;
         }
 
         [Test]
@@ -137,7 +144,7 @@ namespace Tizen.Network.Bluetooth.Tests
         [Step(1, "Tap the Run button in server device")]
         [Step(2, "Run IBluetoothServerSocketTests.SendData_SEND_DATA_TEST_CLIENT in the client device immediately")]
         [Postcondition(1, "Unpair the client device")]
-        public static async Task Data_READ_ONLY_SERVER()
+        public async Task Data_READ_ONLY_SERVER()
         {
             try
             {
@@ -145,12 +152,12 @@ namespace Tizen.Network.Bluetooth.Tests
                 await BluetoothSetup.AcceptSocketUtil();
                 BluetoothSetup.Socket.DataReceived += DataReceivedServerEventHandler;
                 await WaitServerDataReceivedFlag();
-                Assert.IsTrue(flagServerDataReceived, "[TestCase][Data_READ_ONLY_SERVER][Socket] Failed");
+                Assert.IsTrue(_flagServerDataReceived, "[TestCase][Data_READ_ONLY_SERVER][Socket] Failed");
                 BluetoothSetup.Socket.DataReceived -= DataReceivedServerEventHandler;
             }
             catch (NotSupportedException)
             {
-                if (isBluetoothSupported == false)
+                if (_isBluetoothSupported == false)
                 {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY_SERVER");
                     await ManualTest.WaitForConfirm();
@@ -158,7 +165,7 @@ namespace Tizen.Network.Bluetooth.Tests
             }
             catch (TypeInitializationException e)
             {
-                if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
+                if (_isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
                 {
                     BluetoothHelper.DisplayLabel("Data_READ_ONLY_SERVER");
                     await ManualTest.WaitForConfirm();