+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("TargetConnectionStateChangedEventArgs Tests")]
- public class TargetConnectionStateChangedEventArgsTests
- {
- static BluetoothAvrcp avrcpProfile = null;
- static BluetoothAudio audioProfile = null;
- static bool isBluetoothSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth", out isBluetoothSupported);
- }
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static void EventHandlerTargetConnectionChanged(object sender, TargetConnectionStateChangedEventArgs e)
- {
- if (e.IsConnected && e.Address != null)
- {
- ManualTest.Confirm();
- }
- }
-
- public static async Task Setup()
- {
- if (avrcpProfile == null || audioProfile == null)
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- Assert.IsNotNull(avrcpProfile, "Precondition failed: Avrcp Profile should not be null");
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- }
- avrcpProfile.TargetConnectionStateChanged += EventHandlerTargetConnectionChanged;
- audioProfile.Connect(BluetoothAudioProfileType.All);
- await ManualTest.WaitForConfirm();
-
- // POSTCONDITION
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- avrcpProfile.TargetConnectionStateChanged -= EventHandlerTargetConnectionChanged;
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test IsConnected. Check if IsConnected has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TargetConnectionStateChangedEventArgs.IsConnected A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Keep discoverable bluetooth headset device near the test device.")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task IsConnected_READ_ONLY()
- {
- try
- {
- await Setup();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothSupported == false)
- {
- BluetoothHelper.DisplayLabel("IsConnected_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("IsConnected_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test Address. Check if Address has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.TargetConnectionStateChangedEventArgs.Address A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Keep discoverable bluetooth headset device near the test device.")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task Address_READ_ONLY()
- {
- try
- {
- await Setup();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothSupported == false)
- {
- BluetoothHelper.DisplayLabel("Address_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Address_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}