2021-07-12 21:31:46 +02:00
|
|
|
|
using System;
|
2021-08-01 17:24:15 +02:00
|
|
|
|
using System.Collections.Generic;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using TINK.Model.Device;
|
|
|
|
|
using TINK.Repository;
|
|
|
|
|
using TINK.Repository.Request;
|
|
|
|
|
using TINK.Repository.Response;
|
|
|
|
|
|
|
|
|
|
namespace TestTINKLib.Mocks.Connector
|
|
|
|
|
{
|
|
|
|
|
/// <summary> Simulates communication errors when connecting to copri.</summary>
|
|
|
|
|
public class ExceptionServer : ICopriServer
|
|
|
|
|
{
|
|
|
|
|
private Func<string, Exception> ExceptionFactory { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary> Constructs object.</summary>
|
|
|
|
|
/// <param name="exceptionFactory"> Provides exceptions which are thrown whenn querrying information from server.</param>
|
|
|
|
|
public ExceptionServer(Func<string, Exception> exceptionFactory)
|
|
|
|
|
{
|
|
|
|
|
ExceptionFactory = exceptionFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsConnected => true;
|
|
|
|
|
|
|
|
|
|
public string SessionCookie => string.Empty;
|
|
|
|
|
|
|
|
|
|
public string MerchantId => string.Empty;
|
|
|
|
|
|
|
|
|
|
public Task<AuthorizationResponse> DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<AuthorizationoutResponse> DoAuthoutAsync()
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<ReservationBookingResponse> DoReserveAsync(string bikeId, Uri operatorUri)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<ReservationCancelReturnResponse> DoCancelReservationAsync(string p_iBikeId, Uri operatorUri)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<ReservationBookingResponse> CalculateAuthKeysAsync(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();
|
|
|
|
|
|
|
|
|
|
public Task<ReservationBookingResponse> DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<ReservationCancelReturnResponse> DoReturn(string bikeId, LocationDto location, ISmartDevice smartDevice, Uri operatorUri)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, string message, bool isBikeBroken, Uri operatorUri)
|
|
|
|
|
=> throw new NotImplementedException();
|
|
|
|
|
|
2021-08-01 17:24:15 +02:00
|
|
|
|
/// <summary> Submits mini survey to copri server. </summary>
|
|
|
|
|
/// <param name="answers">Collection of answers.</param>
|
|
|
|
|
public Task<ResponseBase> DoSubmitMiniSurvey(IDictionary<string, string> answers)
|
|
|
|
|
=> throw new NotImplementedException();
|
|
|
|
|
|
2021-07-12 21:31:46 +02:00
|
|
|
|
public Task<BikesAvailableResponse> GetBikesAvailableAsync()
|
|
|
|
|
{
|
|
|
|
|
throw ExceptionFactory($"Simulated error thrown at {nameof(GetBikesAvailableAsync)}.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<BikesReservedOccupiedResponse> GetBikesOccupiedAsync()
|
|
|
|
|
{
|
|
|
|
|
throw ExceptionFactory($"Simulated error thrown at {nameof(GetBikesOccupiedAsync)}.");
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-20 23:06:09 +02:00
|
|
|
|
public Task<StationsAvailableResponse> GetStationsAsync()
|
2021-07-12 21:31:46 +02:00
|
|
|
|
{
|
|
|
|
|
throw ExceptionFactory($"Simulated error thrown at {nameof(GetStationsAsync)}.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|