mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 23:26:26 +01:00
173 lines
5.9 KiB
C#
173 lines
5.9 KiB
C#
|
using NUnit.Framework;
|
|||
|
using System;
|
|||
|
using TINK.Model.Bike.BluetoothLock;
|
|||
|
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestLockInfo
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void TestCtor()
|
|||
|
{
|
|||
|
Assert.AreEqual(
|
|||
|
LockingState.Disconnected,
|
|||
|
new LockInfo.Builder { Id = 123 }.Build().State);
|
|||
|
|
|||
|
Assert.AreEqual(
|
|||
|
123,
|
|||
|
new LockInfo.Builder { Id = 123 }.Build().Id);
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEquals()
|
|||
|
{
|
|||
|
Assert.IsTrue(new LockInfo.Builder {
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed}.Build() == new LockInfo.Builder {
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_Id()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 3,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_Guid()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("1000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_Seed()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 5, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_UserKey()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 9, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_AdminKey()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 11, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestEqualsFalse_LockingState()
|
|||
|
{
|
|||
|
Assert.IsFalse(new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Closed
|
|||
|
}.Build() == new LockInfo.Builder
|
|||
|
{
|
|||
|
Id = 2,
|
|||
|
Guid = new Guid("0000f00d-1212-efde-1523-785fef13d123"),
|
|||
|
Seed = new byte[] { 1, 2 },
|
|||
|
UserKey = new byte[] { 7, 2 },
|
|||
|
AdminKey = new byte[] { 2, 1 },
|
|||
|
State = LockingState.Open
|
|||
|
}.Build());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|