sharee.bike-App/LockIt.BLE.Tests/Services/BluetoothLock/BLE/TestPluginBleHelper.cs
2024-04-09 12:53:23 +02:00

44 lines
1.2 KiB
C#

using System;
using NUnit.Framework;
using ShareeBike.Services.BluetoothLock.BLE;
namespace LockIt.BLE.Tests.Services.BluetoothLock.BLE
{
[TestFixture]
public class TestPluginBleHelper
{
[Test]
public void TestGetDeviceState()
{
foreach (Plugin.BLE.Abstractions.DeviceState state in Enum.GetValues(typeof(Plugin.BLE.Abstractions.DeviceState)))
{
switch (state)
{
case Plugin.BLE.Abstractions.DeviceState.Connecting:
Assert.That(state.GetDeviceState(),
Is.EqualTo(ShareeBike.Services.BluetoothLock.DeviceState.Connecting));
break;
case Plugin.BLE.Abstractions.DeviceState.Connected:
Assert.That(state.GetDeviceState(),
Is.EqualTo(ShareeBike.Services.BluetoothLock.DeviceState.Connected));
break;
case Plugin.BLE.Abstractions.DeviceState.Disconnected:
Assert.That(state.GetDeviceState(),
Is.EqualTo(ShareeBike.Services.BluetoothLock.DeviceState.Disconnected));
break;
case Plugin.BLE.Abstractions.DeviceState.Limited:
Assert.That(state.GetDeviceState(),
Is.EqualTo(ShareeBike.Services.BluetoothLock.DeviceState.Limited));
break;
default:
throw new Exception($"Unexpected state {state} detected.");
}
}
}
}
}