mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 21:06:30 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -6,10 +6,10 @@ using System.Threading.Tasks;
|
|||
using TINK.Model;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestFramework.Repository
|
||||
{
|
||||
|
@ -42,7 +42,8 @@ namespace TestFramework.Repository
|
|||
/// <param name="stationsResponseResource"></param>
|
||||
/// <param name="bookingRequestResponseResource"></param>
|
||||
/// <param name="cancelBookingRequestResponseResource"></param>
|
||||
/// <param name="sessionCookie"></param>
|
||||
/// <param name="sessionCookie">Session cookie.</param>
|
||||
/// <param name="merchantId">Merchant identifier.</param>
|
||||
public CopriCallMemoryBase(
|
||||
string bikesAvailableResponseResource = null,
|
||||
string bikesOccupiedResponseResoure = null,
|
||||
|
@ -51,7 +52,8 @@ namespace TestFramework.Repository
|
|||
string stationsResponseResource = null,
|
||||
string bookingRequestResponseResource = null,
|
||||
string cancelBookingRequestResponseResource = null,
|
||||
string sessionCookie = null)
|
||||
string sessionCookie = null,
|
||||
string merchantId = null)
|
||||
{
|
||||
string ReadResource(string resourceName)
|
||||
{
|
||||
|
@ -64,6 +66,8 @@ namespace TestFramework.Repository
|
|||
}
|
||||
}
|
||||
|
||||
MerchantId = merchantId ?? TinkApp.MerchantId;
|
||||
|
||||
SessionCookie = sessionCookie;
|
||||
|
||||
BikesAvailableResponse = ReadResource(bikesAvailableResponseResource);
|
||||
|
@ -75,8 +79,8 @@ namespace TestFramework.Repository
|
|||
CancelBookingRequestResponse = ReadResource(cancelBookingRequestResponseResource);
|
||||
|
||||
requestBuilder = string.IsNullOrEmpty(sessionCookie)
|
||||
? new RequestBuilder(MerchantId, null /*UI language */) as IRequestBuilder
|
||||
: new RequestBuilderLoggedIn(MerchantId, null /*UI language */, sessionCookie);
|
||||
? new RequestBuilder(merchantId ?? MerchantId, null /*UI language */) as IRequestBuilder
|
||||
: new RequestBuilderLoggedIn(merchantId ?? MerchantId, null /*UI language */, sessionCookie);
|
||||
}
|
||||
|
||||
/// <summary> Holds the session id of the logged in user, null otherwise. </summary>
|
||||
|
@ -85,7 +89,7 @@ namespace TestFramework.Repository
|
|||
/// <summary> Logs user in. </summary>
|
||||
/// <param name="p_oUser">User to log in.</param>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="mailAddress">Mail address of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
||||
public async Task<AuthorizationResponse> DoAuthorizationAsync(
|
||||
|
@ -108,7 +112,7 @@ namespace TestFramework.Repository
|
|||
=> await Task.Run(() => GetBikesAvailable(BikesAvailableResponse, null, SessionCookie));
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of bikes reserved/ booked by acctive user from Copri.
|
||||
/// Gets a list of bikes reserved/ booked by active user from Copri.
|
||||
/// </summary>
|
||||
/// <param name="p_strSessionCookie">Cookie to authenticate user.</param>
|
||||
/// <returns>Response holding list of bikes.</returns>
|
||||
|
@ -116,7 +120,7 @@ namespace TestFramework.Repository
|
|||
{
|
||||
try
|
||||
{
|
||||
requestBuilder.GetBikesOccupied(); // Non mock implementation if ICopriServer call this member as well. To ensure comparable behaviour this member is called here as well.
|
||||
requestBuilder.GetBikesOccupied(); // Non mock implementation if ICopriServer call this member as well. To ensure comparable behavior this member is called here as well.
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
|
@ -144,7 +148,7 @@ namespace TestFramework.Repository
|
|||
=> await Task.Run(() => DoReserve(BookingRequestResponse, bikeId, SessionCookie));
|
||||
|
||||
/// <summary>
|
||||
/// Gets canel booking request response.
|
||||
/// Gets cancel booking request response.
|
||||
/// </summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
/// <param name="cookie">Cookie of the logged in user.</param>
|
||||
|
@ -154,14 +158,14 @@ namespace TestFramework.Repository
|
|||
|
||||
|
||||
/// <summary> Gets the merchant id.</summary>
|
||||
public string MerchantId => TinkApp.MerchantId;
|
||||
public string MerchantId { get; }
|
||||
|
||||
/// <summary> Returns false because cached values are returned. </summary>
|
||||
public bool IsConnected => false;
|
||||
|
||||
/// <summary> Logs user in. </summary>
|
||||
/// <param name="deviceId">Id specifying user and hardware.</param>
|
||||
/// <param name="mailAddress">Mailaddress of user to log in.</param>
|
||||
/// <param name="mailAddress">Mail address of user to log in.</param>
|
||||
/// <param name="password">Password to log in.</param>
|
||||
/// <remarks>Response which holds auth cookie <see cref="ResponseBase.authcookie"/></remarks>
|
||||
public static AuthorizationResponse DoAuthorize(
|
||||
|
@ -236,7 +240,7 @@ namespace TestFramework.Repository
|
|||
=> JsonConvertRethrow.DeserializeObject<ResponseContainer<ReservationBookingResponse>>(bookingRequestResponse).shareejson;
|
||||
|
||||
/// <summary>
|
||||
/// Gets canel booking request response.
|
||||
/// Gets cancel booking request response.
|
||||
/// </summary>
|
||||
/// <param name="bikeId">Id of the bike to book.</param>
|
||||
/// <param name="cookie">Cookie of the logged in user.</param>
|
||||
|
@ -292,7 +296,7 @@ namespace TestFramework.Repository
|
|||
=> null;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of bikes reserved/ booked by acctive user from Copri.
|
||||
/// Gets a list of bikes reserved/ booked by active user from Copri.
|
||||
/// </summary>
|
||||
/// <param name="sessionCookie">Cookie to authenticate user.</param>
|
||||
/// <param name="SampleSet">Sample set to use.</param>
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
using TINK.Repository;
|
||||
using TINK.Repository;
|
||||
|
||||
namespace TestFramework.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds some COPRI responses for testing purposes.
|
||||
/// </summary>
|
||||
/// <remarks> Holds some demo Meinkonrad and LastenradBayern bikes
|
||||
/// <remarks> Holds some demo Mein konrad and LastenradBayern bikes
|
||||
/// </remarks>
|
||||
public class CopriCallsMemory001 : CopriCallMemoryBase, ICopriServer
|
||||
{
|
||||
public CopriCallsMemory001(string sessionCookie = null) : base(
|
||||
/// <param name="sessionCookie">Session cookie.</param>
|
||||
/// <param name="merchantId">Merchant identifier.</param>
|
||||
public CopriCallsMemory001(string sessionCookie = null, string merchantId = null) : base(
|
||||
bikesAvailableResponseResource: "TestFramework.Repository.CopriCallsMemory001.BikesAvailableResponse.json",
|
||||
bikesOccupiedResponseResoure: "TestFramework.Repository.CopriCallsMemory001.BikesOccupiedResponse.json",
|
||||
authResponseResource: "TestFramework.Repository.CopriCallsMemory001.AuthorizationResponse.json",
|
||||
authOutResponseResource: "TestFramework.Repository.CopriCallsMemory001.AuthoutResponse.json",
|
||||
stationsResponseResource: "TestFramework.Repository.CopriCallsMemory001.StationsAvailable.json",
|
||||
sessionCookie: sessionCookie)
|
||||
sessionCookie: sessionCookie,
|
||||
merchantId: merchantId)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using TINK.Model.Device;
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestFramework.Repository
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ namespace TestFramework.Repository
|
|||
private Func<string, Exception> ExceptionFactory { get; }
|
||||
|
||||
/// <summary> Constructs object.</summary>
|
||||
/// <param name="exceptionFactory"> Provides exceptions which are thrown whenn querrying information from server.</param>
|
||||
/// <param name="exceptionFactory"> Provides exceptions which are thrown when querying information from server.</param>
|
||||
public ExceptionServer(Func<string, Exception> exceptionFactory)
|
||||
{
|
||||
ExceptionFactory = exceptionFactory;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Bikes;
|
||||
|
@ -16,7 +16,7 @@ namespace TestFramework.Services.BluetoothLock
|
|||
return await Task.FromResult(new List<LockInfoTdo>());
|
||||
}
|
||||
|
||||
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
|
||||
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
|
||||
public ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
public void UpdateSimulation(BikeCollection bikes) { }
|
||||
|
|
|
@ -8,11 +8,12 @@ using TINK.Model.Services.CopriApi;
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
namespace TestTINKLib.Mocks.Connector
|
||||
{
|
||||
/// <summary> Allows use of memory for retrieving defined respones.</summary>
|
||||
/// <summary> Allows use of memory for retrieving defined responses.</summary>
|
||||
public class CopriCallsCacheMemory : ICopriCache
|
||||
{
|
||||
private CopriCallsMemory server;
|
||||
|
|
|
@ -7,10 +7,11 @@ using TINK.Model.Connector;
|
|||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository.Request;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestFramework.Services.CopriApi.Connector
|
||||
{
|
||||
/// <summary> Allows use of memory for retrieving defined respones.</summary>
|
||||
/// <summary> Allows use of memory for retrieving defined responses.</summary>
|
||||
public class CopriCallsCacheMemory001 : ICopriCache
|
||||
{
|
||||
private CopriCallsMemory001 server;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue