Version 3.0.239

This commit is contained in:
Oliver Hauff 2021-07-12 19:30:14 +02:00
parent 2a2d814243
commit 553eaaa4e0
15 changed files with 773 additions and 180 deletions

View file

@ -9,7 +9,6 @@ using UITest.Fixtures.Connector;
namespace TestTINKLib.Fixtures.Misc
{
[TestFixture]
[Explicit("Run with care because this stress impact live system.")]
[Category(TestCopriCallsHttps.CATEGORY_REQUIRESCOPRI)]
public class TestCachetimings
{

View file

@ -154,48 +154,109 @@ namespace TestTINKLib.Fixtures.Connector
}
[Test]
public void TestGetBikesOccupied_BikeNr5GetBooked()
public void TestGetBikesOccupied_BC_BikeNr5GetBooked()
{
var l_oBikesTarget = UpdaterJSON.GetBikesOccupied(
var bikesTarget = UpdaterJSON.GetBikesOccupied(
GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 1),
"a@B",
() => new DateTime(2017, 11, 28, 14, 8, 14)); // Date time now for bikes which are reserved
// Check initial count of bikes.
Assert.AreEqual(2, l_oBikesTarget.Count);
Assert.AreEqual(2, bikesTarget.Count);
// Bike 5 is reserved
l_oBikesTarget = UpdaterJSON.GetBikesOccupied(
bikesTarget = UpdaterJSON.GetBikesOccupied(
GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 2),
"a@B",
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0))); // Date time now for bikes which are reserved
Assert.AreEqual(3, l_oBikesTarget.Count, "One bike (nr. 5) got reserved");
Assert.NotNull(l_oBikesTarget.GetById("5"));
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikesTarget.GetById("5").State.Value);
Assert.AreEqual("5", l_oBikesTarget.GetById("5").Id);
Assert.AreEqual(TypeOfBike.Cargo, l_oBikesTarget.GetById("5").TypeOfBike);
Assert.AreEqual(WheelType.Two, l_oBikesTarget.GetById("5").WheelType);
Assert.AreEqual(DateTime.Parse("2017-11-28 14:07:13.745568+01"), l_oBikesTarget.GetById("5").State.From); // Sommer/ Winterzeit!
Assert.AreEqual("2360", l_oBikesTarget.GetById("5").State.Code);
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got reserved");
Assert.NotNull(bikesTarget.GetById("5"));
Assert.AreEqual(InUseStateEnum.Reserved, bikesTarget.GetById("5").State.Value);
Assert.AreEqual("5", bikesTarget.GetById("5").Id);
Assert.AreEqual("Cargo Long", bikesTarget.GetById("5").Description);
Assert.AreEqual(TypeOfBike.Cargo, bikesTarget.GetById("5").TypeOfBike);
Assert.AreEqual(WheelType.Two, bikesTarget.GetById("5").WheelType);
Assert.AreEqual(DateTime.Parse("2017-11-28 14:07:13.745568+01"), bikesTarget.GetById("5").State.From); // Sommer/ Winterzeit!
Assert.AreEqual("2360", bikesTarget.GetById("5").State.Code);
// Bike 5 is booked
l_oBikesTarget = UpdaterJSON.GetBikesOccupied(
bikesTarget = UpdaterJSON.GetBikesOccupied(
CopriCallsMemory.GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 3),
"a@B",
() => DateTime.Now);
Assert.AreEqual(3, l_oBikesTarget.Count, "One bike (nr. 5) got booked");
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got booked");
Assert.IsNotNull(l_oBikesTarget.GetById("5"));
Assert.AreEqual(InUseStateEnum.Booked, l_oBikesTarget.GetById("5").State.Value);
Assert.AreEqual("5", l_oBikesTarget.GetById("5").Id);
Assert.AreEqual(TypeOfBike.Cargo, l_oBikesTarget.GetById("5").TypeOfBike);
Assert.AreEqual(WheelType.Two, l_oBikesTarget.GetById("5").WheelType);
Assert.AreEqual(DateTime.Parse("2017 -11-28 14:08:32.756368+01"), l_oBikesTarget.GetById("5").State.From); // Sommer/ Winterzeit!
Assert.AreEqual("2360", l_oBikesTarget.GetById("5").State.Code);
Assert.IsNotNull(bikesTarget.GetById("5"));
Assert.AreEqual(InUseStateEnum.Booked, bikesTarget.GetById("5").State.Value);
Assert.AreEqual("5", bikesTarget.GetById("5").Id);
Assert.AreEqual("Cargo Long", bikesTarget.GetById("5").Description);
Assert.AreEqual(TypeOfBike.Cargo, bikesTarget.GetById("5").TypeOfBike);
Assert.AreEqual(WheelType.Two, bikesTarget.GetById("5").WheelType);
Assert.AreEqual(DateTime.Parse("2017 -11-28 14:08:32.756368+01"), bikesTarget.GetById("5").State.From); // Sommer/ Winterzeit!
Assert.AreEqual("2360", bikesTarget.GetById("5").State.Code);
}
[Test]
public void TestGetBikesOccupied_Bt_BikeNr5GetBooked()
{
var bikesTarget = UpdaterJSON.GetBikesOccupied(
GetBikesOccupied("5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", SampleSets.ShareeFr01_Set1, 1),
"a@B",
() => new DateTime(2017, 11, 28, 14, 8, 14)); // Date time now for bikes which are reserved
// Check initial count of bikes.
Assert.AreEqual(2, bikesTarget.Count);
// Bike 5 is reserved
bikesTarget = UpdaterJSON.GetBikesOccupied(
GetBikesOccupied("5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", SampleSets.ShareeFr01_Set1, 2),
"a@B",
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0))); // Date time now for bikes which are reserved
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got reserved");
var btBikeReserved = bikesTarget.GetById("FR_1004") as BikeInfo;
Assert.NotNull(btBikeReserved);
Assert.AreEqual(InUseStateEnum.Reserved, bikesTarget.GetById("FR_1004").State.Value);
Assert.AreEqual("FR_1004", btBikeReserved.Id);
Assert.AreEqual("Tester-bike Oliver 2", btBikeReserved.Description);
Assert.That(btBikeReserved.TypeOfBike, Is.Null);
Assert.That(btBikeReserved.WheelType, Is.Null);
Assert.AreEqual(DateTime.Parse("2021-07-04 17:46:36.237404+02"), btBikeReserved.State.From); // Sommer/ Winterzeit!
Assert.That(btBikeReserved.State.Code, Is.EqualTo(string.Empty), "Not needed for bt bikes.");
Assert.That(btBikeReserved.TariffDescription.FeeEuroPerHour, Is.EqualTo(3));
Assert.That(btBikeReserved.TariffDescription.MaxFeeEuroPerDay, Is.EqualTo(10));
Assert.That(btBikeReserved.TariffDescription.Number, Is.EqualTo(5494));
Assert.That(btBikeReserved.TariffDescription.Name, Is.EqualTo("Tester Basic"));
Assert.That(btBikeReserved.CurrentStation, Is.EqualTo("FR_103"));
Assert.That(btBikeReserved.LockInfo.Id, Is.EqualTo(2302373));
Assert.That(btBikeReserved.OperatorUri.AbsoluteUri, Does.Contain("https://shareeapp-fr01.copri.eu"));
Assert.That(btBikeReserved.Group.Count, Is.EqualTo(1));
Assert.That(btBikeReserved.Group.ToArray()[0], Is.EqualTo("FR_300029"));
// Bike 5 is booked
var btBikeRented = bikesTarget.GetById("1537") as BikeInfo;
Assert.IsNotNull(btBikeRented);
Assert.AreEqual(InUseStateEnum.Booked, btBikeRented.State.Value);
Assert.AreEqual("1537", btBikeRented.Id);
Assert.AreEqual("Oliver (Ilockit)", btBikeRented.Description);
Assert.That(btBikeRented.TypeOfBike, Is.Null);
Assert.That(btBikeRented.WheelType, Is.Null);
Assert.AreEqual(DateTime.Parse("2020-10-12 08:38:30.401679+02"), btBikeRented.State.From); // Sommer/ Winterzeit!
Assert.AreEqual(string.Empty, btBikeRented.State.Code, "Not needed for bt bikes.");
Assert.That(btBikeRented.TariffDescription.FeeEuroPerHour, Is.EqualTo(2.5));
Assert.That(btBikeRented.TariffDescription.MaxFeeEuroPerDay, Is.EqualTo(10));
Assert.That(btBikeRented.TariffDescription.Number, Is.EqualTo(5494));
Assert.That(btBikeRented.TariffDescription.Name, Is.EqualTo("Tester Basic"));
Assert.That(btBikeRented.CurrentStation, Is.EqualTo("103"));
Assert.That(btBikeRented.LockInfo.Id, Is.EqualTo(2200537));
Assert.That(btBikeRented.OperatorUri.AbsoluteUri, Does.Contain("https://shareeapp-fr01.copri.eu"));
Assert.That(btBikeRented.Group.Count, Is.EqualTo(1));
Assert.That(btBikeRented.Group.ToArray()[0], Is.EqualTo("300029"));
}
@ -491,7 +552,12 @@ namespace TestTINKLib.Fixtures.Connector
"1",
null,
null,
() => DateTime.Now));
() => DateTime.Now,
false, /*isDemo*/
null, /*group*/
null, /*wheelType*/
null, /*typeOfBike*/
null /*description*/));
var response = JsonConvert.DeserializeObject<BikeInfoReservedOrBooked>(@"
{
@ -559,7 +625,12 @@ namespace TestTINKLib.Fixtures.Connector
"1",
null,
null,
() => DateTime.Now));
() => DateTime.Now,
false, /*isDemo*/
null, /*group*/
null, /*wheelType*/
null, /*typeOfBike*/
null /*description*/));
Assert.AreEqual(InUseStateEnum.Reserved, bike.State.Value);