mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 13:57:28 +02:00
Mini survey added.
Minor fiexes.
This commit is contained in:
parent
ddfea49ea6
commit
e321764119
73 changed files with 1628 additions and 185 deletions
|
@ -20,6 +20,7 @@ using TINK.Repository.Request;
|
|||
using TINK.Repository.Response;
|
||||
using Newtonsoft.Json;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.MiniSurvey;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
||||
{
|
||||
|
@ -337,7 +338,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
locks[0].GetDeviceState().Returns(DeviceState.Connected); // Simulate bike in reach. If bike is out of reach bluetooth state changes to unknown.
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns(x => throw new WebConnectFailureException("Context info", new Exception("hoppla")));
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<MiniSurveyModel>(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.
|
||||
|
@ -408,7 +409,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
NotAtStationException.IsNotAtStation("Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 42. OK: bike 1545 locked confirmed", out NotAtStationException notAtStationException);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<MiniSurveyModel>(x =>
|
||||
throw notAtStationException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
|
@ -478,7 +479,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
NoGPSDataException.IsNoGPSData("Failure 2245: No GPS data, state change forbidden.", out NoGPSDataException noGPSDataException);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<MiniSurveyModel>(x =>
|
||||
throw noGPSDataException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
|
@ -546,7 +547,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
locks[0].GetDeviceState().Returns(DeviceState.Connected); // Simulate bike in reach. If bike is out of reach bluetooth state changes to unknown.
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<MiniSurveyModel>(x =>
|
||||
throw new ReturnBikeException(JsonConvert.DeserializeObject<ReservationCancelReturnResponse>(@"{ ""response_text"" : ""Some invalid data received!""}"), "Outer message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Reqesthandler factory queries state to create appropriate request handler object.
|
||||
|
@ -614,7 +615,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
locks[0].GetDeviceState().Returns(DeviceState.Connected); // Simulate bike in reach. If bike is out of reach bluetooth state changes to unknown.
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns(x => throw new Exception("Exception message."));
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>()).Returns<MiniSurveyModel>(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.
|
||||
|
|
|
@ -21,6 +21,7 @@ using TINK.Repository.Request;
|
|||
using Newtonsoft.Json;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.MiniSurvey;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler
|
||||
{
|
||||
|
@ -472,7 +473,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
locks[0].CloseAsync()
|
||||
.Returns(LockitLockingState.Closed);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns(x => throw new WebConnectFailureException("Context info", new System.Exception("hoppla")));
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns<MiniSurveyModel>(x => throw new WebConnectFailureException("Context info", new System.Exception("hoppla")));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Booking state remains unchanged if closing fails.
|
||||
|
||||
|
@ -541,7 +542,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
locks[0].CloseAsync()
|
||||
.Returns(LockitLockingState.Closed);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns(x => throw new System.Exception("Exception message."));
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns<MiniSurveyModel>(x => throw new System.Exception("Exception message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Booking state remains unchanged if closing fails.
|
||||
|
||||
|
@ -612,7 +613,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
NotAtStationException.IsNotAtStation("Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 77. OK: bike 1545 locked confirmed", out NotAtStationException notAtStationException);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns<MiniSurveyModel>(x =>
|
||||
throw notAtStationException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Booking state remains unchanged if closing fails.
|
||||
|
@ -684,7 +685,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
|
||||
NoGPSDataException.IsNoGPSData("Failure 2245: No GPS data, state change forbidden.", out NoGPSDataException noGPSDataException);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns<MiniSurveyModel>(x =>
|
||||
throw noGPSDataException);
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Booking state remains unchanged if closing fails.
|
||||
|
@ -754,7 +755,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel.Bikes.Bike.BluetoothLock.Re
|
|||
locks[0].CloseAsync()
|
||||
.Returns(LockitLockingState.Closed);
|
||||
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns(x =>
|
||||
connector.Command.DoReturn(bike, Arg.Any<LocationDto>(), Arg.Any<ISmartDevice>()).Returns<MiniSurveyModel>(x =>
|
||||
throw new ReturnBikeException(JsonConvert.DeserializeObject<ReservationCancelReturnResponse>(@"{ ""response_text"" : ""Some invalid data received!""}"), "Outer message."));
|
||||
|
||||
bike.State.Value.Returns(InUseStateEnum.Booked); // Booking state remains unchanged if closing fails.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue