Version 3.0.290

This commit is contained in:
Oliver Hauff 2022-04-10 17:38:34 +02:00
parent af3c20ea1c
commit ad3cdbcadf
231 changed files with 14555 additions and 7798 deletions

View file

@ -3,7 +3,6 @@ using Rhino.Mocks;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TestTINKLib.Mocks.Connector;
using TINK.Model;
using TINK.Model.Connector;
using TINK.Repository.Exception;
@ -16,15 +15,16 @@ using TINK.ViewModel.Map;
using TINK.ViewModel.Settings;
using TINK.ViewModel.Account;
using TINK.Services;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using NSubstitute;
using TestFramework.Model.Device;
using TestFramework.Repository;
using TestFramework.Model.User.Account;
using TestFramework.Model.Services.Geolocation;
using TestFramework.Services.BluetoothLock;
using TestFramework.Services.Permissions;
using TestFramework.Services.CopriApi.Connector;
using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
namespace TestTINKLib.Fixtures.ObjectTests.Account
{
@ -43,15 +43,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -83,15 +84,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "UnknownCookie", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -124,15 +126,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -164,15 +167,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false, // Offline
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null, // Offline
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -204,26 +208,27 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false, // Offline
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null, // Offline
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to

View file

@ -9,7 +9,7 @@ using TINK.Repository.Exception;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -361,7 +361,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "";
viewService.DisplayAdvancedAlert(
"Connection error when returning the bike!",
"Internet must be available when returning the bike.\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?",
"Internet must be available when returning the bike.\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?",
"Context info",
"OK");
bikesViewModel.ActionText = "Updating...";
@ -638,7 +638,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Returning bike...";
connector.Command.DoReturn(bike, Arg.Any<LocationDto>());
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler beim Zurückgeben des Rads!", "Exception message.", "OK");
viewService.DisplayAlert("Error returning bike!", "Exception message.", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";

View file

@ -9,7 +9,7 @@ using TINK.Repository.Exception;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -176,7 +176,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.CalculateAuthKeys(bike).Returns(x => throw new WebConnectFailureException("Context info", new Exception("Tst")));
bike.State.Value.Returns(InUseStateEnum.Booked);
bike.LockInfo.State.Returns(LockingState.Unknown);
bike.LockInfo.State.Returns(LockingState.UnknownFromHardwareError);
var subsequent = handler.HandleRequestOption2().Result;
@ -188,7 +188,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Request server...";
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Internet muss erreichbar sein um Verbindung mit Schloss für gemietetes Rad herzustellen.\r\nContext info\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?", "OK");
viewService.DisplayAlert("Error when connecting with lock!", "Internet must be reachable to connect to lock of rented bike.\r\nContext info\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -234,7 +234,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.CalculateAuthKeys(bike).Returns(x => throw new Exception("Exception message."));
bike.State.Value.Returns(InUseStateEnum.Booked);
bike.LockInfo.State.Returns(LockingState.Unknown);
bike.LockInfo.State.Returns(LockingState.UnknownFromHardwareError);
var subsequent = handler.HandleRequestOption2().Result;
@ -246,7 +246,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Request server...";
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Kommunikationsfehler bei Schlosssuche.\r\nException message.", "OK");
viewService.DisplayAlert("Error when connecting with lock!", "Communication error during lock search.\r\nException message.", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -310,10 +310,10 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Fehler bei Verbinden mit Schloss!",
"Schloss kann erst gefunden werden, wenn gemietetes Rad in der Nähe ist.",
"Wiederholen",
"Abbrechen");
"Error when connecting with lock!",
"Lock can only be found when rented bike is nearby.",
"Retry",
"Cancel");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -332,7 +332,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
/// Final state: Booked unknown
/// </summary>
[Test]
public void TestSearchConnectFailsException()
public void TestSearchConnectFailsException()
{
var bike = Substitute.For<IBikeInfoMutable>();
var connector = Substitute.For<IConnector>();
@ -377,11 +377,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAdvancedAlert(
"Fehler bei Verbinden mit Schloss!",
"Lock of rented bike can not be found.",
"Exception message.",
"Wiederholen",
"Abbrechen");
"Error when connecting with lock!",
"Lock of rented bike cannot be be connected right now.",
"",
"Retry",
"Cancel");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -445,7 +445,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Searching lock...";
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Schlossstatus des gemieteten Rads konnte nicht ermittelt werden.", "OK");
viewService.DisplayAlert("Error when connecting with lock!", "Schlossstatus des gemieteten Rads konnte nicht ermittelt werden.", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";

View file

@ -9,7 +9,7 @@ using TINK.Repository.Exception;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -290,7 +290,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Reserving bike...";
connector.Command.DoReserve(bike); // Booking must be performed
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Verbingungsfehler beim Reservieren des Rads!", "Context info.\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?", "OK");
viewService.DisplayAlert("Verbingungsfehler beim Reservieren des Rads!", "Context info.\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -405,7 +405,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -419,7 +419,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.DoReserve(bike); // Booking must be performed
bikesViewModel.ActionText = "Searching lock...";
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "Schloss außerhalb Reichweite";
bikesViewModel.ActionText = "Lock out of reach";
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -471,7 +471,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -485,7 +485,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.DoReserve(bike); // Booking must be performed
bikesViewModel.ActionText = "Searching lock...";
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "Schloss nicht gefunden";
bikesViewModel.ActionText = "Lock not found";
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -536,7 +536,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.Unknown); // Connect did not throw an exception but lock state is still unknown.
bike.LockInfo.State.Returns(LockingState.UnknownFromHardwareError); // Connect did not throw an exception but lock state is still unknown.
var subsequent = handler.HandleRequestOption1().Result;

View file

@ -9,7 +9,7 @@ using TINK.Repository.Exception;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -350,7 +350,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Connection error when renting the bike!",
string.Format("Attention: Lock is closed!\r\n{0}\r\n{1}", "Context info.", "Ist WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?"),
string.Format("Attention: Lock is closed!\r\n{0}\r\n{1}", "Context info.", "Is WIFI available/ mobile networt available and mobile data activated / ... ?"),
"OK");
bikesViewModel.ActionText = "Verschließe Schloss...";
locks[0].CloseAsync();

View file

@ -9,7 +9,7 @@ using TINK.Repository.Exception;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -133,7 +133,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -203,7 +203,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -266,7 +266,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -279,7 +279,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Canceling reservation...";
connector.Command.DoCancelReservation(bike); // Booking must be performed
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Verbingungsfehler beim Aufheben der Reservierung!", "Context info\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?", "OK");
viewService.DisplayAlert("Verbingungsfehler beim Aufheben der Reservierung!", "Context info\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -329,7 +329,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.Disconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
bike.LockInfo.State.Returns(LockingState.UnknownDisconnected); // Requsthandler factory queries lock state to create appropriate request handler object.
var subsequent = handler.HandleRequestOption1().Result;
@ -466,7 +466,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.CalculateAuthKeys(bike).Returns(x => throw new WebConnectFailureException("Context info.", new Exception("Tst")));
bike.State.Value.Returns(InUseStateEnum.Booked);
bike.LockInfo.State.Returns(LockingState.Unknown);
bike.LockInfo.State.Returns(LockingState.UnknownFromHardwareError);
var subsequent = handler.HandleRequestOption2().Result;
@ -478,7 +478,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Request server...";
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Internet muss erreichbar sein um Verbindung mit Schloss für reserviertes Rad herzustellen.\r\nContext info.\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?", "OK");
viewService.DisplayAlert("Error when connecting to lock!", "Internet must be reachable to connect to lock of reserved bike.\r\nContext info.\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -524,7 +524,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
connector.Command.CalculateAuthKeys(bike).Returns(x => throw new Exception("Exception message."));
bike.State.Value.Returns(InUseStateEnum.Booked);
bike.LockInfo.State.Returns(LockingState.Unknown);
bike.LockInfo.State.Returns(LockingState.UnknownFromHardwareError);
var subsequent = handler.HandleRequestOption2().Result;
@ -536,7 +536,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
pollingManager.StopUpdatePeridically(); // Polling must be stopped before any COPR and lock service action
bikesViewModel.ActionText = "Request server...";
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Kommunikationsfehler bei Schlosssuche.\r\nException message.", "OK");
viewService.DisplayAlert("Error when connecting to lock!", "Communication error during lock search.\r\nException message.", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -600,10 +600,10 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Fehler bei Verbinden mit Schloss!",
"Schloss kann erst gefunden werden, wenn reserviertes Rad in der Nähe ist.",
"Wiederholen",
"Abbrechen");
"Error when connecting to lock!",
"Lock can only be found when reserved bike is nearby.",
"Retry",
"Cancel");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -668,11 +668,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAdvancedAlert(
"Fehler bei Verbinden mit Schloss!",
"Error when connecting to lock!",
"Lock of reserved bike can not be found.",
"Execption message.",
"Wiederholen",
"Abbrechen");
"",
"Retry",
"Cancel");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";
@ -735,7 +735,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Searching lock...";
locks.ConnectAsync(Arg.Any<LockInfoAuthTdo>(), Arg.Any<TimeSpan>());
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Fehler bei Verbinden mit Schloss!", "Schlossstatus des reservierten Rads konnte nicht ermittelt werden.", "OK");
viewService.DisplayAlert("Error when connecting to lock!", "Lock status of the reserved bike could not be determined.", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";

View file

@ -11,7 +11,7 @@ using TINK.Repository.Response;
using TINK.Services.BluetoothLock;
using TINK.Services.BluetoothLock.Exception;
using TINK.Services.BluetoothLock.Tdo;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Model.State;
using TINK.View;
using TINK.ViewModel;
@ -161,7 +161,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "";
viewService.DisplayAlert(
"Connection error when renting the bike!",
string.Format("Attention: Lock is closed!\r\n{0}\r\n{1}", "Context info.", "Ist WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?"),
string.Format("Attention: Lock is closed!\r\n{0}\r\n{1}", "Context info.", "Is WIFI available/ mobile networt available and mobile data activated / ... ?"),
"OK");
bikesViewModel.ActionText = "Wiederverschließe Schloss...";
locks[0].CloseAsync();
@ -586,7 +586,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
bikesViewModel.ActionText = "Canceling reservation...";
connector.Command.DoCancelReservation(bike);
bikesViewModel.ActionText = "";
viewService.DisplayAlert("Verbingungsfehler beim Aufheben der Reservierung!", "Context info\r\nIst WLAN verfügbar/ Mobilfunknetz vefügbar und mobile Daten aktiviert / ... ?", "OK");
viewService.DisplayAlert("Verbingungsfehler beim Aufheben der Reservierung!", "Context info\r\nIs WIFI available/ mobile networt available and mobile data activated / ... ?", "OK");
bikesViewModel.ActionText = "Updating...";
pollingManager.StartUpdateAyncPeridically(); // polling must be restarted again
bikesViewModel.ActionText = "";

View file

@ -28,7 +28,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
new BikeInfo("22", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12"),
"My Station Name");
Assert.AreEqual(InUseStateEnum.Disposable, bike.State.Value);
Assert.AreEqual(LockingState.Disconnected, bike.LockInfo.State);
Assert.AreEqual(LockingState.UnknownDisconnected, bike.LockInfo.State);
Assert.AreEqual(
typeof(DisposableDisconnected),
RequestHandlerFactory.Create(

View file

@ -11,7 +11,7 @@ using TINK.View;
using TINK.ViewModel.Map;
using Xamarin.Forms;
using TINK.ViewModel.Settings;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Services;
using NSubstitute;
using TINK.Services.Permissions;
@ -19,10 +19,10 @@ using TestFramework.Services.BluetoothLock;
using TestFramework.Model.Services.Geolocation;
using TestFramework.Model.User.Account;
using TestFramework.Model.Device;
using TestFramework.Services.Permissions;
using TestFramework.Repository;
using TestFramework.Services.CopriApi.Connector;
using TINK.Repository;
using Plugin.BLE.Abstractions.Contracts;
namespace TestShareeLib.UseCases.Startup
{
@ -43,15 +43,16 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -121,15 +122,16 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -196,15 +198,16 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
@ -266,15 +269,16 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173));
@ -336,15 +340,16 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
@ -409,26 +414,27 @@ namespace TestShareeLib.UseCases.Startup
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
@ -490,30 +496,31 @@ namespace TestShareeLib.UseCases.Startup
new Uri("https://tinkwwp.copri-bike.de/APIjsonserver"),
new TINK.Settings.PollingParameters(new TimeSpan(10000), true),
Serilog.Events.LogEventLevel.Error,
true /* IsReportLevelVerbose */,
true /* IsReportLevelVerbose */,
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to

View file

@ -20,7 +20,7 @@ using TINK.Services.BluetoothLock.Tdo;
using TINK.ViewModel.MyBikes;
using TINK.Services.Permissions;
using Xamarin.Forms;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using NSubstitute.ExceptionExtensions;
using TINK.Services;
using TINK.Model.Device;
@ -28,7 +28,6 @@ using TestFramework.Model.Device;
using TestFramework.Repository;
using TestFramework.Model.User.Account;
using TestFramework.Model.Services.Geolocation;
using TestFramework.Services.Permissions;
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
{
@ -70,16 +69,17 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
Serilog.Events.LogEventLevel.Error,
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" } )),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
"MyMerchId",
geolocation,
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions,
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: geolocation,
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions,
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -165,15 +165,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
"MyMerchId",
geolocation,
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: geolocation,
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions,
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -267,15 +268,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
"MyMerchId",
geolocation,
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: geolocation,
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions,
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -364,15 +366,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
"MyMerchId",
geolocation,
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: geolocation,
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions,
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -459,15 +462,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
"MyMerchId",
geolocation,
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: geolocation,
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions,
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -548,15 +552,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "Invalid_SessionCookie", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -612,15 +617,16 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions
isConnectedFunc: () => false, // Offline
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions
specialFolder: new SpecialFolderMock(),
cipher: null, // Offline
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -679,26 +685,27 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => false, // Offline
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null, // Offline
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to
@ -760,26 +767,27 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
activeLockService: locksService.GetType().FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
locksService,
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
null, // Permissions.
isConnectedFunc: () => false, // Offline
isConnectedFunc: () => false,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
uri,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie,
mail,
server: new CopriProviderHttps(
uri,
TinkApp.MerchantId,
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
sessionCookie: sessionCookie,
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: null,
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: locksService, // Cipher
device: new DeviceMock(), // Permissions.
specialFolder: new SpecialFolderMock(),
cipher: null, // Offline
postAction: (d, obj) => d(obj),
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173), // Current app version. Must be larger or equal 3.0.173 to

View file

@ -7,13 +7,14 @@ using TestFramework.Model.Device;
namespace TestTINKLib.Fixtures.UseCases.ConnectedOffline
{
using NSubstitute;
using Plugin.BLE.Abstractions.Contracts;
using TestFramework.Model.Services.Geolocation;
using TestFramework.Model.User.Account;
using TestFramework.Services.BluetoothLock;
using TestFramework.Services.Permissions;
using TINK.Model.Connector;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TINK.Services;
using TINK.Services.Permissions;
using static TINK.Repository.CopriCallsMemory;
[TestFixture]
@ -27,15 +28,16 @@ namespace TestTINKLib.Fixtures.UseCases.ConnectedOffline
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
"MyMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
merchantId: "MyMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115), // Current app version
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
}

View file

@ -8,12 +8,13 @@ using TINK.Repository;
using TINK.ViewModel.Settings;
using NSubstitute;
using TINK.Services;
using TINK.Model.Services.Geolocation;
using TINK.Services.Geolocation;
using TestFramework.Model.Device;
using TestFramework.Model.User.Account;
using TestFramework.Model.Services.Geolocation;
using TestFramework.Services.BluetoothLock;
using TestFramework.Services.Permissions;
using TINK.Services.Permissions;
using Plugin.BLE.Abstractions.Contracts;
namespace TestTINKLib.Fixtures.UseCases.SelectStation
{
@ -40,15 +41,16 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
activeLockService: typeof(LocksServiceMock).FullName,
activeGeolocationService: typeof(GeolocationMock).FullName),
new StoreMock(),
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
"myMerchId",
Substitute.For<IServicesContainer<IGeolocation>>(),
new LocksServiceMock(),
new DeviceMock(),
new SpecialFolderMock(),
null, // Cipher
new PermissionsMock(),
isConnectedFunc: () => true,
connectorFactory: (isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
merchantId: "myMerchId",
bluetoothService: Substitute.For<IBluetoothLE>(),
locationPermissionsService: Substitute.For<ILocationPermission>(),
locationServicesContainer: Substitute.For<IServicesContainer<IGeolocation>>(),
locksService: new LocksServiceMock(), // Cipher
device: new DeviceMock(),
specialFolder: new SpecialFolderMock(),
cipher: null,
currentVersion: new Version(3, 2, 0, 115),
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to

View file

@ -73,6 +73,11 @@ namespace TestTINKLib.Mocks.Connector
public Task<ReservationBookingResponse> CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
=> throw new NotSupportedException();
public Task<ResponseBase> StartReturningBike(
string bikeId,
Uri operatorUri)
=> throw new NotImplementedException();
public Task<ReservationBookingResponse> UpdateLockingStateAsync(string bikeId, LocationDto geolocation, lock_state state, double batteryPercentage, Uri operatorUri)
=> throw new NotImplementedException();

View file

@ -91,7 +91,6 @@
<Compile Include="Fixtures\ObjectTests\User\Account\TestAccountExtensions.cs" />
<None Include="Fixtures\ObjectTests\User\Account\TestStore.cs" />
<Compile Include="Fixtures\ObjectTests\ViewModel\Bikes\Bike\BluetoothLock\RequestHandler\TestBookedClosed.cs" />
<Compile Include="Fixtures\ObjectTests\ViewModel\Bikes\Bike\BluetoothLock\RequestHandler\TestBookedOpen.cs" />
<Compile Include="Fixtures\ObjectTests\ViewModel\Bikes\Bike\BluetoothLock\RequestHandler\TestBookedDisconnected.cs" />
<Compile Include="Fixtures\ObjectTests\ViewModel\Bikes\Bike\BluetoothLock\RequestHandler\TestDisposableDisconnected.cs" />
<Compile Include="Fixtures\ObjectTests\ViewModel\Bikes\Bike\BluetoothLock\RequestHandler\TestDisposableOpen.cs" />