Initial version.

This commit is contained in:
Oliver Hauff 2021-05-13 17:25:46 +02:00
parent 6bab491a21
commit 193aaa1a56
17 changed files with 3142 additions and 0 deletions

View file

@ -0,0 +1,188 @@
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;
namespace TestLockItBLE.Services.BluetoothLock.BLE
{
public class TestLockItBase
{
[Test]
public void TestName_Null()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'X', (byte)'D', (byte)'G', (byte)'x', (byte)'q', (byte)'M', (byte)'f', (byte)'A', (byte)'F', (byte)'q', (byte)'g', (byte)'N', (byte)'V', (byte)'r', (byte)'N', (byte)'Y' },
K_u = new byte[16]
}.Build();
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(Arg.Any<Guid>()).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns((string)null);
// Use factory to create LockIt-object.
var lockIt = LockItBaseTest.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.AreEqual(string.Empty, lockIt.Name);
}
[Test]
public void TestName()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'m', (byte)'x', (byte)'p', (byte)'J', (byte)'g', (byte)'D', (byte)'D', (byte)'i', (byte)'o', (byte)'T', (byte)'F', (byte)'M', (byte)'S', (byte)'E', (byte)'m', (byte)'E' },
K_u = new byte[16]
}.Build();
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(Arg.Any<Guid>()).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Use factory to create LockIt-object.
var lockIt = LockItBaseTest.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.AreEqual("ISHAREIT+123", lockIt.Name);
}
[Test]
public void TestId()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'l', (byte)'x', (byte)'p', (byte)'J', (byte)'g', (byte)'D', (byte)'D', (byte)'i', (byte)'o', (byte)'T', (byte)'F', (byte)'M', (byte)'S', (byte)'E', (byte)'m', (byte)'E' },
K_u = new byte[16]
}.Build();
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(Arg.Any<Guid>()).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Use factory to create LockIt-object.
var lockIt = LockItBaseTest.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.AreEqual(123, lockIt.Id);
}
[Test]
public void TestGuid()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'l', (byte)'x', (byte)'p', (byte)'J', (byte)'g', (byte)'D', (byte)'D', (byte)'i', (byte)'o', (byte)'T', (byte)'F', (byte)'M', (byte)'S', (byte)'E', (byte)'m', (byte)'E' },
K_u = new byte[16]
}.Build();
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(Arg.Any<Guid>()).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Use factory to create LockIt-object.
var lockIt = LockItBaseTest.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.AreEqual(new Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd"), lockIt.Guid);
}
/// <summary> Derives from LockItBase class for testing purposes. </summary>
private class LockItBaseTest : LockItBase
{
private LockItBaseTest(IDevice device, IAdapter adapter, ICipher cipher) : base(device, adapter, cipher)
{
}
/// <summary> Connects to device. </summary>
/// <param name="authInfo">Info required to connect.</param>
/// <param name="device">Device with must be connected.</param>
/// <returns>True if connecting succeeded, false if not.</returns>
public static async Task<LockItBase> Authenticate(
IDevice device,
LockInfoAuthTdo authInfo,
IAdapter adapter,
ICipher cipher)
=> await Authenticate(
device,
authInfo,
adapter,
cipher,
() => new LockItBaseTest(device, adapter, cipher));
public override Task<LockitLockingState?> CloseAsync()
{
throw new NotImplementedException();
}
public override Task<LockitLockingState?> OpenAsync()
{
throw new NotImplementedException();
}
public override Task ReconnectAsync(LockInfoAuthTdo authInfo, TimeSpan connectTimeout)
{
throw new NotImplementedException();
}
}
}
}

View file

@ -0,0 +1,315 @@
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;
namespace TestLockItBLE
{
public class Tests
{
[Test]
public void TestOpen()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var activateCharacteristic = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'p', (byte)'a', (byte)'w', (byte)'m', (byte)'X', (byte)'8', (byte)'T', (byte)'X', (byte)'Q', (byte)'Z', (byte)'d', (byte)'l', (byte)'k', (byte)'3', (byte)'e', (byte)'V', },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* State read before open action: closed */ }));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateCharacteristic));
activateCharacteristic.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.Open /* State passed as event argument after opening. */});
// Use factory to create LockIt-object.
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
var lockState = lockIt.OpenAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
Assert.That(lockState.Result, Is.EqualTo(LockitLockingState.Open));
}
[Test]
public void TestOpen_ThrowsCouldntOpenInconsistentStateExecption()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'m', (byte)'l', (byte)'Q', (byte)'I', (byte)'S', (byte)'z', (byte)'p', (byte)'H', (byte)'m', (byte)'n', (byte)'V', (byte)'n', (byte)'7', (byte)'f', (byte)'i', (byte)'3' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* State read before open action: closed */ }));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.Closed /* State passed as event argument after opening. */});
// Use factory to create LockIt-object.
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(async () =>
{
var lockState = lockIt.OpenAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
await lockState;
},
Throws.InstanceOf<CouldntOpenInconsistentStateExecption>());
}
[Test]
public void TestOpen_ThrowsCouldntOpenBoldBlockedException()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'i', (byte)'r', (byte)'F', (byte)'h', (byte)'G', (byte)'T', (byte)'z', (byte)'P', (byte)'F', (byte)'Z', (byte)'n', (byte)'z', (byte)'Y', (byte)'B', (byte)'s', (byte)'9' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
lockControl.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* closed */}), Task.FromResult(new byte[] { 4 /* bold blocked */ }));
lockControl.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.CouldntOpenBoldBlocked /* State passed as event argument after opening. */});
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
// Use factory to create LockIt-object.
Assert.That(async () =>
{
var lockState = lockIt.OpenAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
await lockState;
},
Throws.InstanceOf<CouldntOpenBoldBlockedException>());
}
[Test]
public void TestClose()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'I', (byte)'7', (byte)'y', (byte)'B', (byte)'f', (byte)'s', (byte)'v', (byte)'L', (byte)'G', (byte)'L', (byte)'7', (byte)'b', (byte)'7', (byte)'X', (byte)'z', (byte)'t' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to close functionality.
lockControl.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* open */ }), Task.FromResult(new byte[] { 1 /* closed */}));
lockControl.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.Closed /* State passed as event argument after closing. */});
// Use factory to create LockIt-object.
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
var lockState = lockIt.CloseAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
Assert.That(lockState.Result, Is.EqualTo(LockitLockingState.Closed));
}
[Test]
public void TestClose_ThrowsCouldntCloseInconsistentStateExecption()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'8', (byte)'q', (byte)'3', (byte)'9', (byte)'i', (byte)'6', (byte)'c', (byte)'g', (byte)'9', (byte)'L', (byte)'V', (byte)'7', (byte)'T', (byte)'G', (byte)'l', (byte)'f' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to close functionality.
lockControl.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* opened */}));
lockControl.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.Open /* State passed as event argument after closing. */});
// Use factory to create LockIt-object.
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
// Use factory to create LockIt-object.
Assert.That(async () =>
{
var lockState = lockIt.CloseAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
await lockState;
},
Throws.InstanceOf<CouldntCloseInconsistentStateExecption>());
}
[Test]
public void TestClose_ThrowsCouldntCloseBoldBlockedException()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var lockControl = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var stateCharacteristic = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'v', (byte)'f', (byte)'u', (byte)'v', (byte)'j', (byte)'E', (byte)'b', (byte)'x', (byte)'p', (byte)'z', (byte)'a', (byte)'h', (byte)'V', (byte)'5', (byte)'9', (byte)'i' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(lockControl));
lockControl.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to Close functionality.
lockControl.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* open */}));
lockControl.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
stateCharacteristic.Value.Returns(new byte[] { (byte)LockitLockingState.CouldntCloseBoldBlocked /* State passed as event argument after opening. */});
// Use factory to create LockIt-object.
var lockIt = LockItEventBased.Authenticate(device, authTdo, adapter, cipher).Result;
// Use factory to create LockIt-object.
Assert.That(async () =>
{
var lockState = lockIt.CloseAsync();
controlCharacteristic.ValueUpdated += Raise.EventWith(new object(), new CharacteristicUpdatedEventArgs(stateCharacteristic));
await lockState;
},
Throws.InstanceOf<CouldntCloseBoldBlockedException>());
}
}
}

View file

@ -0,0 +1,270 @@
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 System.Threading;
namespace TestLockItBLE.Services.BluetoothLock.BLE
{
public class TestLockItPolling
{
[Test]
public void TestOpen()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'o', (byte)'a', (byte)'w', (byte)'m', (byte)'X', (byte)'8', (byte)'T', (byte)'X', (byte)'Q', (byte)'Z', (byte)'d', (byte)'l', (byte)'k', (byte)'3', (byte)'e', (byte)'V', },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* state read after sending open commant: closed */ }), Task.FromResult(new byte[] { 0 /* state read after sending open commant: open */}));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(lockIt.OpenAsync().Result, Is.EqualTo(LockitLockingState.Open));
}
[Test]
public void TestOpen_ThrowsCouldntOpenInconsistentStateExecption()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'n', (byte)'l', (byte)'Q', (byte)'I', (byte)'S', (byte)'z', (byte)'p', (byte)'H', (byte)'m', (byte)'n', (byte)'V', (byte)'n', (byte)'7', (byte)'f', (byte)'i', (byte)'3' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* closed */})); // Closed is returned twice => Inconsistent state ....
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(async () => { var result = await lockIt.OpenAsync(); }, Throws.InstanceOf<CouldntOpenInconsistentStateExecption>());
}
[Test]
public void TestOpen_ThrowsCouldntOpenBoldBlockedException()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'h', (byte)'r', (byte)'F', (byte)'h', (byte)'G', (byte)'T', (byte)'z', (byte)'P', (byte)'F', (byte)'Z', (byte)'n', (byte)'z', (byte)'Y', (byte)'B', (byte)'s', (byte)'9' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to open functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 1 /* closed */}), Task.FromResult(new byte[] { 4 /* bold blocked */ }));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(async () => { var result = await lockIt.OpenAsync(); }, Throws.InstanceOf<CouldntOpenBoldBlockedException>());
}
[Test]
public void TestClose()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'H', (byte)'7', (byte)'y', (byte)'B', (byte)'f', (byte)'s', (byte)'v', (byte)'L', (byte)'G', (byte)'L', (byte)'7', (byte)'b', (byte)'7', (byte)'X', (byte)'z', (byte)'t' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to close functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* open */ }), Task.FromResult(new byte[] { 1 /* closed */}));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(lockIt.CloseAsync().Result, Is.EqualTo(LockitLockingState.Closed));
}
[Test]
public void TestClose_ThrowsCouldntOpenInconsistentStateExecption()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'7', (byte)'q', (byte)'3', (byte)'9', (byte)'i', (byte)'6', (byte)'c', (byte)'g', (byte)'9', (byte)'L', (byte)'V', (byte)'7', (byte)'T', (byte)'G', (byte)'l', (byte)'f' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to close functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* opened */}));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(async () => { var result = await lockIt.CloseAsync(); }, Throws.InstanceOf<CouldntCloseInconsistentStateExecption>());
}
[Test]
public void TestClose_ThrowsCouldntOpenBoldBlockedException()
{
var device = Substitute.For<IDevice>();
var adapter = Substitute.For<IAdapter>();
var cipher = Substitute.For<TINK.Model.Device.ICipher>();
var auth = Substitute.For<ICharacteristic>();
var controlService = Substitute.For<IService>();
var controlCharacteristic = Substitute.For<ICharacteristic>();
var activateLock = Substitute.For<ICharacteristic>();
var authTdo = new LockInfoAuthTdo.Builder
{
Id = 12,
K_seed = new byte[] { (byte)'u', (byte)'f', (byte)'u', (byte)'v', (byte)'j', (byte)'E', (byte)'b', (byte)'x', (byte)'p', (byte)'z', (byte)'a', (byte)'h', (byte)'V', (byte)'5', (byte)'9', (byte)'i' },
K_u = new byte[16]
}.Build();
// Calls related to Authenticate functionality.
device.State.Returns(DeviceState.Connected);
device.Id.Returns(new Guid("0000f00d-1212-efde-1523-785fef13d123"));
device.GetServiceAsync(Arg.Any<Guid>(), Arg.Any<CancellationToken>()).Returns(Task.FromResult(controlService));
controlService.GetCharacteristicAsync(new Guid("0000baab-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(auth));
auth.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
auth.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[8]));
cipher.Decrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[3]);
cipher.Encrypt(Arg.Any<byte[]>(), Arg.Any<byte[]>()).Returns(new byte[16]);
auth.WriteAsync(Arg.Any<byte[]>()).Returns(true);
device.Name.Returns("ISHAREIT+123");
// Calls related to Close functionality.
controlService.GetCharacteristicAsync(new Guid("0000baaa-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(controlCharacteristic));
controlCharacteristic.ReadAsync(Arg.Any<CancellationToken>()).Returns(Task.FromResult(new byte[] { 0 /* open */}), Task.FromResult(new byte[] { 5 /* bold blocked */ }));
controlService.GetCharacteristicAsync(new Guid("0000beee-1212-efde-1523-785fef13d123")).Returns(Task.FromResult(activateLock));
activateLock.WriteAsync(Arg.Any<byte[]>()).Returns(Task.FromResult(true));
// Use factory to create LockIt-object.
var lockIt = LockItPolling.Authenticate(device, authTdo, adapter, cipher).Result;
Assert.That(async () => { var result = await lockIt.CloseAsync(); }, Throws.InstanceOf<CouldntCloseBoldBlockedException>());
}
}
}

View file

@ -0,0 +1,69 @@
using NSubstitute;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.BLE;
using TINK.Services.BluetoothLock.Tdo;
namespace TestLockItBLE.Services.BluetoothLock.BLE
{
public class TestLockItServiceBase
{
[Test]
public async Task TestCheckReconnect_EmptyList()
{
var disconnectedDevice = Substitute.For<ILockService>();
disconnectedDevice.GetDeviceState().Returns(DeviceState.Disconnected);
var devices = new List<ILockService> { disconnectedDevice };
var locksInfo = new List<LockInfoAuthTdo>();
await LockItServiceBase.CheckReconnect(
devices,
locksInfo,
TimeSpan.FromSeconds(0));
await disconnectedDevice.DidNotReceive().ReconnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
}
[Test]
public async Task TestCheckReconnect_NoMatchingIdEntry()
{
var disconnectedDevice = Substitute.For<ILockService>();
disconnectedDevice.GetDeviceState().Returns(DeviceState.Disconnected);
disconnectedDevice.Name.Returns("ISHAREIT+334");
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() };
await LockItServiceBase.CheckReconnect(
devices,
locksInfo,
TimeSpan.FromSeconds(0));
await disconnectedDevice.DidNotReceive().ReconnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
}
[Test]
public async Task TestCheckReconnect()
{
var disconnectedDevice = Substitute.For<ILockService>();
disconnectedDevice.GetDeviceState().Returns(DeviceState.Disconnected);
disconnectedDevice.Name.Returns("ISHAREIT+992");
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() };
await LockItServiceBase.CheckReconnect(
devices,
locksInfo,
TimeSpan.FromSeconds(0));
await disconnectedDevice.Received().ReconnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
}
}
}

View file

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LockItBLE\LockItBLE.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31229.75
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestLockItBLE", "TestLockItBLE.csproj", "{B8B4495E-AFE4-4072-B13C-954955CFB45E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LockItBLE", "..\LockItBLE\LockItBLE.csproj", "{828D1E68-1DCC-45B1-B212-40AFDAE7A1D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B8B4495E-AFE4-4072-B13C-954955CFB45E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8B4495E-AFE4-4072-B13C-954955CFB45E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8B4495E-AFE4-4072-B13C-954955CFB45E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8B4495E-AFE4-4072-B13C-954955CFB45E}.Release|Any CPU.Build.0 = Release|Any CPU
{828D1E68-1DCC-45B1-B212-40AFDAE7A1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{828D1E68-1DCC-45B1-B212-40AFDAE7A1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{828D1E68-1DCC-45B1-B212-40AFDAE7A1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{828D1E68-1DCC-45B1-B212-40AFDAE7A1D7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3434CB05-4558-4AE4-A733-D5BE55DA0F12}
EndGlobalSection
EndGlobal