using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using TINK.Model.Device;
using TINK.Repository;
using TINK.Repository.Request;
using TINK.Repository.Response;
namespace TestFramework.Repository
{
/// Simulates communication errors when connecting to copri.
public class ExceptionServer : ICopriServer
{
private Func ExceptionFactory { get; }
/// Constructs object.
/// Provides exceptions which are thrown whenn querrying 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 UpdateLockingStateAsync(string bikeId, LocationDto geolocation, lock_state state, double batteryPercentage, Uri operatorUri)
=> throw new NotImplementedException();
public Task DoBookAsync(string bikeId, Guid guid, double batteryPercentage, Uri operatorUri)
{
throw new NotImplementedException();
}
public Task DoReturn(string bikeId, LocationDto location, ISmartDevice smartDevice, Uri operatorUri)
=> throw new NotImplementedException();
public Task DoSubmitFeedback(string bikeId, 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();
public Task GetBikesAvailableAsync()
{
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)}.");
}
}
}