2021-05-13 20:09:46 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using NUnit.Framework;
|
2022-08-30 15:42:25 +02:00
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS;
|
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
2021-05-13 20:09:46 +02:00
|
|
|
|
using TINK.Model.State;
|
|
|
|
|
|
|
|
|
|
namespace TestTINKLib
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
class TestBikeMutable
|
|
|
|
|
{
|
|
|
|
|
private class BikeInfoMutable : TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable
|
|
|
|
|
{
|
|
|
|
|
public BikeInfoMutable(
|
|
|
|
|
string id,
|
|
|
|
|
LockModel lockType,
|
|
|
|
|
bool isDemo = false,
|
|
|
|
|
IEnumerable<string> group = null,
|
|
|
|
|
WheelType? wheelType = null,
|
|
|
|
|
TypeOfBike? typeOfBike = null,
|
|
|
|
|
string description = null,
|
|
|
|
|
string stationId = null,
|
|
|
|
|
string stationName = null,
|
|
|
|
|
Uri operatorUri = null,
|
|
|
|
|
RentalDescription tariffDescription = null,
|
|
|
|
|
Func<DateTime> dateTimeProvider = null,
|
|
|
|
|
IStateInfo stateInfo = null) : base(
|
|
|
|
|
new Bike(id, lockType, wheelType, typeOfBike, description),
|
|
|
|
|
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
|
|
|
|
|
isDemo,
|
|
|
|
|
group,
|
|
|
|
|
stationId,
|
|
|
|
|
stationName,
|
|
|
|
|
operatorUri,
|
|
|
|
|
tariffDescription,
|
|
|
|
|
dateTimeProvider,
|
|
|
|
|
stateInfo)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestConstruct()
|
|
|
|
|
{
|
|
|
|
|
var l_oBike = new BikeInfoMutable(
|
|
|
|
|
"42",
|
|
|
|
|
LockModel.ILockIt,
|
|
|
|
|
false,
|
|
|
|
|
new List<string> { "TINK" },
|
|
|
|
|
WheelType.Two,
|
|
|
|
|
TypeOfBike.Cargo);
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual("42", l_oBike.Id);
|
|
|
|
|
Assert.IsFalse(l_oBike.IsDemo);
|
|
|
|
|
Assert.AreEqual(WheelType.Two, l_oBike.WheelType);
|
|
|
|
|
Assert.AreEqual(TypeOfBike.Cargo, l_oBike.TypeOfBike);
|
|
|
|
|
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
|
|
|
|
|
Assert.IsNull(l_oBike.StationId);
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
l_oBike = new BikeInfoMutable(
|
|
|
|
|
"17",
|
|
|
|
|
LockModel.ILockIt,
|
|
|
|
|
true,
|
|
|
|
|
new List<string> { "TINK" },
|
|
|
|
|
WheelType.Mono,
|
|
|
|
|
TypeOfBike.Allround,
|
|
|
|
|
"Test description",
|
|
|
|
|
"1");
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual("17", l_oBike.Id);
|
|
|
|
|
Assert.IsTrue(l_oBike.IsDemo);
|
|
|
|
|
Assert.AreEqual(WheelType.Mono, l_oBike.WheelType);
|
|
|
|
|
Assert.AreEqual(TypeOfBike.Allround, l_oBike.TypeOfBike);
|
|
|
|
|
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
|
|
|
|
|
Assert.AreEqual("1", l_oBike.StationId);
|
|
|
|
|
}
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestToString()
|
|
|
|
|
{
|
|
|
|
|
var l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, dateTimeProvider: () => new DateTime(1970, 1, 1));
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road.",
|
|
|
|
|
l_oBike.ToString());
|
2021-05-13 20:09:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, true, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "5", dateTimeProvider: () => new DateTime(1970, 1, 1));
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"Id=3, wheel(s)=Trike, type=Allround, demo=True, state=Disposable, location=Station 5.",
|
|
|
|
|
l_oBike.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 20:09:46 +02:00
|
|
|
|
}
|