mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 07:06:33 +01:00
95 lines
3.1 KiB
C#
95 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using NUnit.Framework;
|
|
using ShareeBike.Model.Bikes.BikeInfoNS;
|
|
using ShareeBike.Model.Bikes.BikeInfoNS.BikeNS;
|
|
using ShareeBike.Model.State;
|
|
|
|
namespace SharedBusinessLogic.Tests
|
|
{
|
|
[TestFixture]
|
|
class TestBikeMutable
|
|
{
|
|
private class BikeInfoMutable : ShareeBike.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable
|
|
{
|
|
public BikeInfoMutable(
|
|
string id,
|
|
LockModel lockType,
|
|
bool isDemo = false,
|
|
IEnumerable<string> group = null,
|
|
WheelType? wheelType = null,
|
|
TypeOfBike? typeOfBike = null,
|
|
AaRideType? aaRideType = 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, aaRideType, description),
|
|
new ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.DriveMutable(),
|
|
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
isDemo,
|
|
group,
|
|
stationId,
|
|
stationName,
|
|
operatorUri,
|
|
tariffDescription,
|
|
dateTimeProvider,
|
|
stateInfo)
|
|
{
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void TestConstruct()
|
|
{
|
|
var l_oBike = new BikeInfoMutable(
|
|
"42",
|
|
LockModel.ILockIt,
|
|
false,
|
|
new List<string> { "ShareeBike" },
|
|
WheelType.Two,
|
|
TypeOfBike.Cargo);
|
|
|
|
Assert.That(l_oBike.Id, Is.EqualTo("42"));
|
|
Assert.That(l_oBike.IsDemo, Is.False);
|
|
Assert.That(l_oBike.WheelType, Is.EqualTo(WheelType.Two));
|
|
Assert.That(l_oBike.TypeOfBike, Is.EqualTo(TypeOfBike.Cargo));
|
|
Assert.That(l_oBike.State.Value, Is.EqualTo(InUseStateEnum.Disposable));
|
|
Assert.That(l_oBike.StationId, Is.Null);
|
|
|
|
l_oBike = new BikeInfoMutable(
|
|
"17",
|
|
LockModel.ILockIt,
|
|
true,
|
|
new List<string> { "ShareeBike" },
|
|
WheelType.Mono,
|
|
TypeOfBike.Allround,
|
|
AaRideType.NoAaRide,
|
|
"Test description",
|
|
"1");
|
|
|
|
Assert.That(l_oBike.Id, Is.EqualTo("17"));
|
|
Assert.That(l_oBike.IsDemo, Is.True);
|
|
Assert.That(l_oBike.WheelType, Is.EqualTo(WheelType.Mono));
|
|
Assert.That(l_oBike.TypeOfBike, Is.EqualTo(TypeOfBike.Allround));
|
|
Assert.That(l_oBike.State.Value, Is.EqualTo(InUseStateEnum.Disposable));
|
|
Assert.That(l_oBike.StationId, Is.EqualTo("1"));
|
|
}
|
|
|
|
[Test]
|
|
public void TestToString()
|
|
{
|
|
var l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, false, new List<string> { "ShareeBike" }, WheelType.Two, TypeOfBike.Cargo, dateTimeProvider: () => new DateTime(1970, 1, 1));
|
|
|
|
Assert.That(
|
|
l_oBike.ToString(), Is.EqualTo("Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road."));
|
|
|
|
l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, true, new List<string> { "ShareeBike" }, WheelType.Trike, TypeOfBike.Allround, AaRideType.NoAaRide, "Test description", "5", dateTimeProvider: () => new DateTime(1970, 1, 1));
|
|
Assert.That(
|
|
l_oBike.ToString(), Is.EqualTo("Id=3, wheel(s)=Trike, type=Allround, demo=True, state=Disposable, location=Station 5."));
|
|
}
|
|
}
|
|
}
|