using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
using ShareeBike.Model.Connector;
using ShareeBike.Model.Device;
using ShareeBike.Repository;
using ShareeBike.Repository.Request;
using ShareeBike.Repository.Response;
using ShareeBike.Repository.Response.Stations;
namespace SharedBusinessLogic.Tests.Framework.Repository
{
/// Simulates communication errors when connecting to copri.
public class ExceptionServer : ICopriServer
{
private Func ExceptionFactory { get; }
/// Constructs object.
/// Provides exceptions which are thrown when querying information from server.
public ExceptionServer(Func exceptionFactory)
{
ExceptionFactory = exceptionFactory;
}
public bool IsConnected => true;
public string SessionCookie => string.Empty;
public string MerchantId => string.Empty;
public Task DoAuthorizationAsync(string p_strMailAddress, string p_strPassword, string p_strDeviceId)
{
throw new NotImplementedException();
}
public Task DoAuthoutAsync()
{
throw new NotImplementedException();
}
public Task DoReserveAsync(string bikeId, Uri operatorUri)
{
throw new NotImplementedException();
}
public Task DoCancelReservationAsync(string p_iBikeId, Uri operatorUri)
{
throw new NotImplementedException();
}
public Task CalculateAuthKeysAsync(string bikeId, Uri operatorUri)
=> throw new NotImplementedException();
public Task StartReturningBike(
string bikeId,
Uri operatorUri)
=> null;
public Task UpdateLockingStateAsync(
string bikeId,
lock_state state,
Uri operatorUri,
LocationDto geolocation,
double batteryPercentage,
IVersionInfo versionInfo)
=> throw new NotImplementedException();
public Task DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
=> throw new NotImplementedException();
public Task BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)
=> throw new NotImplementedException();
public Task BookReservedAndStartOpeningAsync(string bikeId, Uri operatorUri)
=> throw new NotImplementedException();
public Task DoReturn(string bikeId, LocationDto location, Uri operatorUri)
=> throw new NotImplementedException();
public Task ReturnAndStartClosingAsync(
string bikeId,
Uri operatorUri)
=> throw new NotImplementedException();
public Task DoSubmitFeedback(string bikeId, int? currentChargeBars, string message, bool isBikeBroken, Uri operatorUri)
=> throw new NotImplementedException();
/// Submits mini survey to copri server.
/// Collection of answers.
public Task DoSubmitMiniSurvey(IDictionary answers)
=> throw new NotImplementedException();
/// Gets a list of bikes from Copri.
/// Uri of the operator host to get bikes from or null if bikes have to be gotten form primary host.
/// Id of station which is used for filtering bikes. Null if no filtering should be applied.
/// Id of bike which is used for filtering bikes. Null if no filtering should be applied.
/// Response holding list of bikes.
public Task GetBikesAvailableAsync(Uri operatorUri = null, string stationId = null, string bikeId = null)
=> throw ExceptionFactory($"Simulated error thrown at {nameof(GetBikesAvailableAsync)}.");
public Task GetBikesOccupiedAsync()
{
throw ExceptionFactory($"Simulated error thrown at {nameof(GetBikesOccupiedAsync)}.");
}
public Task GetStationsAsync()
{
throw ExceptionFactory($"Simulated error thrown at {nameof(GetStationsAsync)}.");
}
}
}