mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-20 20:16:30 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
|
@ -1,10 +1,10 @@
|
|||
using NSubstitute;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Plugin.BLE.Abstractions;
|
||||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
using TINK.Services.BluetoothLock.Exception;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
using DeviceState = Plugin.BLE.Abstractions.DeviceState;
|
||||
using Plugin.BLE.Abstractions.EventArgs;
|
||||
using System.Threading;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
using TINK.Services.BluetoothLock.Exception;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
using DeviceState = Plugin.BLE.Abstractions.DeviceState;
|
||||
|
||||
namespace TestLockItBLE
|
||||
{
|
||||
|
@ -101,12 +101,12 @@ namespace TestLockItBLE
|
|||
|
||||
// Use factory to create LockIt-object.
|
||||
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
|
||||
Assert.That(async () =>
|
||||
Assert.That(async () =>
|
||||
{
|
||||
var lockState = lockIt.OpenAsync();
|
||||
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
|
||||
await lockState;
|
||||
},
|
||||
},
|
||||
Throws.InstanceOf<CouldntOpenInconsistentStateExecption>());
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ namespace TestLockItBLE
|
|||
var controlCharacteristic = Substitute.For<ICharacteristic>();
|
||||
var activateLock = Substitute.For<ICharacteristic>();
|
||||
var stateCharacteristic = Substitute.For<ICharacteristic>();
|
||||
|
||||
|
||||
var authTdo = new LockInfoAuthTdo.Builder
|
||||
{
|
||||
Id = 12,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using NSubstitute;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Plugin.BLE.Abstractions.Contracts;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
using TINK.Services.BluetoothLock.Exception;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
using TINK.Services.BluetoothLock.Exception;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
using DeviceState = Plugin.BLE.Abstractions.DeviceState;
|
||||
using System.Threading;
|
||||
|
||||
namespace TestLockItBLE.Services.BluetoothLock.BLE
|
||||
{
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
using TINK.Services.BluetoothLock.Tdo;
|
||||
|
@ -22,7 +21,7 @@ namespace TestLockItBLE.Services.BluetoothLock.BLE
|
|||
|
||||
await LockItServiceBase.CheckReconnect(
|
||||
devices,
|
||||
locksInfo,
|
||||
locksInfo,
|
||||
TimeSpan.FromSeconds(0));
|
||||
|
||||
await disconnectedDevice.DidNotReceive().ReconnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
|
||||
|
@ -56,7 +55,7 @@ namespace TestLockItBLE.Services.BluetoothLock.BLE
|
|||
disconnectedDevice.Guid.Returns(new Guid("00000000-0000-0000-0000-000000000001"));
|
||||
|
||||
var devices = new List<ILockService> { disconnectedDevice };
|
||||
var locksInfo = new List<LockInfoAuthTdo> { new LockInfoAuthTdo.Builder { Id = 992, Guid = new Guid("00000000-0000-0000-0000-000000000002"), K_seed = new byte[] { 2 }, K_u = new byte[] { 3 }}.Build() };
|
||||
var locksInfo = new List<LockInfoAuthTdo> { new LockInfoAuthTdo.Builder { Id = 992, Guid = new Guid("00000000-0000-0000-0000-000000000002"), K_seed = new byte[] { 2 }, K_u = new byte[] { 3 } }.Build() };
|
||||
|
||||
await LockItServiceBase.CheckReconnect(
|
||||
devices,
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using NUnit.Framework;
|
||||
using TINK.Services.BluetoothLock.BLE;
|
||||
|
||||
namespace TestLockItBLE.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(TINK.Services.BluetoothLock.DeviceState.Connecting));
|
||||
break;
|
||||
|
||||
case Plugin.BLE.Abstractions.DeviceState.Connected:
|
||||
Assert.That(state.GetDeviceState(),
|
||||
Is.EqualTo(TINK.Services.BluetoothLock.DeviceState.Connected));
|
||||
break;
|
||||
|
||||
case Plugin.BLE.Abstractions.DeviceState.Disconnected:
|
||||
Assert.That(state.GetDeviceState(),
|
||||
Is.EqualTo(TINK.Services.BluetoothLock.DeviceState.Disconnected));
|
||||
break;
|
||||
|
||||
case Plugin.BLE.Abstractions.DeviceState.Limited:
|
||||
Assert.That(state.GetDeviceState(),
|
||||
Is.EqualTo(TINK.Services.BluetoothLock.DeviceState.Limited));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception($"Unexpected state {state} detected.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,13 +6,14 @@
|
|||
<IsPackable>false</IsPackable>
|
||||
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<ReleaseVersion>3.0</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NSubstitute" Version="4.3.0" />
|
||||
<PackageReference Include="NSubstitute" Version="4.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue