mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.362
This commit is contained in:
parent
cba4da9357
commit
4ff3307997
128 changed files with 3954 additions and 3193 deletions
24
TestFramework/DateTimeMocker.cs
Normal file
24
TestFramework/DateTimeMocker.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TestTINKLib
|
||||
{
|
||||
public class DateTimeMocker
|
||||
{
|
||||
private static int m_iIndex;
|
||||
private static IList<DateTime> m_oDateTimeSeries;
|
||||
|
||||
public DateTimeMocker(IList<DateTime> p_oDateTimeSeries)
|
||||
{
|
||||
if (p_oDateTimeSeries.Count < 1)
|
||||
{
|
||||
throw new Exception("Can not initialize mock object. List must contain at least one date time.");
|
||||
}
|
||||
|
||||
m_iIndex = 0;
|
||||
m_oDateTimeSeries = p_oDateTimeSeries;
|
||||
}
|
||||
|
||||
public Func<DateTime> GetDateTime = () => m_oDateTimeSeries[m_iIndex < m_oDateTimeSeries.Count ? m_iIndex++ : m_iIndex = 0];
|
||||
}
|
||||
}
|
138
TestFramework/Services/CopriApi/CopriCallsCacheMemory.cs
Normal file
138
TestFramework/Services/CopriApi/CopriCallsCacheMemory.cs
Normal file
|
@ -0,0 +1,138 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
namespace TestTINKLib.Mocks.Connector
|
||||
{
|
||||
/// <summary> Allows use of memory for retrieving defined respones.</summary>
|
||||
public class CopriCallsCacheMemory : ICopriCache
|
||||
{
|
||||
private CopriCallsMemory server;
|
||||
|
||||
public CopriCallsCacheMemory(
|
||||
string merchantId,
|
||||
SampleSets? sampleSet = null,
|
||||
int? index = null,
|
||||
string sessionCookie = null)
|
||||
{
|
||||
server = new CopriCallsMemory(merchantId, sampleSet, index, sessionCookie);
|
||||
}
|
||||
|
||||
public bool IsStationsExpired => true;
|
||||
|
||||
public bool IsBikesAvailableExpired => true;
|
||||
|
||||
public bool IsBikesOccupiedExpired => true;
|
||||
|
||||
public bool IsConnected => server.IsConnected;
|
||||
|
||||
public string SessionCookie => server.SessionCookie;
|
||||
|
||||
public string MerchantId => server.MerchantId;
|
||||
|
||||
public void AddToCache(StationsAvailableResponse stations)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void AddToCache(BikesAvailableResponse bikes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void AddToCache(BikesReservedOccupiedResponse bikes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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 NotSupportedException();
|
||||
|
||||
public Task<ResponseBase> StartReturningBike(
|
||||
string bikeId,
|
||||
Uri operatorUri)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> UpdateLockingStateAsync(
|
||||
string bikeId,
|
||||
lock_state state,
|
||||
Uri operatorUri,
|
||||
LocationDto geolocation,
|
||||
double batteryPercentage,
|
||||
IVersionInfo versionInfo)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> DoBookAsync(Uri operatorUri, string bikeId, Guid guid, double batteryPercentage, LockingAction? nextAction = null)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> BookAvailableAndStartOpeningAsync(string bikeId, Uri operatorUri)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<ReservationBookingResponse> BookReservedAndStartOpeningAsync(string bikeId, Uri operatorUri)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
public Task<DoReturnResponse> DoReturn(string bikeId, LocationDto location, Uri operatorUri)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
/// <summary> Returns a bike and starts closing. </summary>
|
||||
/// <param name="bikeId">Id of the bike to return.</param>
|
||||
/// <param name="smartDevice">Provides info about hard and software.</param>
|
||||
/// <param name="operatorUri">Holds the uri of the operator or null, in case of single operator setup.</param>
|
||||
/// <returns>Response on returning request.</returns>
|
||||
public Task<DoReturnResponse> ReturnAndStartClosingAsync(
|
||||
string bikeId,
|
||||
Uri operatorUri)
|
||||
=> throw new System.Exception("Rückgabe mit mit Schloss schließen Befehl Offlinemodus nicht möglich!");
|
||||
|
||||
public Task<SubmitFeedbackResponse> DoSubmitFeedback(string bikeId, int? currentChargeBars, string message, bool isBikeBroken, Uri operatorUri)
|
||||
=> throw new NotImplementedException();
|
||||
|
||||
/// <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();
|
||||
|
||||
public Task<BikesAvailableResponse> GetBikesAvailableAsync()
|
||||
{
|
||||
return server.GetBikesAvailableAsync();
|
||||
}
|
||||
|
||||
public Task<BikesReservedOccupiedResponse> GetBikesOccupiedAsync()
|
||||
{
|
||||
return server.GetBikesOccupiedAsync();
|
||||
}
|
||||
|
||||
public Task<StationsAvailableResponse> GetStationsAsync()
|
||||
{
|
||||
return server.GetStationsAsync();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Services.Geolocation;
|
||||
|
@ -6,10 +6,10 @@ using Xamarin.Essentials;
|
|||
|
||||
namespace TestFramework.Model.Services.Geolocation
|
||||
{
|
||||
public class GeolocationMock : IGeolocation
|
||||
public class GeolocationMock : IGeolocationService
|
||||
{
|
||||
|
||||
public Task<Location> GetAsync(CancellationToken? cancelToken = null, DateTime? timeStamp = null)
|
||||
public Task<IGeolocation> GetAsync(CancellationToken? cancelToken = null, DateTime? timeStamp = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue