sharee.bike-App/TestShareeLib/Model/Bike/BluetoothLock/TestBikeInfo.cs

49 lines
2.7 KiB
C#
Raw Normal View History

2021-05-13 20:09:46 +02:00
using NUnit.Framework;
using System;
2022-04-25 22:15:15 +02:00
using TINK.Model.Bike;
2021-05-13 20:09:46 +02:00
using TINK.Model.Bike.BluetoothLock;
using TINK.Model.State;
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
{
[TestFixture]
public class TestBikeInfo
{
[Test]
public void TestCtorCopyNull()
{
2022-04-25 22:15:15 +02:00
Assert.Throws<ArgumentException>(
2021-05-13 20:09:46 +02:00
() => new BikeInfo(null, null),
"Verify that no unspecific reference not set to... exception is thrown");
2022-04-25 22:15:15 +02:00
Assert.Throws<ArgumentException>(
() => new BikeInfo(new TINK.Model.Bike.BC.BikeInfo("12", LockModel.ILockIt, "1"), null),
2021-05-13 20:09:46 +02:00
"Verify that no unspecific reference not set to... exception is thrown");
}
[Test]
public void TestCtorAvailable()
{
2021-06-26 20:57:55 +02:00
Assert.AreEqual ("12",new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").Id);
2022-01-04 18:59:16 +01:00
Assert.AreEqual("13", new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").StationId);
2021-06-26 20:57:55 +02:00
Assert.AreEqual(InUseStateEnum.Disposable, new BikeInfo("12", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").State.Value);
2021-05-13 20:09:46 +02:00
}
[Test]
public void TestCtorRequested()
{
2021-07-12 19:30:14 +02:00
Assert.AreEqual("12", new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null, null, dateTimeProvider: () => new DateTime(2019, 1, 1), false /*isDemo*/, null /*group*/, null /*wheelType*/, null /*typeOfBike*/, null /*description*/).Id);
Assert.AreEqual(112, new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020,1,1), "a@b", "13", null, null, dateTimeProvider: () => new DateTime(2019, 1, 1), false /*isDemo*/, null /*group*/, null /*wheelType*/, null /*typeOfBike*/, null /*description*/).LockInfo.Id);
Assert.AreEqual(InUseStateEnum.Reserved, new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null, null, dateTimeProvider: () => new DateTime(2019, 1, 1), false /*isDemo*/, null /*group*/, null /*wheelType*/, null /*typeOfBike*/, null /*description*/).State.Value);
2021-05-13 20:09:46 +02:00
}
[Test]
public void TestCtorBooked()
{
2021-06-26 20:57:55 +02:00
Assert.AreEqual("12", new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null /*operator uri*/).Id);
Assert.AreEqual(112, new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null /*operator uri*/).LockInfo.Id);
Assert.AreEqual(InUseStateEnum.Booked, new BikeInfo("12", 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null /*operator uri*/).State.Value);
2021-05-13 20:09:46 +02:00
}
}
}