sharee.bike-App/TestTINKLib/Fixtures/ObjectTests/Bike/BluetoothLock/TestLockInfo.cs

156 lines
5.6 KiB
C#
Raw Permalink Normal View History

2021-07-12 21:31:46 +02:00
using NUnit.Framework;
using System;
using TINK.Model.Bike.BluetoothLock;
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
{
[TestFixture]
public class TestLockInfo
{
/// <summary>
/// Moved to TestShareeLib (.Net Core)
/// </summary>
[Test]
public void TestCtor()
{
Assert.AreEqual(
LockingState.Unknown,
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()
{
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());
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());
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());
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());
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());
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());
}
}
}