mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 04:26:29 +02:00
Version 3.0.312.
This commit is contained in:
parent
310ea37085
commit
fd0e63cf10
94 changed files with 3189 additions and 6352 deletions
|
@ -23,7 +23,7 @@ namespace TestTINKLib
|
|||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
RentalDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, lockType, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace TestTINKLib
|
|||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
RentalDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, lockType, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
|
|
|
@ -346,9 +346,13 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
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.TariffEntries["2"].Value, // FeeEuroPerHour
|
||||
Is.EqualTo("3.00 €/hour"));
|
||||
Assert.That(
|
||||
btBikeReserved.TariffDescription.TariffEntries["3"].Value, // MaxFeeEuroPerDay
|
||||
Is.EqualTo("10.00 €/day"));
|
||||
Assert.That(btBikeReserved.TariffDescription.Id, Is.EqualTo(5494));
|
||||
Assert.That(btBikeReserved.TariffDescription.Name, Is.EqualTo("Tester Basic"));
|
||||
Assert.That(btBikeReserved.StationId, Is.EqualTo("FR_103"));
|
||||
Assert.That(btBikeReserved.LockInfo.Id, Is.EqualTo(2302373));
|
||||
|
@ -367,9 +371,13 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
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.TariffEntries["2"].Value, // FeeEuroPerHour
|
||||
Is.EqualTo("2.50 €/hour"));
|
||||
Assert.That(
|
||||
btBikeRented.TariffDescription.TariffEntries["3"].Value, // MaxFeeEuroPerDay
|
||||
Is.EqualTo("10.00 €/day"));
|
||||
Assert.That(btBikeRented.TariffDescription.Id, Is.EqualTo(5494));
|
||||
Assert.That(btBikeRented.TariffDescription.Name, Is.EqualTo("Tester Basic"));
|
||||
Assert.That(btBikeRented.StationId, Is.EqualTo("103"));
|
||||
Assert.That(btBikeRented.LockInfo.Id, Is.EqualTo(2200537));
|
||||
|
@ -860,20 +868,20 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
Is.EqualTo("Tester Basic"));
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().Number,
|
||||
tariffDescription.Create().Id,
|
||||
Is.EqualTo(5494));
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FreeTimePerSession,
|
||||
Is.EqualTo(TimeSpan.FromMinutes(90)));
|
||||
tariffDescription.Create().TariffEntries["1"].Value, // Free time per session
|
||||
Is.EqualTo("1.50 hour(s)/day")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FeeEuroPerHour,
|
||||
Is.EqualTo(10.5));
|
||||
tariffDescription.Create().TariffEntries["2"].Value, // FeeEuroPerHour
|
||||
Is.EqualTo("10.50 €/hour")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().AboEuroPerMonth,
|
||||
Is.EqualTo(920.99));
|
||||
tariffDescription.Create().TariffEntries["4"].Value, // Abo euro per month
|
||||
Is.EqualTo("920.99 €/month"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -906,7 +914,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().Number,
|
||||
tariffDescription.Create().Id,
|
||||
Is.EqualTo(5494));
|
||||
}
|
||||
|
||||
|
@ -923,8 +931,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FreeTimePerSession,
|
||||
Is.EqualTo(TimeSpan.FromMinutes(90)));
|
||||
tariffDescription.Create().TariffEntries["1"].Value, // Free time per session
|
||||
Is.EqualTo("1.50 hour(s)/day")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -940,8 +948,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FeeEuroPerHour,
|
||||
Is.EqualTo(10.5));
|
||||
tariffDescription.Create().TariffEntries["2"].Value, // FeeEuroPerHour
|
||||
Is.EqualTo("10.50 €/hour")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -957,8 +965,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().AboEuroPerMonth,
|
||||
Is.EqualTo(920.99));
|
||||
tariffDescription.Create().TariffEntries["4"].Value, // Abo euro per month
|
||||
Is.EqualTo("920.99 €/month"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -979,7 +987,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().Number,
|
||||
tariffDescription.Create().Id,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -990,8 +998,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FreeTimePerSession,
|
||||
Is.EqualTo(TimeSpan.Zero));
|
||||
tariffDescription.Create().TariffEntries.ContainsKey("1"), // Free time per session
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1001,8 +1009,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().FeeEuroPerHour,
|
||||
Is.NaN);
|
||||
tariffDescription.Create().TariffEntries.ContainsKey("2"), // FeeEuroPerHour
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1012,8 +1020,8 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
tariffDescription.Create().AboEuroPerMonth,
|
||||
Is.NaN);
|
||||
tariffDescription.Create().TariffEntries.ContainsKey("4"), // Abo euro per month
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1028,7 +1036,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_Number_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TariffDescription)null).Number,
|
||||
BikeInfoFactory.Create((TariffDescription)null).Id,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -1036,24 +1044,24 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_FreeTimePerSession_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TariffDescription)null).FreeTimePerSession,
|
||||
Is.EqualTo(TimeSpan.Zero));
|
||||
BikeInfoFactory.Create((TariffDescription)null).TariffEntries.ContainsKey("1"), // Free time per session
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateTariffDescription_FeeEuroPerHour_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TariffDescription)null).FeeEuroPerHour,
|
||||
Is.NaN);
|
||||
BikeInfoFactory.Create((TariffDescription)null).TariffEntries.ContainsKey("2"), // FeeEuroPerHour
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateTariffDescription_AboEuroPerMonth_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TariffDescription)null).AboEuroPerMonth,
|
||||
Is.NaN);
|
||||
BikeInfoFactory.Create((TariffDescription)null).TariffEntries.ContainsKey("4"), // Abo euro per month
|
||||
Is.False);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1301,5 +1309,192 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
bookingFinished.MiniSurvey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescriptionEmpyJson()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<RentalDescription>(@"");
|
||||
|
||||
Assert.That(
|
||||
response.Create().Name,
|
||||
Is.Empty);
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries.Count,
|
||||
Is.EqualTo(0));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescription()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<RentalDescription>(
|
||||
@"{
|
||||
""id"": ""1"",
|
||||
""tarif_elements"" : {
|
||||
""6"": [
|
||||
""Gratis Mietzeit"",
|
||||
""30 Min / Tag""
|
||||
],
|
||||
""1"": [
|
||||
""Mietgebühr"",
|
||||
""2,00 € / 1 Std""
|
||||
],
|
||||
""4"": [
|
||||
""Max. Gebühr"",
|
||||
""40.00 € / Tag""
|
||||
]
|
||||
},
|
||||
""name"": ""REN E-Bike"",
|
||||
""rental_info"" : {
|
||||
""9"" : [
|
||||
""AGB"",
|
||||
""Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt""
|
||||
],
|
||||
""8"" : [
|
||||
""Tracking"",
|
||||
""Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!""
|
||||
]
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
response.Create().Name,
|
||||
Is.EqualTo("REN E-Bike"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().Id,
|
||||
Is.EqualTo(1));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries.Count,
|
||||
Is.EqualTo(3));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries.Count,
|
||||
Is.EqualTo(2));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["1"].Description,
|
||||
Is.EqualTo("Mietgebühr"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["1"].Value,
|
||||
Is.EqualTo("2,00 € / 1 Std"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["4"].Description,
|
||||
Is.EqualTo("Max. Gebühr"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["4"].Value,
|
||||
Is.EqualTo("40.00 € / Tag"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["6"].Description,
|
||||
Is.EqualTo("Gratis Mietzeit"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries["6"].Value,
|
||||
Is.EqualTo("30 Min / Tag"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries["8"].Key,
|
||||
Is.EqualTo("Tracking"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries["8"].Value,
|
||||
Is.EqualTo("Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries["9"].Key,
|
||||
Is.EqualTo("AGB"));
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries["9"].Value,
|
||||
Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescriptionDupeTarifElements()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<RentalDescription>(
|
||||
@"{
|
||||
""id"": ""1"",
|
||||
""tarif_elements"" : {
|
||||
""6"": [
|
||||
""Gratis Mietzeit"",
|
||||
""30 Min / Tag""
|
||||
],
|
||||
""6"": [
|
||||
""Mietgebühr"",
|
||||
""2,00 € / 1 Std""
|
||||
],
|
||||
""4"": [
|
||||
""Max. Gebühr"",
|
||||
""40.00 € / Tag""
|
||||
]
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries.Count,
|
||||
Is.EqualTo(2));
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescriptionDupeInfoElements()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<RentalDescription>(
|
||||
@"{
|
||||
""rental_info"" : {
|
||||
""9"" : [
|
||||
""AGB"",
|
||||
""Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt""
|
||||
],
|
||||
""9"" : [
|
||||
""Tracking"",
|
||||
""Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!""
|
||||
]
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries.Count,
|
||||
Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescriptionsNoTariffElements()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<RentalDescription>(
|
||||
@"{
|
||||
""rental_info"" : {
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
response.Create().TariffEntries,
|
||||
Is.Not.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateRentalDescriptionsNoInfoElements()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<RentalDescription>(
|
||||
@"{
|
||||
""rental_info"" : {
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
response.Create().InfoEntries,
|
||||
Is.Not.Null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue