mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 04:46:30 +02:00
Version 3.0.364
This commit is contained in:
parent
91d42552c7
commit
0b9196a78d
91 changed files with 3452 additions and 555 deletions
|
@ -121,7 +121,7 @@ namespace TestShareeLib.Model.Connector
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreate_Available_CorpiLock_FeedbackPending()
|
||||
public void TestCreate_Available_CopriLock_FeedbackPending()
|
||||
{
|
||||
var bikeInfoResponse = JsonConvert.DeserializeObject<BikeInfoAvailable>(
|
||||
@"{
|
||||
|
|
|
@ -32,17 +32,31 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
}
|
||||
}";
|
||||
|
||||
private const string STATIONSALL = @"{
|
||||
/// <summary>
|
||||
/// Holds the response on stations_available request.
|
||||
/// </summary>
|
||||
/// <remarks> V1: Did not hold station_type entry.</remarks>
|
||||
private const string STATIONSALLV2 = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""stations"" : {
|
||||
""5"" : {
|
||||
""station"" : ""5"",
|
||||
""9"" : {
|
||||
""station"" : ""9"",
|
||||
""bike_soll"" : ""0"",
|
||||
""bike_ist"" : ""7"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.66756"", ""longitude"": ""9.16477"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : """"
|
||||
""description"" : """",
|
||||
""station_type"": {
|
||||
""Cargobike"": {
|
||||
""bike_count"": ""1"",
|
||||
""bike_group"": ""TINK""
|
||||
},
|
||||
""Citybike"": {
|
||||
""bike_count"": ""0"",
|
||||
""bike_group"": ""FR300103""
|
||||
}
|
||||
}
|
||||
},
|
||||
""13"" : {
|
||||
""station"" : ""13"",
|
||||
|
@ -91,53 +105,19 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
var server = Substitute.For<ICachedCopriServer>();
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2),
|
||||
new GeneralData(),
|
||||
new System.Exception("Bang when getting stations..."))));
|
||||
|
||||
server.GetBikesAvailable(true).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQuery(server).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(1, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(1, result.Response.StationsAll["9"].BikeGroups.AvailableCount);
|
||||
Assert.AreEqual(0, result.Response.BikesOccupied.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.AreEqual("Bang when getting stations...", result.Exception.Message);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations_BikesAvailableFromCache()
|
||||
{
|
||||
var server = Substitute.For<ICachedCopriServer>();
|
||||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLEMPTY),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesAvailable(false).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData(),
|
||||
new System.Exception("Bang when getting bikes..."))));
|
||||
|
||||
server.GetStations(true).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQuery(server).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(1, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.AreEqual("Bang when getting bikes...", result.Exception.Message);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations()
|
||||
{
|
||||
|
@ -145,18 +125,14 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesAvailable(false).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQuery(server).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(1, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(1, result.Response.StationsAll["9"].BikeGroups.AvailableCount);
|
||||
Assert.AreEqual(0, result.Response.BikesOccupied.Count, "There are no reserved or occupied bikes.");
|
||||
Assert.AreEqual(typeof(CopriCallsHttps), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
|
|
|
@ -398,6 +398,72 @@ namespace TestShareeLib.Model.Connector
|
|||
""apiserver"" : ""https://tinkwwp.copri-bike.de""
|
||||
}";
|
||||
|
||||
/// <summary>
|
||||
/// Response updated (manually edited) combining JSON form responses <see cref="STATIONSALL"/> and <see cref="BIKESOCCUPIED"/>
|
||||
/// </summary>
|
||||
private const string STATIONSALLV2 = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""stations"" : {
|
||||
""5"" : {
|
||||
""station"" : ""5"",
|
||||
""bike_soll"" : ""0"",
|
||||
""bike_ist"" : ""7"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.66756"", ""longitude"": ""9.16477"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : """"
|
||||
},
|
||||
""13"" : {
|
||||
""station"" : ""13"",
|
||||
""bike_soll"" : ""4"",
|
||||
""bike_ist"" : ""1"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.657756"", ""longitude"": ""9.176084"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : """"
|
||||
},
|
||||
""30"" : {
|
||||
""station"" : ""30"",
|
||||
""bike_soll"" : ""5"",
|
||||
""bike_ist"" : ""0"",
|
||||
""station_group"" : [ ""TINK"", ""Konrad"" ],
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Test für Stadtradstation""
|
||||
}
|
||||
},
|
||||
""bikes_occupied"" : {
|
||||
""89004"" : {
|
||||
""start_time"" : ""2018-01-27 17:33:00.989464+01"",
|
||||
""station"" : ""9"",
|
||||
""unit_price"" : ""2.00"",
|
||||
""tariff_description"": {
|
||||
""free_hours"" : ""0.5"",
|
||||
""name"" : ""TINK Tarif"",
|
||||
""max_eur_per_day"" : ""9.00""
|
||||
},
|
||||
""timeCode"" : ""2061"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike"" : ""4"",
|
||||
""total_price"" : ""20.00"",
|
||||
""state"" : ""requested"",
|
||||
""real_hours"" : ""66.05"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""now_time"" : ""2018-01-30 11:36:45"",
|
||||
""request_time"" : ""2018-01-27 17:33:00.989464+01"",
|
||||
""computed_hours"" : ""10.0""
|
||||
}
|
||||
},
|
||||
|
||||
""user_group"" : [ ""Konrad"", ""TINK"" ],
|
||||
""response_state"" : ""OK"",
|
||||
""authcookie"" : ""6103_f782a208d9399291ba8d086b5dcc2509_12345678"",
|
||||
""debuglevel"" : ""2"",
|
||||
""response"" : ""stations_all"",
|
||||
""user_id"" : ""javaminister@gmail.com"",
|
||||
""apiserver"" : ""https://tinkwwp.copri-bike.de""
|
||||
}";
|
||||
|
||||
private const string STATIONSALLEMPTY = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""stations"" : {
|
||||
|
@ -418,101 +484,18 @@ namespace TestShareeLib.Model.Connector
|
|||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2),
|
||||
new GeneralData(),
|
||||
new System.Exception("Bang when getting stations..."))));
|
||||
|
||||
server.GetBikesAvailable(true).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesOccupied(true).Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
new GeneralData())));
|
||||
new Exception("Bang when getting stations..."))));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(1, result.Response.BikesOccupied.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.AreEqual("Bang when getting stations...", result.Exception.Message);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations_BikesAvailableFromCache()
|
||||
{
|
||||
var server = Substitute.For<ICachedCopriServer>();
|
||||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLEMPTY),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesAvailable(false).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData(),
|
||||
new System.Exception("Bang when getting bikes..."))));
|
||||
|
||||
server.GetBikesOccupied(true).Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetStations(true).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.AreEqual("Bang when getting bikes...", result.Exception.Message);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations_BikesOccupiedFromCache()
|
||||
{
|
||||
var server = Substitute.For<ICachedCopriServer>();
|
||||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLEMPTY),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesAvailable(false).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLEEMPTY),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesOccupied(false).Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
new GeneralData(),
|
||||
new System.Exception("Bang when getting bikes occupied..."))));
|
||||
|
||||
server.GetBikesAvailable(true).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetStations(true).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsMonkeyStore),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.AreEqual("Bang when getting bikes occupied...", result.Exception.Message);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations()
|
||||
{
|
||||
|
@ -520,23 +503,13 @@ namespace TestShareeLib.Model.Connector
|
|||
|
||||
server.GetStations(false).Returns(Task.Run(() => new Result<StationsAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesAvailable(false).Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesOccupied(false).Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2),
|
||||
new GeneralData())));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(1, result.Response.BikesOccupied.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsHttps), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
|
|
|
@ -29,17 +29,31 @@ namespace TestTINKLib.Fixtures.ObjectTests.Query
|
|||
}
|
||||
}";
|
||||
|
||||
private const string STATIONSALL = @"{
|
||||
/// <summary>
|
||||
/// Holds the response on stations_available request.
|
||||
/// </summary>
|
||||
/// <remarks> V1: Did not hold station_type entry.</remarks>
|
||||
private const string STATIONSALLV2 = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""stations"" : {
|
||||
""5"" : {
|
||||
""station"" : ""5"",
|
||||
""9"" : {
|
||||
""station"" : ""9"",
|
||||
""bike_soll"" : ""0"",
|
||||
""bike_ist"" : ""7"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.66756"", ""longitude"": ""9.16477"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : """"
|
||||
""description"" : """",
|
||||
""station_type"": {
|
||||
""Cargobike"": {
|
||||
""bike_count"": ""1"",
|
||||
""bike_group"": ""TINK""
|
||||
},
|
||||
""Citybike"": {
|
||||
""bike_count"": ""0"",
|
||||
""bike_group"": ""FR300103""
|
||||
}
|
||||
}
|
||||
},
|
||||
""13"" : {
|
||||
""station"" : ""13"",
|
||||
|
@ -74,13 +88,13 @@ namespace TestTINKLib.Fixtures.ObjectTests.Query
|
|||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
|
||||
server.GetStationsAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL)));
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE)));
|
||||
server.GetStationsAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2)));
|
||||
|
||||
var result = await new TINK.Model.Connector.Query(server).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(1, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(1, result.Response.StationsAll["9"].BikeGroups.AvailableCount);
|
||||
Assert.AreEqual(0, result.Response.BikesOccupied.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ using TINK.Repository.Response.Stations;
|
|||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestQueryLoggedIn
|
||||
{
|
||||
private const string BIKESAVAILABLE = @"{
|
||||
public class TestQueryLoggedIn
|
||||
{
|
||||
private const string BIKESAVAILABLE = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""bikes"" : {},
|
||||
""response_state"" : ""OK"",
|
||||
|
@ -31,7 +31,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
}
|
||||
}";
|
||||
|
||||
private const string BIKESOCCUPIED = @"{
|
||||
private const string BIKESOCCUPIED = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""authcookie"" : ""6103_f782a208d9399291ba8d086b5dcc2509_12345678"",
|
||||
""debuglevel"" : ""2"",
|
||||
|
@ -65,17 +65,31 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
}
|
||||
}";
|
||||
|
||||
private const string STATIONSALL = @"{
|
||||
/// <summary>
|
||||
/// Holds the response on stations_available request.
|
||||
/// </summary>
|
||||
/// <remarks> V1: Did not hold station_type entry.</remarks>
|
||||
private const string STATIONSALLV2 = @"{
|
||||
""copri_version"" : ""4.1.0.0"",
|
||||
""stations"" : {
|
||||
""5"" : {
|
||||
""station"" : ""5"",
|
||||
""9"" : {
|
||||
""station"" : ""9"",
|
||||
""bike_soll"" : ""0"",
|
||||
""bike_ist"" : ""7"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.66756"", ""longitude"": ""9.16477"" },
|
||||
""state"" : ""available"",
|
||||
""description"" : """"
|
||||
""description"" : """",
|
||||
""station_type"": {
|
||||
""Cargobike"": {
|
||||
""bike_count"": ""1"",
|
||||
""bike_group"": ""TINK""
|
||||
},
|
||||
""Citybike"": {
|
||||
""bike_count"": ""0"",
|
||||
""bike_group"": ""FR300103""
|
||||
}
|
||||
}
|
||||
},
|
||||
""13"" : {
|
||||
""station"" : ""13"",
|
||||
|
@ -95,7 +109,29 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
""state"" : ""available"",
|
||||
""description"" : ""Test für Stadtradstation""
|
||||
}
|
||||
},
|
||||
},
|
||||
""bikes_occupied"" : {
|
||||
""89004"" : {
|
||||
""start_time"" : ""2018-01-27 17:33:00.989464+01"",
|
||||
""station"" : ""9"",
|
||||
""unit_price"" : ""2.00"",
|
||||
""tariff_description"": {
|
||||
""free_hours"" : ""0.5"",
|
||||
""name"" : ""TINK Tarif"",
|
||||
""max_eur_per_day"" : ""9.00""
|
||||
},
|
||||
""timeCode"" : ""2061"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike"" : ""4"",
|
||||
""total_price"" : ""20.00"",
|
||||
""state"" : ""requested"",
|
||||
""real_hours"" : ""66.05"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""now_time"" : ""2018-01-30 11:36:45"",
|
||||
""request_time"" : ""2018-01-27 17:33:00.989464+01"",
|
||||
""computed_hours"" : ""10.0""
|
||||
}
|
||||
},
|
||||
""user_group"" : [ ""Konrad"", ""TINK"" ],
|
||||
""response_state"" : ""OK"",
|
||||
""authcookie"" : ""6103_f782a208d9399291ba8d086b5dcc2509_12345678"",
|
||||
|
@ -105,52 +141,51 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
""apiserver"" : ""https://tinkwwp.copri-bike.de""
|
||||
}";
|
||||
|
||||
[Test]
|
||||
public async Task TestGetStations()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
[Test]
|
||||
public async Task TestGetStations()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
|
||||
server.GetStationsAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALL)));
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE)));
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
server.GetStationsAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<StationsAvailableResponse>(STATIONSALLV2)));
|
||||
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(1, result.Response.StationsAll["9"].BikeGroups.AvailableCount);
|
||||
Assert.AreEqual(1, result.Response.BikesOccupied.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetBikes()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
[Test]
|
||||
public async Task TestGetBikes()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE)));
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE)));
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAsync();
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAsync();
|
||||
|
||||
Assert.AreEqual(2, result.Response.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
Assert.AreEqual(2, result.Response.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TestGetBikesOccupied()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
[Test]
|
||||
public async Task TestGetBikesOccupied()
|
||||
{
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>("{}")));
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>("{}")));
|
||||
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesOccupiedAsync();
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesOccupiedAsync();
|
||||
|
||||
Assert.AreEqual(1, result.Response.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
}
|
||||
Assert.AreEqual(1, result.Response.Count);
|
||||
Assert.AreEqual(typeof(CopriCallsMonkeyStore), result.Source);
|
||||
Assert.IsNull(result.Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,998 @@
|
|||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestShareeLib.Repository.Response.Stations
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestStationsAvailableResponse
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void TestStationsAvailableBikesOccupiedBikes()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<StationsAvailableResponse>(TestStationAvailalbeResponseCopriVer4_1_23_03_alpha);
|
||||
|
||||
Assert.That(
|
||||
response.bikes_occupied.Count,
|
||||
Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStationsAvailableAvailableBikes()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<StationsAvailableResponse>(TestStationAvailalbeResponseCopriVer4_1_23_03);
|
||||
|
||||
Assert.That(
|
||||
response.stations["FR101"].bike_count,
|
||||
Is.EqualTo("11"));
|
||||
|
||||
Assert.That(
|
||||
response.stations["FR101"].station_type.FirstOrDefault(x => x.Key == "Citybike").Value.bike_count,
|
||||
Is.EqualTo("1"));
|
||||
|
||||
Assert.That(
|
||||
response.stations["FR101"].station_type.FirstOrDefault(x => x.Key == "Citybike").Value.bike_group,
|
||||
Is.EqualTo("FR300103"));
|
||||
|
||||
Assert.That(
|
||||
response.stations["FR101"].station_type.FirstOrDefault(x => x.Key == "Cargobike").Value.bike_count,
|
||||
Is.EqualTo("10"));
|
||||
|
||||
Assert.That(
|
||||
response.stations["FR101"].station_type.FirstOrDefault(x => x.Key == "Cargobike").Value.bike_group,
|
||||
Is.EqualTo("FR300101"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Holds a a response on stations available response.
|
||||
/// </summary>
|
||||
private const string TestStationAvailalbeResponseCopriVer4_1_23_03 = @"{ ""clearing_cache"" : ""0"",
|
||||
""tariff_info_html"" : ""site/tariff_info.html"",
|
||||
""aowner"" : ""186"",
|
||||
""bike_info_html"" : ""site/bike_info_sharee_1.html"",
|
||||
""last_used_operator"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr""
|
||||
},
|
||||
""bikes_occupied"" : {},
|
||||
""user_group"" : [],
|
||||
""new_authcoo"" : ""0"",
|
||||
""agb_checked"" : ""1"",
|
||||
""uri_primary"" : ""https://shareeapp-primary.copri.eu"",
|
||||
""authcookie"" : ""5781_f172cf59108fe53e7524c841847fee69_shoo0faiNg"",
|
||||
""user_tour"" : [],
|
||||
""impress_html"" : ""site/impress_1.html"",
|
||||
""response_state"" : ""OK, nothing todo"",
|
||||
""user_id"" : ""ohauff@posteo.de"",
|
||||
""agb_html"" : ""site/agb_sharee_2.html"",
|
||||
""merchant_id"" : ""shoo0faiNg"",
|
||||
""apiserver"" : ""https://shareeapp-primary.copri.eu"",
|
||||
""project_id"" : ""Freiburg"",
|
||||
""init_map"" : {
|
||||
""center"" : {
|
||||
""latitude"" : ""47.976634"",
|
||||
""longitude"" : ""7.825490""
|
||||
},
|
||||
""radius"" : ""2.9""
|
||||
},
|
||||
""privacy_html"" : ""site/privacy_sharee_2.html"",
|
||||
""debuglevel"" : ""72"",
|
||||
""copri_version"" : ""4.1.23.03"",
|
||||
""lang"" : ""de"",
|
||||
""stations"" : {
|
||||
""FR105"" : {
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""0"",
|
||||
""station"" : ""FR105"",
|
||||
""gps_radius"" : ""50"",
|
||||
""capacity"" : ""1"",
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.973855"",
|
||||
""latitude"" : ""47.927738""
|
||||
},
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_count"" : ""0"",
|
||||
""bike_group"" : ""FR300101""
|
||||
}
|
||||
},
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""description"" : ""Contributor-Station Rainer"",
|
||||
""state"" : ""available""
|
||||
},
|
||||
""FR107"" : {
|
||||
""station"" : ""FR107"",
|
||||
""capacity"" : ""2"",
|
||||
""gps_radius"" : ""50"",
|
||||
""withpub"" : ""0"",
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""bike_count"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""state"" : ""available"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.888761798157405"",
|
||||
""latitude"" : ""47.98830177263789""
|
||||
},
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""FR300101"",
|
||||
""bike_count"" : ""0""
|
||||
}
|
||||
},
|
||||
""description"" : ""Contributor-Station Svenja"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
]
|
||||
},
|
||||
""BVB9001"" : {
|
||||
""state"" : ""available"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.004394"",
|
||||
""longitude"" : ""7.840146""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""description"" : ""Unicarré"",
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
],
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_count"" : ""2"",
|
||||
""bike_group"" : ""BVB300101""
|
||||
}
|
||||
},
|
||||
""gps_radius"" : ""75"",
|
||||
""capacity"" : ""2"",
|
||||
""station"" : ""BVB9001"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""bike_count"" : ""2"",
|
||||
""authed"" : ""1""
|
||||
},
|
||||
""BVB9002"" : {
|
||||
""station"" : ""BVB9002"",
|
||||
""gps_radius"" : ""75"",
|
||||
""capacity"" : ""2"",
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""2"",
|
||||
""state"" : ""available"",
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.005352"",
|
||||
""longitude"" : ""7.823005""
|
||||
},
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""BVB300101"",
|
||||
""bike_count"" : ""2""
|
||||
}
|
||||
},
|
||||
""description"" : ""Idinger-Hof"",
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
]
|
||||
},
|
||||
""FR102"" : {
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""station"" : ""FR102"",
|
||||
""capacity"" : ""1"",
|
||||
""gps_radius"" : ""50"",
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""0"",
|
||||
""state"" : ""available"",
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_count"" : ""0"",
|
||||
""bike_group"" : ""FR300101""
|
||||
},
|
||||
""Citybike"" : {
|
||||
""bike_count"" : ""0"",
|
||||
""bike_group"" : ""FR300103""
|
||||
}
|
||||
},
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""description"" : ""Ferdinand-Weiß-Str 5"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.994371"",
|
||||
""longitude"" : ""7.835669""
|
||||
}
|
||||
},
|
||||
""FR9010"" : {
|
||||
""withpub"" : ""0"",
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""station"" : ""FR9010"",
|
||||
""capacity"" : ""1"",
|
||||
""gps_radius"" : ""100"",
|
||||
""bike_count"" : ""1"",
|
||||
""authed"" : ""1"",
|
||||
""state"" : ""available"",
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_count"" : ""1"",
|
||||
""bike_group"" : ""FR300101""
|
||||
}
|
||||
},
|
||||
""description"" : ""Contributor-Station Ilockit"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""52.406693917129175"",
|
||||
""longitude"" : ""12.569934014209514""
|
||||
}
|
||||
},
|
||||
""FR108"" : {
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Contributor-Station Anja"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_count"" : ""1"",
|
||||
""bike_group"" : ""FR300101""
|
||||
}
|
||||
},
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.885837789049421"",
|
||||
""latitude"" : ""48.070487906373515""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""withpub"" : ""0"",
|
||||
""gps_radius"" : ""100"",
|
||||
""capacity"" : ""1"",
|
||||
""station"" : ""FR108"",
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""1""
|
||||
},
|
||||
""BVB9003"" : {
|
||||
""capacity"" : ""2"",
|
||||
""gps_radius"" : ""75"",
|
||||
""station"" : ""BVB9003"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""withpub"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""2"",
|
||||
""state"" : ""available"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.8269763"",
|
||||
""latitude"" : ""48.0137631""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
],
|
||||
""description"" : ""Carl-Sieder-Hof"",
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""BVB300101"",
|
||||
""bike_count"" : ""2""
|
||||
}
|
||||
}
|
||||
},
|
||||
""REN9002"" : {
|
||||
""station_group"" : [
|
||||
""REN300101"",
|
||||
""REN300103""
|
||||
],
|
||||
""description"" : ""Bikerei-IN"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""11.441289676268319"",
|
||||
""latitude"" : ""48.75089095677469""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-ren.copri.eu"",
|
||||
""state"" : ""available"",
|
||||
""bike_count"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""withpub"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""täglich von 10:00 bis 20:00Uhr"",
|
||||
""operator_phone"" : ""+491774126214"",
|
||||
""operator_name"" : ""Rentamania-Bikes"",
|
||||
""operator_email"" : ""verleih@rentamania.de""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""gps_radius"" : ""100"",
|
||||
""capacity"" : ""7"",
|
||||
""station"" : ""REN9002""
|
||||
},
|
||||
""REN9001"" : {
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""0"",
|
||||
""cached"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""täglich von 10:00 bis 20:00Uhr"",
|
||||
""operator_name"" : ""Rentamania-Bikes"",
|
||||
""operator_phone"" : ""+491774126214"",
|
||||
""operator_email"" : ""verleih@rentamania.de""
|
||||
},
|
||||
""withpub"" : ""1"",
|
||||
""station"" : ""REN9001"",
|
||||
""capacity"" : ""8"",
|
||||
""gps_radius"" : ""100"",
|
||||
""description"" : ""Rentamania-EI"",
|
||||
""station_group"" : [
|
||||
""REN300101"",
|
||||
""REN300103""
|
||||
],
|
||||
""uri_operator"" : ""https://shareeapp-ren.copri.eu"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.8975726"",
|
||||
""longitude"" : ""11.170959""
|
||||
},
|
||||
""state"" : ""available""
|
||||
},
|
||||
""FR104"" : {
|
||||
""description"" : ""fahrradspezialitäten"",
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""FR300101"",
|
||||
""bike_count"" : ""0""
|
||||
},
|
||||
""Citybike"" : {
|
||||
""bike_group"" : ""FR300103"",
|
||||
""bike_count"" : ""0""
|
||||
}
|
||||
},
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.837621"",
|
||||
""latitude"" : ""47.989807""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""state"" : ""available"",
|
||||
""bike_count"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""gps_radius"" : ""50"",
|
||||
""capacity"" : ""1"",
|
||||
""station"" : ""FR104""
|
||||
},
|
||||
""FR101"" : {
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""withpub"" : ""0"",
|
||||
""gps_radius"" : ""50"",
|
||||
""capacity"" : ""3"",
|
||||
""station"" : ""FR101"",
|
||||
""authed"" : ""1"",
|
||||
""bike_count"" : ""11"",
|
||||
""state"" : ""available"",
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""description"" : ""Villaban sharee Station"",
|
||||
""station_type"" : {
|
||||
""Citybike"" : {
|
||||
""bike_group"" : ""FR300103"",
|
||||
""bike_count"" : ""1""
|
||||
},
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""FR300101"",
|
||||
""bike_count"" : ""10""
|
||||
}
|
||||
},
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.976634"",
|
||||
""longitude"" : ""7.825490""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu""
|
||||
},
|
||||
""FR103"" : {
|
||||
""gps_radius"" : ""50"",
|
||||
""capacity"" : ""3"",
|
||||
""station"" : ""FR103"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""bike_count"" : ""2"",
|
||||
""authed"" : ""1"",
|
||||
""state"" : ""available"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.997922"",
|
||||
""longitude"" : ""7.784941""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""description"" : ""Contributor-Station Oliver"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""station_type"" : {
|
||||
""Cargobike"" : {
|
||||
""bike_group"" : ""FR300101"",
|
||||
""bike_count"" : ""2""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
""response"" : ""stations_available"",
|
||||
""uri_operator_array"" : [
|
||||
""https://shareeapp-thu.copri.eu"",
|
||||
""https://shareeapp-demo.copri.eu"",
|
||||
""https://shareeapp-lv.copri.eu"",
|
||||
""https://shareeapp-ren.copri.eu"",
|
||||
""https://shareeapp-fr01.copri.eu"",
|
||||
""https://shareeapp-bvb.copri.eu""
|
||||
]
|
||||
}";
|
||||
|
||||
/// <summary>
|
||||
/// Holds a a response on stations available response.
|
||||
/// </summary>
|
||||
private const string TestStationAvailalbeResponseCopriVer4_1_23_03_alpha = @"{
|
||||
""uri_operator_array"" : [
|
||||
""https://shareeapp-bvb.copri.eu"",
|
||||
""https://shareeapp-thu.copri.eu"",
|
||||
""https://shareeapp-lv.copri.eu"",
|
||||
""https://shareeapp-ren.copri.eu"",
|
||||
""https://shareeapp-fr01.copri.eu"",
|
||||
""https://shareeapp-demo.copri.eu""
|
||||
],
|
||||
""agb_html"" : ""site/agb_sharee_2.html"",
|
||||
""lang"" : ""de"",
|
||||
""apiserver"" : ""https://shareeapp-primary.copri.eu"",
|
||||
""project_id"" : ""Freiburg"",
|
||||
""debuglevel"" : ""72"",
|
||||
""privacy_html"" : ""site/privacy_sharee_2.html"",
|
||||
""last_used_operator"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""user_id"" : ""ohauff@posteo.de"",
|
||||
""stations"" : {
|
||||
""FR104"" : {
|
||||
""station"" : ""FR104"",
|
||||
""gps_radius"" : ""50"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.837621"",
|
||||
""latitude"" : ""47.989807""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""bike_count"" : ""0"",
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""capacity"" : ""1"",
|
||||
""description"" : ""fahrradspezialitäten"",
|
||||
""state"" : ""available"",
|
||||
""withpub"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""authed"" : ""1""
|
||||
},
|
||||
""FR9010"" : {
|
||||
""authed"" : ""1"",
|
||||
""description"" : ""Contributor-Station Ilockit"",
|
||||
""state"" : ""available"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""gps_radius"" : ""100"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""12.569934014209514"",
|
||||
""latitude"" : ""52.406693917129175""
|
||||
},
|
||||
""bike_count"" : ""1"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""capacity"" : ""1"",
|
||||
""station"" : ""FR9010""
|
||||
},
|
||||
""BVB9003"" : {
|
||||
""authed"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""description"" : ""Carl-Sieder-Hof"",
|
||||
""state"" : ""available"",
|
||||
""bike_count"" : ""1"",
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
],
|
||||
""capacity"" : ""2"",
|
||||
""gps_radius"" : ""75"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.8269763"",
|
||||
""latitude"" : ""48.0137631""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""station"" : ""BVB9003""
|
||||
},
|
||||
""BVB9001"" : {
|
||||
""station"" : ""BVB9001"",
|
||||
""capacity"" : ""2"",
|
||||
""bike_count"" : ""1"",
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
],
|
||||
""gps_radius"" : ""75"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.004394"",
|
||||
""longitude"" : ""7.840146""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""description"" : ""Unicarré"",
|
||||
""state"" : ""available"",
|
||||
""authed"" : ""1""
|
||||
},
|
||||
""FR103"" : {
|
||||
""station"" : ""FR103"",
|
||||
""gps_radius"" : ""50"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.997922"",
|
||||
""longitude"" : ""7.784941""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""capacity"" : ""3"",
|
||||
""bike_count"" : ""0"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""description"" : ""Contributor-Station Oliver"",
|
||||
""state"" : ""available"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""operator_data"" : {
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""authed"" : ""1""
|
||||
},
|
||||
""REN9001"" : {
|
||||
""bike_count"" : ""0"",
|
||||
""station_group"" : [
|
||||
""REN300101"",
|
||||
""REN300103""
|
||||
],
|
||||
""capacity"" : ""8"",
|
||||
""gps_radius"" : ""100"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.8975726"",
|
||||
""longitude"" : ""11.170959""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""station"" : ""REN9001"",
|
||||
""authed"" : ""1"",
|
||||
""withpub"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_name"" : ""Rentamania-Bikes"",
|
||||
""operator_phone"" : ""+491774126214"",
|
||||
""operator_hours"" : ""täglich von 10:00 bis 20:00Uhr"",
|
||||
""operator_email"" : ""verleih@rentamania.de""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-ren.copri.eu"",
|
||||
""description"" : ""Rentamania-EI"",
|
||||
""state"" : ""available""
|
||||
},
|
||||
""FR107"" : {
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Contributor-Station Svenja"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""authed"" : ""1"",
|
||||
""station"" : ""FR107"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.888761798157405"",
|
||||
""latitude"" : ""47.98830177263789""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""gps_radius"" : ""50"",
|
||||
""capacity"" : ""2"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""bike_count"" : ""0""
|
||||
},
|
||||
""BVB9002"" : {
|
||||
""station_group"" : [
|
||||
""BVB300101""
|
||||
],
|
||||
""bike_count"" : ""1"",
|
||||
""capacity"" : ""2"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.005352"",
|
||||
""longitude"" : ""7.823005""
|
||||
},
|
||||
""gps_radius"" : ""75"",
|
||||
""station"" : ""BVB9002"",
|
||||
""authed"" : ""1"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_phone"" : ""+49 761 45370097""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-bvb.copri.eu"",
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Idinger-Hof""
|
||||
},
|
||||
""FR102"" : {
|
||||
""bike_count"" : ""0"",
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""capacity"" : ""1"",
|
||||
""gps_radius"" : ""50"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.835669"",
|
||||
""latitude"" : ""47.994371""
|
||||
},
|
||||
""station"" : ""FR102"",
|
||||
""authed"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""withpub"" : ""1"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""description"" : ""Ferdinand-Weiß-Str 5"",
|
||||
""state"" : ""available""
|
||||
},
|
||||
""FR105"" : {
|
||||
""authed"" : ""1"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""withpub"" : ""0"",
|
||||
""description"" : ""Contributor-Station Rainer"",
|
||||
""state"" : ""available"",
|
||||
""capacity"" : ""1"",
|
||||
""bike_count"" : ""1"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""gps_radius"" : ""50"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.927738"",
|
||||
""longitude"" : ""7.973855""
|
||||
},
|
||||
""station"" : ""FR105""
|
||||
},
|
||||
""FR108"" : {
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""withpub"" : ""0"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""hotline@sharee.bike"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH""
|
||||
},
|
||||
""description"" : ""Contributor-Station Anja"",
|
||||
""state"" : ""available"",
|
||||
""authed"" : ""1"",
|
||||
""station"" : ""FR108"",
|
||||
""capacity"" : ""1"",
|
||||
""bike_count"" : ""1"",
|
||||
""station_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""gps_radius"" : ""100"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""48.070487906373515"",
|
||||
""longitude"" : ""7.885837789049421""
|
||||
}
|
||||
},
|
||||
""FR101"" : {
|
||||
""authed"" : ""1"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""withpub"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_phone"" : ""+49 761 45370097"",
|
||||
""operator_name"" : ""TeilRad GmbH"",
|
||||
""operator_hours"" : ""Bürozeiten: Montag, Mittwoch, Freitag 9-12 Uhr"",
|
||||
""operator_email"" : ""hotline@sharee.bike""
|
||||
},
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Villaban sharee Station"",
|
||||
""capacity"" : ""3"",
|
||||
""station_group"" : [
|
||||
""FR300101"",
|
||||
""FR300103""
|
||||
],
|
||||
""bike_count"" : ""5"",
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.976634"",
|
||||
""longitude"" : ""7.825490""
|
||||
},
|
||||
""cached"" : ""1"",
|
||||
""gps_radius"" : ""50"",
|
||||
""station"" : ""FR101""
|
||||
},
|
||||
""REN9002"" : {
|
||||
""authed"" : ""1"",
|
||||
""state"" : ""available"",
|
||||
""description"" : ""Bikerei-IN"",
|
||||
""withpub"" : ""1"",
|
||||
""operator_data"" : {
|
||||
""operator_email"" : ""verleih@rentamania.de"",
|
||||
""operator_hours"" : ""täglich von 10:00 bis 20:00Uhr"",
|
||||
""operator_name"" : ""Rentamania-Bikes"",
|
||||
""operator_phone"" : ""+491774126214""
|
||||
},
|
||||
""uri_operator"" : ""https://shareeapp-ren.copri.eu"",
|
||||
""cached"" : ""1"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""11.441289676268319"",
|
||||
""latitude"" : ""48.75089095677469""
|
||||
},
|
||||
""gps_radius"" : ""100"",
|
||||
""station_group"" : [
|
||||
""REN300101"",
|
||||
""REN300103""
|
||||
],
|
||||
""bike_count"" : ""0"",
|
||||
""capacity"" : ""7"",
|
||||
""station"" : ""REN9002""
|
||||
}
|
||||
},
|
||||
""response"" : ""stations_available"",
|
||||
""bike_info_html"" : ""site/bike_info_sharee_1.html"",
|
||||
""clearing_cache"" : ""0"",
|
||||
""authcookie"" : ""5781_f172cf59108fe53e7524c841847fee69_shoo0faiNg"",
|
||||
""agb_checked"" : ""1"",
|
||||
""impress_html"" : ""site/impress_1.html"",
|
||||
""init_map"" : {
|
||||
""center"" : {
|
||||
""longitude"" : ""7.825490"",
|
||||
""latitude"" : ""47.976634""
|
||||
},
|
||||
""radius"" : ""2.9""
|
||||
},
|
||||
""response_state"" : ""OK, nothing todo"",
|
||||
""merchant_id"" : ""shoo0faiNg"",
|
||||
""new_authcoo"" : ""0"",
|
||||
""tariff_info_html"" : ""site/tariff_info.html"",
|
||||
""user_group"" : [],
|
||||
""aowner"" : ""186"",
|
||||
""copri_version"" : ""4.1.23.03"",
|
||||
""bikes_occupied"" : {
|
||||
""159154"" : {
|
||||
""gps"" : {
|
||||
""latitude"" : ""47.997873374261"",
|
||||
""longitude"" : ""7.78480782173574""
|
||||
},
|
||||
""request_time"" : ""2023-03-24 19:06:27.110484+01"",
|
||||
""end_time"" : ""2023-03-24 19:06:00+01"",
|
||||
""bike"" : ""FR1011"",
|
||||
""bike_group"" : [
|
||||
""FR300101""
|
||||
],
|
||||
""rentalog"" : """",
|
||||
""tariff_description"" : {
|
||||
""eur_per_hour"" : ""0.00"",
|
||||
""number"" : ""5533"",
|
||||
""name"" : ""E-Lastenrad private"",
|
||||
""max_eur_per_day"" : ""24.00""
|
||||
},
|
||||
""system"" : ""Ilockit"",
|
||||
""station"" : ""FR103"",
|
||||
""unit_price"" : ""2.00"",
|
||||
""total_price"" : ""0.00"",
|
||||
""rental_description"" : {
|
||||
""name"" : ""E-Lastenrad private"",
|
||||
""id"" : ""5533"",
|
||||
""reserve_timerange"" : ""15"",
|
||||
""tarif_elements"" : {
|
||||
""4"" : [
|
||||
""Max. Gebühr"",
|
||||
""24,00 € / Tag""
|
||||
],
|
||||
""1"" : [
|
||||
""Mietgebühr"",
|
||||
""2,00 € / 30 Min ""
|
||||
]
|
||||
}
|
||||
},
|
||||
""real_clock"" : ""00:00"",
|
||||
""discount"" : """",
|
||||
""bike_type"" : {
|
||||
""wheels"" : ""2"",
|
||||
""category"" : ""cargo""
|
||||
},
|
||||
""lock_state"" : ""locked"",
|
||||
""freed_time"" : """",
|
||||
""start_time"" : ""2023-03-24 19:06:27.110484+01"",
|
||||
""description"" : ""Lastenrad Oliver Pieper"",
|
||||
""state"" : ""requested"",
|
||||
""computed_hours"" : ""0"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""Ilockit_ID"" : ""ISHAREIT-2200536""
|
||||
},
|
||||
""159155"" : {
|
||||
""description"" : ""Contributor-bike devel"",
|
||||
""state"" : ""occupied"",
|
||||
""computed_hours"" : ""0"",
|
||||
""freed_time"" : """",
|
||||
""start_time"" : ""2023-03-24 19:06:51.881632+01"",
|
||||
""Ilockit_ID"" : ""ISHAREIT-2309492"",
|
||||
""uri_operator"" : ""https://shareeapp-fr01.copri.eu"",
|
||||
""discount"" : """",
|
||||
""bike_type"" : {
|
||||
""wheels"" : ""2"",
|
||||
""category"" : ""cargo""
|
||||
},
|
||||
""lock_state"" : ""unlocked"",
|
||||
""unit_price"" : ""2.00"",
|
||||
""station"" : ""FR103"",
|
||||
""tariff_description"" : {
|
||||
""number"" : ""5533"",
|
||||
""eur_per_hour"" : ""0.00"",
|
||||
""max_eur_per_day"" : ""24.00"",
|
||||
""name"" : ""E-Lastenrad private""
|
||||
},
|
||||
""system"" : ""Ilockit"",
|
||||
""rental_description"" : {
|
||||
""id"" : ""5533"",
|
||||
""tarif_elements"" : {
|
||||
""4"" : [
|
||||
""Max. Gebühr"",
|
||||
""24,00 € / Tag""
|
||||
],
|
||||
""1"" : [
|
||||
""Mietgebühr"",
|
||||
""2,00 € / 30 Min ""
|
||||
],
|
||||
""7"" : [
|
||||
""Aktuelle Mietzeit"",
|
||||
""1 Min ""
|
||||
]
|
||||
},
|
||||
""reserve_timerange"" : ""15"",
|
||||
""name"" : ""E-Lastenrad private""
|
||||
},
|
||||
""real_clock"" : ""00:01"",
|
||||
""total_price"" : ""0.00"",
|
||||
""request_time"" : ""2023-03-24 19:06:43.046977+01"",
|
||||
""bike"" : ""FR1012"",
|
||||
""end_time"" : ""2023-03-24 19:08:04"",
|
||||
""gps"" : {
|
||||
""longitude"" : ""7.784874"",
|
||||
""latitude"" : ""47.998028""
|
||||
},
|
||||
""rentalog"" : """",
|
||||
""bike_group"" : [
|
||||
""FR300101""
|
||||
]
|
||||
}
|
||||
},
|
||||
""uri_primary"" : ""https://shareeapp-primary.copri.eu"",
|
||||
""user_tour"" : []
|
||||
}";
|
||||
}
|
||||
}
|
|
@ -9,7 +9,6 @@ using TestFramework.Model.Services.Geolocation;
|
|||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
|
|
|
@ -344,7 +344,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
)); ;
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Disposable); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -411,7 +411,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<BookingFinishedModel>(x => throw new WebConnectFailureException("Context info", new Exception("hoppla")));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -487,7 +487,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
throw notAtStationException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -557,7 +557,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
throw noGPSDataException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -625,7 +625,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
throw new ReturnBikeException(JsonConvert.DeserializeObject<DoReturnResponse>(@"{ ""response_text"" : ""Some invalid data received!""}"), "Outer message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -692,7 +692,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<BookingFinishedModel>(x => throw new Exception("Exception message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
connector.Command.DoReserve(bike).Returns(x => throw new BookingDeclinedException(7)); // Booking must be performed
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
connector.Command.DoReserve(bike).Returns<Task>(x => throw new WebConnectFailureException("Context info.", new Exception("chub")));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -339,7 +339,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
connector.Command.DoReserve(bike).Returns<Task>(x => throw new Exception("Exception message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -404,7 +404,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
locks.TimeOut.Returns(timeOuts);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -470,7 +470,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
locks.TimeOut.Returns(timeOuts);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
viewService.DisplayAlert(string.Empty, string.Format("Cancel reservation for bike {0}?", "Nr. 0"), "Yes", "No").Returns(Task.FromResult(true));
|
||||
bike.State.Value.Returns(InUseStateEnum.Disposable); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -208,7 +208,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new InvalidAuthorizationResponseException("mustermann@server.de", response));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -276,7 +276,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("chub")));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -344,7 +344,7 @@ namespace TestShareeLib.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new Exception("Exception message."));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Closed); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
viewService.DisplayAlert(string.Empty, string.Format("Cancel reservation for bike {0}?", "Nr. 0"), "Yes", "No").Returns(Task.FromResult(true));
|
||||
bike.State.Value.Returns(InUseStateEnum.Disposable); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new InvalidAuthorizationResponseException("mustermann@server.de", l_oResponse));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -268,7 +268,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new WebConnectFailureException("Context info", new Exception("chub")));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
@ -334,7 +334,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
connector.Command.DoCancelReservation(bike).Returns(x => throw new Exception("Exception message."));
|
||||
bike.State.Value.Returns(InUseStateEnum.Reserved); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
viewService.DisplayAlert(string.Empty, "Rad Nr. 0 abschließen und zurückgeben oder Rad mieten?", "Zurückgeben", "Mieten").Returns(Task.FromResult(false));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Open); // Requsthandler factory queries lock state to create appropriate request handler object.
|
||||
bike.LockInfo.State.Returns(LockingState.Open); // Requesthandler factory queries lock state to create appropriate request handler object.
|
||||
|
||||
var subsequent = handler.HandleRequestOption1().Result;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ using TestFramework.Model.Device;
|
|||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
|
|
|
@ -10,11 +10,14 @@ using TestFramework.Model.Services.Geolocation;
|
|||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Repository;
|
||||
using TestFramework.Services.BluetoothLock;
|
||||
using TestFramework.Services.CopriApi.Connector;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
||||
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Model.Settings;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Services;
|
||||
|
@ -24,6 +27,8 @@ using TINK.View;
|
|||
using TINK.ViewModel.Map;
|
||||
using TINK.ViewModel.Settings;
|
||||
using Xamarin.Forms;
|
||||
using TINK.Model.Bikes.BikeInfoNS;
|
||||
using TINK.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace TestShareeLib.UseCases.Startup
|
||||
{
|
||||
|
@ -46,7 +51,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
isConnectedFunc: () => true,
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001(sessionCookie)),
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001v2NotLoggedIn(sessionCookie)),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
locationPermissionsService: Substitute.For<ILocationPermission>(),
|
||||
|
@ -85,11 +90,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(27, viewModel.Pins.Count); // Were 8 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag,
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag,
|
||||
Is.EqualTo("FR101"),
|
||||
"Station FR105 must be marked green because there is are bike.");
|
||||
"Station FR105 must be marked green because there are bikes.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag,
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag,
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike."); // Was station id 31
|
||||
|
||||
|
@ -127,7 +132,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
isConnectedFunc: () => true,
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001(sessionCookie)),
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001v2NotLoggedIn(sessionCookie)),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
locationPermissionsService: Substitute.For<ILocationPermission>(),
|
||||
|
@ -151,8 +156,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
NSubstitute.Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
NSubstitute.Substitute.For<IGeolocationService>(),
|
||||
Substitute.For<IBluetoothLE>(),
|
||||
Substitute.For<IGeolocationService>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
navigationService);
|
||||
|
@ -166,11 +171,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(21, viewModel.Pins.Count); // Were 2 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station 5
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag, // Was station 5
|
||||
Is.EqualTo("FR103"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was station 14
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag, // Was station 14
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
|
@ -205,7 +210,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
isConnectedFunc: () => true,
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001(sessionCookie)),
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001v2NotLoggedIn(sessionCookie)),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
locationPermissionsService: Substitute.For<ILocationPermission>(),
|
||||
|
@ -242,11 +247,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(21, viewModel.Pins.Count); // Were 2 when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 31
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag, // Was station id 31
|
||||
Is.EqualTo("FR103"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 14
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag, // Was 14
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
|
@ -278,7 +283,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
isConnectedFunc: () => true,
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001(sessionCookie)),
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001v2NotLoggedIn(sessionCookie)),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
locationPermissionsService: Substitute.For<ILocationPermission>(),
|
||||
|
@ -315,11 +320,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(27, viewModel.Pins.Count); // Were 8 pin when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag,
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag,
|
||||
Is.EqualTo("FR101"), // Was station id 4
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag, // Was 31
|
||||
Is.EqualTo("KN12"), // Was station id 31
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
|
@ -351,7 +356,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
isConnectedFunc: () => false,
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001(sessionCookie)),
|
||||
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), null /*UI language */, sessionCookie, mail, server: new CopriCallsMemory001v2NotLoggedIn(sessionCookie)),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
locationPermissionsService: Substitute.For<ILocationPermission>(),
|
||||
|
@ -373,7 +378,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
var viewModel = new MapPageViewModel(
|
||||
tinkApp,
|
||||
locationPermission,
|
||||
Substitute.For<Plugin.BLE.Abstractions.Contracts.IBluetoothLE>(),
|
||||
Substitute.For<IBluetoothLE>(),
|
||||
Substitute.For<IGeolocationService>(),
|
||||
(mapspan) => { },
|
||||
viewService,
|
||||
|
@ -388,11 +393,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(27, viewModel.Pins.Count); // Were 8 pins when loading from CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 4
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag, // Was station id 4
|
||||
Is.EqualTo("FR101"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag, // Was 31
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
|
@ -439,7 +444,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001v2NotLoggedIn(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
|
@ -479,11 +484,11 @@ namespace TestShareeLib.UseCases.Startup
|
|||
// Verify pins on map
|
||||
Assert.AreEqual(27, viewModel.Pins.Count);
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green")).Tag, // Was station id 4
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Green"))?.Tag, // Was station id 4
|
||||
Is.EqualTo("FR101"),
|
||||
"Station FR101 must be marked green because there is are bike.");
|
||||
Assert.That(
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red")).Tag, // Was 31
|
||||
viewModel.Pins.FirstOrDefault(pin => pin.Icon.Id.Contains("Open_Red"))?.Tag, // Was 31
|
||||
Is.EqualTo("KN12"),
|
||||
"Station KN12 must be marked red because there is no bike.");
|
||||
|
||||
|
@ -529,7 +534,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
cacheServer: new CopriCallsCacheMemory001v2NotLoggedIn(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
merchantId: "MyMerchId",
|
||||
bluetoothService: Substitute.For<IBluetoothLE>(),
|
||||
|
@ -591,5 +596,116 @@ namespace TestShareeLib.UseCases.Startup
|
|||
await viewModel.OnDisappearing();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationColors()
|
||||
{
|
||||
var stationIds = new List<string>() { "FR101", "BVB9003", "BVB9001" };
|
||||
|
||||
var bikeGroupFr101 = Substitute.For<IBikeGroupCol>();
|
||||
var bikeGroupBVB9003 = Substitute.For<IBikeGroupCol>();
|
||||
var bikeGroupBVB9001 = Substitute.For<IBikeGroupCol>();
|
||||
|
||||
bikeGroupFr101.AvailableCount.Returns(1);
|
||||
bikeGroupBVB9003.AvailableCount.Returns(7);
|
||||
bikeGroupBVB9001.AvailableCount.Returns(0);
|
||||
|
||||
var stations = new List<Station>
|
||||
{
|
||||
new Station("FR101", new List<string>() /* group */, Substitute.For<IPosition>(), bikeGropCol: bikeGroupFr101),
|
||||
new Station("BVB9003", new List<string>() /* group */, Substitute.For<IPosition>(), bikeGropCol: bikeGroupBVB9003),
|
||||
new Station("BVB9001", new List<string>() /* group */, Substitute.For<IPosition>(), bikeGropCol : bikeGroupBVB9001)
|
||||
};
|
||||
|
||||
var bikes = new List<TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo> {
|
||||
// Add a reserved bike to station "FR101"
|
||||
new BikeInfo(
|
||||
new Bike("Id1", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
123, // Lock id
|
||||
new Guid(),
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
DateTime.Parse("2023-03-26 15:19"),
|
||||
"a@b",
|
||||
"FR101",
|
||||
new Uri("https://1.2.3.4"),
|
||||
new RentalDescription(),
|
||||
() => DateTime.Now)
|
||||
};
|
||||
|
||||
var colorList = MapPageViewModel.GetStationColors(stationIds, stations, bikes);
|
||||
|
||||
Assert.That(colorList[0], Is.EqualTo(Color.LightBlue), "1 bike reserved/ rented.");
|
||||
Assert.That(colorList[1], Is.EqualTo(Color.Green), "7 available bikes.");
|
||||
Assert.That(colorList[2], Is.EqualTo(Color.Red), "No bike");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationColorsNullIds()
|
||||
{
|
||||
var colorList = MapPageViewModel.GetStationColors(null, null, null);
|
||||
|
||||
Assert.That(colorList.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationColorsNoStations()
|
||||
{
|
||||
var stationIds = new List<string>() { "FR101", "BVB9003", "BVB9001" };
|
||||
|
||||
var bikes = new List<TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo> {
|
||||
// Add a reserved bike to station "FR101"
|
||||
new BikeInfo(
|
||||
new Bike("Id1", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
123, // Lock id
|
||||
new Guid(),
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
DateTime.Parse("2023-03-26 15:19"),
|
||||
"a@b",
|
||||
"FR101",
|
||||
new Uri("https://1.2.3.4"),
|
||||
new RentalDescription(),
|
||||
() => DateTime.Now)
|
||||
};
|
||||
|
||||
var colorList = MapPageViewModel.GetStationColors(stationIds, null, bikes);
|
||||
|
||||
Assert.That(colorList[0], Is.EqualTo(Color.LightBlue), "1 bike reserved/ rented.");
|
||||
Assert.That(colorList[1], Is.EqualTo(Color.Red), "No bike.");
|
||||
Assert.That(colorList[2], Is.EqualTo(Color.Red), "No bike");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationColorsNoBikes()
|
||||
{
|
||||
var stationIds = new List<string>() { "FR101", "BVB9003", "BVB9001" };
|
||||
var bikeGroupFr101 = Substitute.For<IBikeGroupCol>();
|
||||
var bikeGroupBVB9003 = Substitute.For<IBikeGroupCol>();
|
||||
var bikeGroupBVB9001 = Substitute.For<IBikeGroupCol>();
|
||||
|
||||
bikeGroupFr101.AvailableCount.Returns(1);
|
||||
bikeGroupBVB9003.AvailableCount.Returns(7);
|
||||
bikeGroupBVB9001.AvailableCount.Returns(0);
|
||||
|
||||
var stations = new List<Station>
|
||||
{
|
||||
new Station("FR101", new List<string>() /* group */, Substitute.For<IPosition>(), bikeGropCol: bikeGroupFr101),
|
||||
new Station("BVB9003", new List<string>() /* group */, Substitute.For<IPosition>(),bikeGropCol: bikeGroupBVB9003),
|
||||
new Station("BVB9001", new List<string>() /* group */, Substitute.For<IPosition>(), bikeGropCol: bikeGroupBVB9001)
|
||||
};
|
||||
|
||||
var colorList = MapPageViewModel.GetStationColors(stationIds, stations, null);
|
||||
|
||||
Assert.That(colorList[0], Is.EqualTo(Color.Green), "No bike reserved/ rented.");
|
||||
Assert.That(colorList[1], Is.EqualTo(Color.Green), "7 available bikes.");
|
||||
Assert.That(colorList[2], Is.EqualTo(Color.Red), "No bike");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ using TestFramework.Model.Device;
|
|||
using TestFramework.Model.Services.Geolocation;
|
||||
using TestFramework.Model.User.Account;
|
||||
using TestFramework.Repository;
|
||||
using TestTINKLib.Mocks.Connector;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue