mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 05:47:28 +02:00
Version 3.0.337
This commit is contained in:
parent
fd0e63cf10
commit
573fe77e12
2336 changed files with 33688 additions and 86082 deletions
|
@ -1,9 +1,9 @@
|
|||
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
|
@ -86,7 +86,7 @@ namespace UITest.Fixtures.Connector
|
|||
/// <returns>List of files.</returns>
|
||||
public static StationsAvailableResponse GetStationsAllCall(
|
||||
string p_strCopriHost,
|
||||
string p_strMerchantId,
|
||||
string p_strMerchantId,
|
||||
string p_strCookie = null)
|
||||
{
|
||||
var l_oCommand = string.Format(
|
||||
|
@ -115,11 +115,11 @@ namespace UITest.Fixtures.Connector
|
|||
/// <returns>Response holding list of bikes.</returns>
|
||||
public static BikesAvailableResponse GetBikesAvailableCall(
|
||||
string copriHost,
|
||||
string merchantId,
|
||||
string merchantId,
|
||||
string sessionCookie = null)
|
||||
{
|
||||
#if !WINDOWS_UWP
|
||||
string l_oCommand =
|
||||
string l_oCommand =
|
||||
$"request=bikes_available&system=all&authcookie={sessionCookie ?? string.Empty}{merchantId}";
|
||||
|
||||
string response;
|
||||
|
@ -147,7 +147,7 @@ namespace UITest.Fixtures.Connector
|
|||
#if !WINDOWS_UWP
|
||||
string l_oCommand = !string.IsNullOrEmpty(sessionCookie)
|
||||
? $"request=user_bikes_occupied&system=all&authcookie={sessionCookie}{merchantId}"
|
||||
: "request=bikes_available";
|
||||
: "request=bikes_available";
|
||||
|
||||
string l_oBikesOccupiedResponse;
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace UITest.Fixtures.Connector
|
|||
p_strSessionCookie,
|
||||
p_strMerchantId);
|
||||
|
||||
string l_oBikesAvaialbeResponse = Post(l_oCommand, copriHost);
|
||||
string l_oBikesAvaialbeResponse = Post(l_oCommand, copriHost);
|
||||
|
||||
// Extract bikes from response.
|
||||
return JsonConvert.DeserializeObject<ResponseContainer<ReservationBookingResponse>>(l_oBikesAvaialbeResponse)?.shareejson;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model.Connector.Filter;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector.Filter
|
||||
|
@ -15,7 +15,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Filter
|
|||
|
||||
Assert.AreEqual(1, filter.DoFilter(null).Count());
|
||||
Assert.AreEqual(
|
||||
"Tonk",
|
||||
"Tonk",
|
||||
filter.DoFilter(null).ToArray()[0],
|
||||
"Do not apply filtering when null is passed as argement (null-filter).");
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model.Connector.Filter;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector.Filter
|
||||
|
@ -16,7 +13,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Filter
|
|||
{
|
||||
var filter = new NullGroupFilter();
|
||||
Assert.IsNull(filter.DoFilter(null));
|
||||
Assert.AreEqual(0, filter.DoFilter(new List<string>()).Count());
|
||||
Assert.AreEqual(0, filter.DoFilter(new List<string>()).Count());
|
||||
Assert.AreEqual(1, filter.DoFilter(new List<string> { "Hello" }).Count());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
|
@ -170,7 +170,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
var server = MockRepository.GenerateMock<ICachedCopriServer>();
|
||||
|
||||
server.Stub(x => x.GetBikesAvailable()).Return(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
|
@ -318,21 +319,18 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
[Test]
|
||||
public async Task TestGetBikes()
|
||||
{
|
||||
var server = MockRepository.GenerateMock<ICachedCopriServer>();
|
||||
var server = Substitute.For<ICachedCopriServer>();
|
||||
|
||||
server.Stub(x => x.GetBikesAvailable()).Return(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
server.GetBikesAvailable().Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE),
|
||||
new GeneralData())));
|
||||
|
||||
server.Stub(x => x.GetBikesOccupied()).Return(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
server.GetBikesOccupied().Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
new GeneralData())));
|
||||
|
||||
server.Stub(x => x.AddToCache(Arg<Result<BikesAvailableResponse>>.Is.Anything));
|
||||
server.Stub(x => x.AddToCache(Arg<Result<BikesReservedOccupiedResponse>>.Is.Anything));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAsync();
|
||||
|
||||
Assert.AreEqual(2, result.Response.Count);
|
||||
|
@ -343,15 +341,18 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
|||
[Test]
|
||||
public async Task TestGetBikesOccupied()
|
||||
{
|
||||
var server = MockRepository.GenerateMock<ICachedCopriServer>();
|
||||
var server = Substitute.For<ICachedCopriServer>();
|
||||
|
||||
server.Stub(x => x.GetBikesOccupied()).Return(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
server.GetBikesAvailable().Returns(Task.Run(() => new Result<BikesAvailableResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesAvailableResponse>("{}"),
|
||||
new GeneralData())));
|
||||
|
||||
server.GetBikesOccupied().Returns(Task.Run(() => new Result<BikesReservedOccupiedResponse>(
|
||||
typeof(CopriCallsHttps),
|
||||
JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED),
|
||||
new GeneralData())));
|
||||
|
||||
server.Stub(x => x.AddToCache(Arg<Result<BikesReservedOccupiedResponse>>.Is.Anything));
|
||||
|
||||
var result = await new CachedQueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesOccupiedAsync();
|
||||
|
||||
Assert.AreEqual(1, result.Response.Count);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using Newtonsoft.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
|
@ -113,7 +114,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
server.Stub(x => x.GetBikesAvailableAsync()).Return(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>(BIKESAVAILABLE)));
|
||||
server.Stub(x => x.GetBikesOccupiedAsync()).Return(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", ()=> DateTime.Now).GetBikesAndStationsAsync();
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesAndStationsAsync();
|
||||
|
||||
Assert.AreEqual(3, result.Response.StationsAll.Count);
|
||||
Assert.AreEqual(2, result.Response.Bikes.Count);
|
||||
|
@ -139,9 +140,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
[Test]
|
||||
public async Task TestGetBikesOccupied()
|
||||
{
|
||||
var server = MockRepository.GenerateMock<ICopriServer>();
|
||||
var server = Substitute.For<ICopriServer>();
|
||||
|
||||
server.Stub(x => x.GetBikesOccupiedAsync()).Return(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
server.GetBikesAvailableAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesAvailableResponse>("{}")));
|
||||
|
||||
server.GetBikesOccupiedAsync().Returns(Task.Run(() => JsonConvert.DeserializeObject<BikesReservedOccupiedResponse>(BIKESOCCUPIED)));
|
||||
|
||||
var result = await new QueryLoggedIn(server, "123", "a@b", () => DateTime.Now).GetBikesOccupiedAsync();
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Repository;
|
||||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using static TINK.Repository.CopriCallsMemory;
|
|||
|
||||
namespace TestTINKLib.Fixtures.Connector.Response
|
||||
{
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class TestBookingResponse
|
||||
{
|
||||
|
@ -33,17 +33,17 @@ namespace TestTINKLib.Fixtures.Connector.Response
|
|||
{
|
||||
// Create response to check
|
||||
var l_oResponse = DoReserve(
|
||||
"8",
|
||||
"4da3044c8657a04ba60e2eaa753bc51a",
|
||||
SampleSets.Set2,
|
||||
"8",
|
||||
"4da3044c8657a04ba60e2eaa753bc51a",
|
||||
SampleSets.Set2,
|
||||
1);
|
||||
|
||||
Assert.AreEqual(
|
||||
"4da3044c8657a04ba60e2eaa753bc51aoiF2kahH",
|
||||
"4da3044c8657a04ba60e2eaa753bc51aoiF2kahH",
|
||||
l_oResponse.authcookie);
|
||||
|
||||
Assert.AreEqual(
|
||||
"OK: requested bike 8",
|
||||
"OK: requested bike 8",
|
||||
l_oResponse.response_state);
|
||||
|
||||
Assert.NotNull(
|
||||
|
|
|
@ -4,7 +4,7 @@ using NUnit.Framework;
|
|||
|
||||
namespace TINK.Repository.Response
|
||||
{
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class TestResponseBase
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace TINK.Repository.Response
|
|||
Assert.AreEqual(
|
||||
"Response state is \"OhMyState\", " +
|
||||
$"auth cookie is \"lecker1\" and response is \"die Antwort\", " +
|
||||
$"code \"HabGsagt\""+
|
||||
$"code \"HabGsagt\"" +
|
||||
$"response text \"die Antwort\".",
|
||||
l_oResponse.ToString());
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Response
|
|||
[Test]
|
||||
public void TestGetIsResponseOk_BikesOccupied_AuthcookieNotDefined()
|
||||
{
|
||||
var l_oResponseBase = JsonConvert.DeserializeObject<ResponseBase>($"{{ \"response_state\" : \"Failure 1003: authcookie not defined\" }}");
|
||||
Assert.Throws<AuthcookieNotDefinedException>(() => l_oResponseBase.GetIsResponseOk("Get not succeed"));
|
||||
var l_oResponseBase = JsonConvert.DeserializeObject<ResponseBase>($"{{ \"response_state\" : \"Failure 1003: authcookie not defined\" }}");
|
||||
Assert.Throws<AuthcookieNotDefinedException>(() => l_oResponseBase.GetIsResponseOk("Get not succeed"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Response
|
|||
@"""authcookie"" : ""KeksoiF2kahH"" }");
|
||||
|
||||
Assert.That(
|
||||
() => l_oResponse.GetIsReturnBikeResponseOk("8"),
|
||||
() => l_oResponse.GetIsReturnBikeResponseOk("8"),
|
||||
Throws.Exception.TypeOf<InvalidResponseException<ResponseBase>>());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using TINK.Model;
|
||||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
namespace TestTINKLib.Fixtures.Connector
|
||||
{
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class TestStationsAllResponse
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Exception;
|
||||
|
@ -23,7 +23,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
var l_oCmd = new CommandLoggedIn(l_oServer, "MeinKeks", "EMehl", () => DateTime.Now);
|
||||
|
||||
LoginStateChangedEventArgs l_oEventArgs = null;
|
||||
LoginStateChangedEventArgs l_oEventArgs = null;
|
||||
l_oCmd.LoginStateChanged += (sender, eventargs) => l_oEventArgs = eventargs;
|
||||
|
||||
l_oCmd.DoLogout().Wait();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
|
@ -22,6 +22,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCommand = new TINK.Model.Connector.Connector(
|
||||
new System.Uri("http://1.2.3.4"),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
"", // Not logged in
|
||||
"",
|
||||
server: l_oCopri).Command;
|
||||
|
@ -39,7 +40,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
var l_oCommand = new TINK.Model.Connector.Connector(
|
||||
new System.Uri("http://1.2.3.4"),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
"123", // Logged in
|
||||
"a@b",
|
||||
server: l_oCopri).Command;
|
||||
|
@ -56,8 +58,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICachedCopriServer>();
|
||||
|
||||
var l_oQuery = new TINK.Model.Connector.Connector(
|
||||
new System.Uri("http://1.2.3.4"),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
new Uri("http://1.2.3.4"),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
"",
|
||||
"",
|
||||
server: l_oCopri).Query;
|
||||
|
@ -75,7 +78,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
var l_oQuery = new TINK.Model.Connector.Connector(
|
||||
new System.Uri("http://1.2.3.4"),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
null /*UI language */,
|
||||
"123",
|
||||
"a@b",
|
||||
server: l_oCopri).Query;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
|
||||
|
@ -20,7 +20,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
// Construct not logged in version of connector.
|
||||
var l_oCommand = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"", // Not logged in
|
||||
null /*UI language */,
|
||||
"", // Not logged in
|
||||
"",
|
||||
l_oCopri).Command;
|
||||
|
||||
|
@ -36,7 +37,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oCommand = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
null /*UI language */,
|
||||
"123", // Logged in
|
||||
"a@b",
|
||||
l_oCopri).Command;
|
||||
|
@ -54,6 +56,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
null /*UI language */,
|
||||
"",
|
||||
"",
|
||||
l_oCopri).Query;
|
||||
|
@ -71,6 +74,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
null /*UI language */,
|
||||
"123",
|
||||
"a@b",
|
||||
l_oCopri).Query;
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Request;
|
||||
|
||||
using TINK.Repository.Response;
|
||||
using static TINK.Repository.CopriCallsHttps;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
using System.Reflection;
|
||||
|
||||
namespace UITest.Fixtures.Connector
|
||||
{
|
||||
|
@ -53,7 +52,7 @@ namespace UITest.Fixtures.Connector
|
|||
[Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url)
|
||||
#endif
|
||||
{
|
||||
Func<string, string> command = (password) => new RequestBuilder(TinkApp.MerchantId).DoAuthorization(
|
||||
Func<string, string> command = (password) => new RequestBuilder(TinkApp.MerchantId, null /*UI language */).DoAuthorization(
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.Mail,
|
||||
password,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.DeviceId);
|
||||
|
@ -86,7 +85,7 @@ namespace UITest.Fixtures.Connector
|
|||
[Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url)
|
||||
#endif
|
||||
{
|
||||
Func<string, string> command = (password) => new RequestBuilder(TinkApp.MerchantId).DoAuthorization(
|
||||
Func<string, string> command = (password) => new RequestBuilder(TinkApp.MerchantId, null /*UI language */).DoAuthorization(
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerGibtsNet.Mail,
|
||||
password,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerGibtsNet.DeviceId);
|
||||
|
@ -149,6 +148,7 @@ namespace UITest.Fixtures.Connector
|
|||
url,
|
||||
new RequestBuilderLoggedIn(
|
||||
TinkApp.MerchantId,
|
||||
null /*UI language */,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).DoAuthout(),
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestLogout)}"
|
||||
).Result.GetIsResponseOk());
|
||||
|
@ -205,7 +205,7 @@ namespace UITest.Fixtures.Connector
|
|||
Assert.Throws<AuthcookieNotDefinedException>(
|
||||
() => DoAuthoutAsync(
|
||||
url,
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, l_oLoginResponse.authcookie).DoAuthout(),
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, null /*UI language */, l_oLoginResponse.authcookie).DoAuthout(),
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestLogout_NotLoggedIn)}").Result.GetIsResponseOk());
|
||||
}
|
||||
finally
|
||||
|
@ -261,6 +261,7 @@ namespace UITest.Fixtures.Connector
|
|||
url,
|
||||
new RequestBuilderLoggedIn(
|
||||
TinkApp.MerchantId,
|
||||
null /*UI language */,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerKeksGibtsNet.AuthCookie).DoAuthout(),
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestLogout_AuthcookieUnknown)}"
|
||||
).Result.response_state);
|
||||
|
@ -300,17 +301,18 @@ namespace UITest.Fixtures.Connector
|
|||
Assert.NotNull(bikesReference);
|
||||
var bikeReference = bikesReference.FirstOrDefault().Value;
|
||||
Assert.That(
|
||||
bikeReference,
|
||||
bikeReference,
|
||||
Is.Not.Null,
|
||||
$"Prerequisites are not matched: No bikes available from server {url} returned but at least one bike for verification required.");
|
||||
|
||||
// Verify list of bikes returned from first device
|
||||
var request = new RequestBuilderLoggedIn(
|
||||
TinkApp.MerchantId,
|
||||
null /*UI language */,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).GetBikesAvailable();
|
||||
|
||||
|
||||
var bikes = GetBikesAvailableAsync(
|
||||
url,
|
||||
url,
|
||||
request).Result.bikes;
|
||||
|
||||
Assert.That(
|
||||
|
@ -320,23 +322,23 @@ namespace UITest.Fixtures.Connector
|
|||
|
||||
var bike = bikes.FirstOrDefault().Value;
|
||||
Assert.That(
|
||||
bike,
|
||||
bike,
|
||||
Is.Not.Null,
|
||||
"Response on GetBikesAvailableCall must contain at leas one bike.");
|
||||
|
||||
// Check if entries are valid.
|
||||
Assert.Greater(
|
||||
bike.description.Length,
|
||||
0,
|
||||
bike.description.Length,
|
||||
0,
|
||||
"Bike despcription must never be empty.");
|
||||
|
||||
Assert.That(
|
||||
bike.bike,
|
||||
Is.Not.Null,
|
||||
bike.bike,
|
||||
Is.Not.Null,
|
||||
"Bike index must never be null");
|
||||
|
||||
Assert.AreEqual(
|
||||
"available",
|
||||
"available",
|
||||
bike.state,
|
||||
"Bike state must be available");
|
||||
}
|
||||
|
@ -367,7 +369,7 @@ namespace UITest.Fixtures.Connector
|
|||
$"Prerequisites are not matched: No bikes available from server {url} returned but at least one bike for verification required.");
|
||||
|
||||
// Verify list of bikes returned from first device
|
||||
var request = new RequestBuilder(TinkApp.MerchantId).GetBikesAvailable();
|
||||
var request = new RequestBuilder(TinkApp.MerchantId, null /*UI language */).GetBikesAvailable();
|
||||
|
||||
var bikes = GetBikesAvailableAsync(
|
||||
url,
|
||||
|
@ -387,8 +389,8 @@ namespace UITest.Fixtures.Connector
|
|||
|
||||
// Check if entries are valid.
|
||||
Assert.Greater(
|
||||
bike.description.Length,
|
||||
0,
|
||||
bike.description.Length,
|
||||
0,
|
||||
"Bike despcription must never be empty.");
|
||||
|
||||
Assert.That(
|
||||
|
@ -397,7 +399,7 @@ namespace UITest.Fixtures.Connector
|
|||
"Bike index must never be null");
|
||||
|
||||
Assert.AreEqual(
|
||||
"available",
|
||||
"available",
|
||||
bike.state,
|
||||
"Bike state must be available");
|
||||
}
|
||||
|
@ -440,7 +442,7 @@ namespace UITest.Fixtures.Connector
|
|||
var l_oBookingResponse = DoReserveAsync(
|
||||
CopriServerUriList.DevelopUri.AbsoluteUri,
|
||||
new RequestBuilderLoggedIn(
|
||||
TinkApp.MerchantId, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).DoReserve(l_oBikeId)).Result;
|
||||
TinkApp.MerchantId, null /*UI language */, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).DoReserve(l_oBikeId)).Result;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -502,6 +504,7 @@ namespace UITest.Fixtures.Connector
|
|||
CopriServerUriList.DevelopUri.AbsoluteUri,
|
||||
new RequestBuilderLoggedIn(
|
||||
TinkApp.MerchantId,
|
||||
null /*UI language */,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).DoReserve(l_oBikeId)).Result;
|
||||
|
||||
try
|
||||
|
@ -552,9 +555,9 @@ namespace UITest.Fixtures.Connector
|
|||
var bike = bikesAvailable.ToArray()[0].Value;
|
||||
|
||||
l_oBookingResponse = CopriCallsHttpsReference.DoReserveCall(
|
||||
bike.uri_operator + "/APIjsonserver",
|
||||
TinkApp.MerchantId,
|
||||
bike.bike,
|
||||
bike.uri_operator + "/APIjsonserver",
|
||||
TinkApp.MerchantId,
|
||||
bike.bike,
|
||||
TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie);
|
||||
|
||||
Assert.That(l_oBookingResponse.GetIsResponseOk("Testing cotext"),
|
||||
|
@ -567,8 +570,8 @@ namespace UITest.Fixtures.Connector
|
|||
Assert.NotNull(l_oBike, "Response on GetBikesOccupiedCall of must contain at least one bike.");
|
||||
|
||||
l_oBookingResponse = GetBikesOccupiedAsync(
|
||||
url,
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).GetBikesOccupied(),
|
||||
url,
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, null /*UI language */, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).GetBikesOccupied(),
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestGetBikesOccupiedCall_SomeRequestedBooked)}").Result;
|
||||
|
||||
// Check first entry.
|
||||
|
@ -579,7 +582,7 @@ namespace UITest.Fixtures.Connector
|
|||
Assert.Greater(l_oBike.description.Length, 0, "Bike despcription must never be empty.");
|
||||
Assert.That(l_oBike.bike, Is.Not.Null, "Bike index must not be null.");
|
||||
Assert.That(
|
||||
l_oBike.station,
|
||||
l_oBike.station,
|
||||
Is.Not.Null,
|
||||
"Station index must never be null");
|
||||
Assert.Greater(l_oBike.state.Length, 0, "State info must never be null or empty.");
|
||||
|
@ -608,15 +611,15 @@ namespace UITest.Fixtures.Connector
|
|||
[Values(CopriServerUriList.SHAREE_DEVEL, CopriServerUriList.SHAREE_LIVE)] string url)
|
||||
#endif
|
||||
{
|
||||
var request = new RequestBuilderLoggedIn(TinkApp.MerchantId, TestTINKLib.LoginSessionCopriInfo.JavaministerKeksGibtsNet.AuthCookie).GetBikesOccupied();
|
||||
|
||||
var request = new RequestBuilderLoggedIn(TinkApp.MerchantId, null /*UI language */, TestTINKLib.LoginSessionCopriInfo.JavaministerKeksGibtsNet.AuthCookie).GetBikesOccupied();
|
||||
|
||||
var l_oBookingResponse = GetBikesOccupiedAsync(
|
||||
url,
|
||||
url,
|
||||
request,
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestGetBikesOccupiedCall_KeksGibtsNet)}").Result;
|
||||
|
||||
Assert.AreEqual(
|
||||
"Failure 1001: authcookie on primary not defined",
|
||||
"Failure 1001: authcookie on primary not defined",
|
||||
l_oBookingResponse.response_state); // Up to 2020-12-05 COPRI returned: "Failure 1003: authcookie not defined"
|
||||
}
|
||||
|
||||
|
@ -647,7 +650,7 @@ namespace UITest.Fixtures.Connector
|
|||
"Prerequisites are not matched: There are no stations.");
|
||||
|
||||
// Verify implementation
|
||||
var l_oStationsAll = GetStationsAsync(url, new RequestBuilder(TinkApp.MerchantId).GetStations()).Result;
|
||||
var l_oStationsAll = GetStationsAsync(url, new RequestBuilder(TinkApp.MerchantId, null /*UI language */).GetStations()).Result;
|
||||
Assert.NotNull(l_oStationsAll?.stations);
|
||||
Assert.Greater(l_oStationsAll.stations.Count, 0);
|
||||
}
|
||||
|
@ -674,13 +677,13 @@ namespace UITest.Fixtures.Connector
|
|||
#endif
|
||||
{
|
||||
var stationsAll = GetStationsAsync(
|
||||
url,
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).GetStations(),
|
||||
url,
|
||||
new RequestBuilderLoggedIn(TinkApp.MerchantId, null /*UI language */, TestTINKLib.LoginSessionCopriInfo.JavaministerHardwareNr1.AuthCookie).GetStations(),
|
||||
$"{Assembly.GetAssembly(GetType()).GetName().Name}-{GetType().Name}-{nameof(TestGetStationsAllCall_LoggedIn)}").Result;
|
||||
|
||||
|
||||
Assert.NotNull(stationsAll?.stations);
|
||||
Assert.That(
|
||||
stationsAll.stations.Count,
|
||||
stationsAll.stations.Count,
|
||||
Is.GreaterThan(0),
|
||||
$"There must be at least one station.");
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
namespace TestTINKLib.Fixtures.Connector.Request
|
||||
{
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class TestCopriCallsMemory
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ namespace TestTINKLib.Fixtures.Connector.Request
|
|||
{
|
||||
foreach (SampleSets l_oSampleSet in Enum.GetValues(typeof(SampleSets)))
|
||||
{
|
||||
var l_oCopri = new CopriCallsMemory(l_oSampleSet, 1, "4da3044c8657a04ba60e2eaa753bc51a");
|
||||
var l_oCopri = new CopriCallsMemory("MyMerchId", l_oSampleSet, 1, "4da3044c8657a04ba60e2eaa753bc51a");
|
||||
|
||||
for (var l_iStageIndex = 1; l_iStageIndex <= l_oCopri.StagesCount; l_iStageIndex++)
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace TestTINKLib.Fixtures.Connector.Request
|
|||
foreach (var l_oBike in l_oBikesAvailable.bikes.Values)
|
||||
{
|
||||
Assert.IsFalse(
|
||||
l_oChecker.Keys.Contains(l_oBike.bike),
|
||||
l_oChecker.Keys.Contains(l_oBike.bike),
|
||||
string.Format(
|
||||
"Bike form available bikes with id {0} already exist in dictionary. Sample set is {1}, stage index {2}.",
|
||||
l_oBike.bike,
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Request
|
|||
Assert.Greater(l_oBike.description.Length, 0, "Bike despcription must never be empty.");
|
||||
Assert.AreEqual(l_oBike.bike, "26");
|
||||
Assert.That(
|
||||
l_oBike.station,
|
||||
l_oBike.station,
|
||||
Is.EqualTo("4"),
|
||||
"Station index must never be negative");
|
||||
Assert.AreEqual("available", l_oBike.state);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model.Services.CopriApi.ServerUris;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
|
@ -39,7 +39,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
[Test]
|
||||
public void TestConstruct_AryStringString_InvalidList()
|
||||
{
|
||||
Assert.Throws<ArgumentException>( () => new CopriServerUriList(
|
||||
Assert.Throws<ArgumentException>(() => new CopriServerUriList(
|
||||
(new List<Uri>()).ToArray(),
|
||||
new Uri("http://2.3.4.5")));
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
public void TestDefaultActiveUri()
|
||||
{
|
||||
Assert.AreEqual(
|
||||
"https://shareeapp-primary.copri.eu/APIjsonserver",
|
||||
"https://shareeapp-primary.copri.eu/APIjsonserver",
|
||||
CopriServerUriList.DefaultActiveUri.AbsoluteUri,
|
||||
"In production environment, server address must always be app.tink-konstanz.de/APIjsonserver.");
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TINK.Model.Connector;
|
||||
using System.Linq;
|
||||
using TINK.Repository;
|
||||
using TestFramework.Repository;
|
||||
using System;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using TestFramework.Repository;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
|
@ -19,6 +19,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
{
|
||||
var connector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
null /*UI language */,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
@ -54,6 +55,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
null /*UI language */,
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue