Version 3.0.363

This commit is contained in:
Anja 2023-04-19 12:14:14 +02:00
parent 4ff3307997
commit 91d42552c7
212 changed files with 1799 additions and 1318 deletions

View file

@ -39,14 +39,6 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
}
}
[Test]
public void TestCtorCopyNull()
{
Assert.Throws<ArgumentNullException>(
() => new BikeInfo(null),
"Verify that no unspecific reference not set to... exception is thrown");
}
[Test]
public void TestCtorBikeNull()
{
@ -62,13 +54,5 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
() => new TestBikeInfoSubClass(new StateInfo(), new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(string.Empty, LockModel.ILockIt), null),
Throws.ArgumentNullException);
}
[Test]
public void TestCtorCopy()
{
Assert.That(
() => new BikeInfo(null),
Throws.ArgumentNullException);
}
}
}

View file

@ -21,6 +21,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
IEnumerable<string> group = null,
WheelType? wheelType = null,
TypeOfBike? typeOfBike = null,
AaRideType? aaRideType = null,
string description = null,
string stationId = null,
string stationName = null,
@ -28,7 +29,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
RentalDescription tariffDescription = null,
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(id, lockModel, wheelType, typeOfBike, description),
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(id, lockModel, wheelType, typeOfBike, aaRideType, description),
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
isDemo,
@ -53,7 +54,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
Assert.AreEqual(null, l_oBikeInfo.WheelType);
Assert.AreEqual(null, l_oBikeInfo.TypeOfBike);
l_oBikeInfo = new BikeInfoMutable("22", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo, "Test description", "23");
l_oBikeInfo = new BikeInfoMutable("22", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo, AaRideType.NoAaRide, "Test description", "23");
Assert.AreEqual("22", l_oBikeInfo.Id);
Assert.IsFalse(l_oBikeInfo.IsDemo);
Assert.AreEqual("23", l_oBikeInfo.StationId);
@ -61,93 +62,5 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
}
[Test]
public void TestConstructCopyBooked()
{
// State Booked
var bikeInfoSource = Substitute.For<IBikeInfo>();
var stateSource = Substitute.For<IStateInfo>();
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
bikeInfoSource.StationId.Returns("23");
bikeInfoSource.State.Returns(stateSource);
stateSource.Value.Returns(InUseStateEnum.Booked);
stateSource.From.Returns(new System.DateTime(2018, 01, 03));
stateSource.MailAddress.Returns("a@b");
stateSource.Code.Returns("234");
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
Assert.AreEqual(InUseStateEnum.Booked, bikeInfoTarget.State.Value);
Assert.AreEqual("22", bikeInfoTarget.Id);
Assert.AreEqual("23", bikeInfoTarget.StationId);
Assert.AreEqual("My Station Name", bikeInfoTarget.StationName);
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
Assert.AreEqual(InUseStateEnum.Booked, bikeInfoTarget.State.Value);
Assert.AreEqual(new System.DateTime(2018, 01, 03), bikeInfoTarget.State.From);
Assert.AreEqual("a@b", bikeInfoTarget.State.MailAddress);
}
[Test]
public void TestConstructCopyReserved()
{
// State Reserved
var bikeInfoSource = Substitute.For<IBikeInfo>();
var stateSource = Substitute.For<IStateInfo>();
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
bikeInfoSource.StationId.Returns("23");
bikeInfoSource.State.Returns(stateSource);
stateSource.Value.Returns(InUseStateEnum.Reserved);
stateSource.From.Returns(new System.DateTime(2018, 01, 03));
stateSource.MailAddress.Returns("a@b");
stateSource.Code.Returns("234");
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
Assert.AreEqual(InUseStateEnum.Reserved, bikeInfoTarget.State.Value);
Assert.AreEqual("22", bikeInfoTarget.Id);
Assert.AreEqual("23", bikeInfoTarget.StationId);
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
Assert.AreEqual(InUseStateEnum.Reserved, bikeInfoTarget.State.Value);
Assert.AreEqual(new System.DateTime(2018, 01, 03), bikeInfoTarget.State.From);
Assert.AreEqual("a@b", bikeInfoTarget.State.MailAddress);
}
[Test]
public void TestConstructCopyAvailable()
{
// State Disposable
var bikeInfoSource = Substitute.For<IBikeInfo>();
var stateSource = Substitute.For<IStateInfo>();
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
bikeInfoSource.StationId.Returns("23");
bikeInfoSource.State.Returns(stateSource);
stateSource.Value.Returns(InUseStateEnum.Disposable);
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
Assert.AreEqual(InUseStateEnum.Disposable, bikeInfoTarget.State.Value);
Assert.AreEqual("22", bikeInfoTarget.Id);
Assert.AreEqual("23", bikeInfoTarget.StationId);
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
Assert.AreEqual(InUseStateEnum.Disposable, bikeInfoTarget.State.Value);
Assert.IsNull(bikeInfoTarget.State.From);
}
[Test]
public void TestConstructBikeNull()
{
Assert.That(
() => new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(null, "My Station Name"),
Throws.ArgumentNullException);
}
}
}

View file

@ -19,6 +19,7 @@ namespace TestTINKLib
IEnumerable<string> group = null,
WheelType? wheelType = null,
TypeOfBike? typeOfBike = null,
AaRideType? aaRideType = null,
string description = null,
string stationId = null,
string stationName = null,
@ -26,7 +27,7 @@ namespace TestTINKLib
RentalDescription tariffDescription = null,
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(
new Bike(id, lockType, wheelType, typeOfBike, description),
new Bike(id, lockType, wheelType, typeOfBike, aaRideType, description),
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
isDemo,
@ -66,6 +67,7 @@ namespace TestTINKLib
new List<string> { "TINK" },
WheelType.Mono,
TypeOfBike.Allround,
AaRideType.NoAaRide,
"Test description",
"1");
@ -86,7 +88,7 @@ namespace TestTINKLib
"Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road.",
l_oBike.ToString());
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));
l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, true, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround, AaRideType.NoAaRide, "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());

View file

@ -23,13 +23,14 @@ namespace UITest.Fixtures.ViewModel
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,
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(
new Bike(id, lockModel, wheelType, typeOfBike, description),
new Bike(id, lockModel, wheelType, typeOfBike, aaRideType, description),
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
pisDemo,
@ -55,6 +56,7 @@ namespace UITest.Fixtures.ViewModel
new List<string> { "TINK" },
WheelType.Trike,
TypeOfBike.Cargo,
AaRideType.NoAaRide,
"Test description",
"3",
"Radstation",
@ -96,6 +98,7 @@ namespace UITest.Fixtures.ViewModel
new List<string> { "TINK" },
WheelType.Trike,
TypeOfBike.Cargo,
AaRideType.NoAaRide,
"Test description",
"3",
"Radstation",
@ -130,7 +133,7 @@ namespace UITest.Fixtures.ViewModel
/// </summary>
public static BikeViewModelBase TestStateText_LoggedIn_Booked(Func<TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable, User, BikeViewModelBase> p_oFactory)
{
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, AaRideType.NoAaRide, "Test description", "3");
// Update from Copri.
l_oBike.State.Load(