[Bluetooth][Non-ACR] Add StartLeScan negative TC 22/241922/1
authorWootak Jung <wootak.jung@samsung.com>
Fri, 21 Aug 2020 01:29:40 +0000 (10:29 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 21 Aug 2020 01:29:40 +0000 (10:29 +0900)
Change-Id: I99c1b1f390d48c682578795c329c7b4c5a1ecd31
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
tct-suite-vs/Tizen.Bluetooth.Tests/testcase/TSBluetoothAdapter.cs

index a6e097ee29151a80f06cae34677ab6b3e3b4c2d7..b81de03992a7cb4823f79c8a77bdc4d06390d98f 100644 (file)
@@ -793,5 +793,45 @@ namespace Tizen.Network.Bluetooth.Tests
                 }
             }
         }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check if StartLeScan returns proper error")]
+        [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAdapter.StartLeScan M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Wootak Jung, wootak.jung@samsung.com")]
+        [Property("COVPARAM", "BluetoothLeScanMode")]
+        public static async Task StartLeScan_MODE_CHECK_EXCEPTION()
+        {
+            try
+            {
+                /* PRECONDITION
+                 * 1. Enable Bluetooth
+                 */
+                if (!BluetoothAdapter.IsBluetoothEnabled)
+                {
+                    Assert.Fail("Bluetooth is not enabled");
+                    return;
+                }
+
+                /* TEST CODE */
+                Assert.Throws<InvalidOperationException>(() =>
+                {
+                    BluetoothAdapter.StartLeScan((BluetoothLeScanMode)123);
+                }, "StartLeScan should throw InvalidOperationException");
+            }
+            catch (Exception ex)
+            {
+                if (ex is NotSupportedException)
+                {
+                    Assert.IsTrue(_isBluetoothLeSupported == false, "Invalid NotSupportedException");
+                }
+                else
+                {
+                    Assert.Fail("Throwing exception " + ex.ToString());
+                }
+            }
+        }
     }
 }