mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-06 02:56:32 +01:00
101 lines
4.3 KiB
C#
101 lines
4.3 KiB
C#
using System;
|
|
using NUnit.Framework;
|
|
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
|
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
|
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
|
using TINK.Model.State;
|
|
|
|
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|
{
|
|
[TestFixture]
|
|
public class TestBikeInfo
|
|
{
|
|
[Test]
|
|
public void TestCtorCopyNull() =>
|
|
Assert.Throws<ArgumentException>(
|
|
() => new BikeInfo(null, null),
|
|
"Verify that no unspecific reference not set to... exception is thrown");
|
|
|
|
[Test]
|
|
public void TestCtorAvailable()
|
|
{
|
|
Assert.AreEqual("12", new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").Id);
|
|
Assert.AreEqual("13", new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").StationId);
|
|
Assert.AreEqual(InUseStateEnum.Disposable, new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "13").State.Value);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorAvailableBikeNull()
|
|
{
|
|
Assert.That(
|
|
() => new BikeInfo(
|
|
null,
|
|
new Drive(),
|
|
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
5200544,
|
|
new Guid("00000000-0000-0000-0000-000000000001"),
|
|
"13"),
|
|
Throws.ArgumentNullException);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorRequested()
|
|
{
|
|
Assert.AreEqual("12", new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 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*/).Id);
|
|
Assert.AreEqual(112, new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 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*/).LockInfo.Id);
|
|
Assert.AreEqual(InUseStateEnum.Reserved, new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 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*/).State.Value);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorRequestedBikeNull()
|
|
{
|
|
Assert.That(
|
|
() => new BikeInfo(
|
|
null,
|
|
new Drive(),
|
|
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
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*/),
|
|
Throws.ArgumentNullException);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorBooked()
|
|
{
|
|
Assert.AreEqual("12", new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null /*operator uri*/).Id);
|
|
Assert.AreEqual(112, new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 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(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, 112, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b", "13", null /*operator uri*/).State.Value);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorBookedNull()
|
|
{
|
|
Assert.That(
|
|
() => new BikeInfo(
|
|
null,
|
|
new Drive(),
|
|
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
112,
|
|
new Guid(),
|
|
null,
|
|
null,
|
|
null,
|
|
new DateTime(2020, 1, 1),
|
|
"a@b",
|
|
"13",
|
|
null /*operator uri*/),
|
|
Throws.ArgumentNullException);
|
|
}
|
|
}
|
|
}
|