Version 3.0.357

This commit is contained in:
Anja 2023-01-18 14:22:51 +01:00
parent 5980410182
commit 5c0b2e70c9
84 changed files with 1012 additions and 449 deletions

View file

@ -1,8 +1,10 @@
using System;
using System;
using System.Linq;
using Newtonsoft.Json;
using NUnit.Framework;
using TINK.Model;
using TINK.Model.Bikes;
using TINK.Model.Bikes.BikeInfoNS.BC;
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
using TINK.Model.Connector.Updater;
@ -164,8 +166,7 @@ namespace TestShareeLib.Model.Connector.Updater
public void TestUpdateBikesAvailable_BikeNr5GetBooked()
{
// Bike 5 is availalbe.
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(
);
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(DataSource.Copri);
Assert.AreEqual(12, l_oBikesTarget.Count, "Bike 5 is available an must be part of available bikes collection");
@ -180,16 +181,14 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is reserved.
// Count of bikes must decrease and bike #5 no more in list of bikes.
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 2).GetBikesAvailable(
);
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 2).GetBikesAvailable(DataSource.Copri);
Assert.AreEqual(11, l_oBikesTarget.Count, "One bike (nr. 5) got reserved");
Assert.Null(l_oBikesTarget.GetById("5"), "Bike 5 got requested and must not be part of available bikes collection");
// Bike 5 is booked.
// Count of bikes must decrease and bike #5 no more in list of bikes.
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 3).GetBikesAvailable(
);
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 3).GetBikesAvailable(DataSource.Copri);
Assert.Null(l_oBikesTarget.GetById("5"), "Bike 5 got booked and must not be part of available bikes collection");
Assert.IsNull(l_oBikesTarget.GetById("5"));
@ -200,7 +199,8 @@ namespace TestShareeLib.Model.Connector.Updater
{
var l_oBikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 1).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 8, 14)); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 8, 14), // Date time now for bikes which are reserved
DataSource.Copri);
// Check initial count of bikes.
Assert.AreEqual(
@ -210,7 +210,8 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is reserved
l_oBikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 2).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0))); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0)), // Date time now for bikes which are reserved
DataSource.Copri);
Assert.AreEqual(3, l_oBikesTarget.Count, "One bike (nr. 5) got reserved");
@ -225,7 +226,8 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is booked
l_oBikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 3).GetBikesOccupied(
"a@B",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(3, l_oBikesTarget.Count, "One bike (nr. 5) got booked");
@ -240,7 +242,7 @@ namespace TestShareeLib.Model.Connector.Updater
public void TestGetBikesAvailable_BikeNr5GetBooked()
{
// Bike 5 is availalbe.
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable();
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(DataSource.Copri);
Assert.AreEqual(11, l_oBikesTarget.Count, "Bike 5 is available an must be part of available bikes collection");
@ -255,14 +257,14 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is reserved.
// Count of bikes must decrease and bike #5 no more in list of bikes.
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 2).GetBikesAvailable();
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 2).GetBikesAvailable(DataSource.Copri);
Assert.AreEqual(10, l_oBikesTarget.Count, "One bike (nr. 5) got reserved");
Assert.Null(l_oBikesTarget.GetById("5"), "Bike 5 got requested and must not be part of available bikes collection");
// Bike 5 is booked.
// Count of bikes must decrease and bike #5 no more in list of bikes.
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 3).GetBikesAvailable();
l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 3).GetBikesAvailable(DataSource.Copri);
Assert.Null(l_oBikesTarget.GetById("5"), "Bike 5 got booked and must not be part of available bikes collection");
Assert.IsNull(l_oBikesTarget.GetById("5"));
@ -273,7 +275,8 @@ namespace TestShareeLib.Model.Connector.Updater
{
var bikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 1).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 8, 14)); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 8, 14), // Date time now for bikes which are reserved
DataSource.Copri);
// Check initial count of bikes.
Assert.AreEqual(2, bikesTarget.Count);
@ -281,7 +284,8 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is reserved
bikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 2).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0))); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0)), // Date time now for bikes which are reserved
DataSource.Copri);
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got reserved");
@ -296,7 +300,8 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is booked
bikesTarget = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 3).GetBikesOccupied(
"a@B",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got booked");
@ -314,7 +319,8 @@ namespace TestShareeLib.Model.Connector.Updater
{
var bikesTarget = GetBikesOccupied("5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", SampleSets.ShareeFr01_Set1, 1).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 8, 14)); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 8, 14), // Date time now for bikes which are reserved
DataSource.Copri);
// Check initial count of bikes.
Assert.AreEqual(2, bikesTarget.Count);
@ -322,7 +328,8 @@ namespace TestShareeLib.Model.Connector.Updater
// Bike 5 is reserved
bikesTarget = GetBikesOccupied("5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", SampleSets.ShareeFr01_Set1, 2).GetBikesOccupied(
"a@B",
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0))); // Date time now for bikes which are reserved
() => new DateTime(2017, 11, 28, 14, 08, 36).Add(new TimeSpan(0, 2, 0)), // Date time now for bikes which are reserved
DataSource.Copri);
Assert.AreEqual(3, bikesTarget.Count, "One bike (nr. 5) got reserved");
@ -379,8 +386,7 @@ namespace TestShareeLib.Model.Connector.Updater
[Test]
public void TestGetBikesAvailable()
{
var bikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(
);
var bikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(DataSource.Copri);
// Verify count of bikes
Assert.AreEqual(12, bikesTarget.Count);
@ -406,7 +412,8 @@ namespace TestShareeLib.Model.Connector.Updater
{
var l_oBikesTarget = GetBikesOccupied(TinkApp.MerchantId, SampleSets.Set2, 1).GetBikesOccupied(
"a@b",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
// Verify count of bikes
Assert.AreEqual(2, l_oBikesTarget.Count);
@ -436,11 +443,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
availableResponse?.bikes?.Values,
null,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
2,
@ -467,11 +475,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
availableResponse?.bikes?.Values,
null,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
0,
@ -495,11 +504,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
availableResponse?.bikes?.Values,
null,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
0,
@ -530,11 +540,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
availableResponse?.bikes?.Values,
null,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
0,
@ -567,11 +578,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
null,
reservedOccupiedResponse?.bikes_occupied?.Values,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
0,
@ -605,11 +617,12 @@ namespace TestShareeLib.Model.Connector.Updater
}
}");
var bikes = UpdaterJSON.GetBikesAll(
var bikes = BikeCollectionFactory.GetBikesAll(
null,
reservedOccupiedResponse?.bikes_occupied?.Values,
"Heinz.Mustermann@posteo.de",
() => DateTime.Now);
() => DateTime.Now,
DataSource.Copri);
Assert.AreEqual(
2,
@ -629,6 +642,7 @@ namespace TestShareeLib.Model.Connector.Updater
var bike = new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("17", LockModel.ILockIt),
new Drive(),
DataSource.Copri,
22,
new Guid("0000f00d-1212-efde-1523-785fef13d123"),
new[] { (byte)1, (byte)3, (byte)4 },
@ -666,7 +680,9 @@ namespace TestShareeLib.Model.Connector.Updater
{
// Construct occupied bike.
var bike = new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("17", LockModel.ILockIt), new Drive(),
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("17", LockModel.ILockIt),
new Drive(),
DataSource.Copri,
22,
new Guid("0000f00d-1212-efde-1523-785fef13d123"),
new[] { (byte)1, (byte)3, (byte)4 },
@ -702,6 +718,7 @@ namespace TestShareeLib.Model.Connector.Updater
var bike = new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfoMutable(new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("17", LockModel.ILockIt),
new Drive(),
DataSource.Copri,
22,
new Guid("0000f00d-1212-efde-1523-785fef13d123"),
new[] { (byte)1, (byte)3, (byte)4 },