mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-13 22:06:29 +01:00
175 lines
4.3 KiB
C#
175 lines
4.3 KiB
C#
using System;
|
|
using NUnit.Framework;
|
|
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
|
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|
{
|
|
[TestFixture]
|
|
public class TestLockInfo
|
|
{
|
|
[Test]
|
|
public void TestCtor()
|
|
{
|
|
Assert.AreEqual(
|
|
LockingState.UnknownDisconnected,
|
|
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());
|
|
}
|
|
}
|
|
}
|