mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-20 12:06:29 +02:00
Version 3.0.270
This commit is contained in:
parent
67999ef4ae
commit
e0c75d5b37
81 changed files with 812 additions and 474 deletions
|
@ -1,20 +0,0 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model.Bike.BC;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
|
||||
{
|
||||
/// <summary>
|
||||
/// Moved to TestShareeLib (.Net Core)
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class TestBikeInfo
|
||||
{
|
||||
[Test]
|
||||
public void TestCtorCopyNull()
|
||||
{
|
||||
Assert.Throws<System.ArgumentException>(
|
||||
() => new BikeInfo(null),
|
||||
"Verify that no unspecific reference not set to... exception is thrown");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,11 +22,12 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string currentStationId = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, currentStationId, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +37,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
{
|
||||
var l_oBikeInfo = new BikeInfoMutable("17");
|
||||
Assert.AreEqual("17", l_oBikeInfo.Id);
|
||||
Assert.IsNull(l_oBikeInfo.CurrentStation);
|
||||
Assert.IsNull(l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual(null, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(null, l_oBikeInfo.TypeOfBike);
|
||||
|
@ -44,7 +45,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfo = new BikeInfoMutable("22", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo, "Test description", "23");
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.IsFalse(l_oBikeInfo.IsDemo);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
|
@ -60,18 +61,19 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Booked);
|
||||
l_oStateInfoMock.Stub(x => x.From).Return(new System.DateTime(2018, 01, 03));
|
||||
l_oStateInfoMock.Stub(x => x.MailAddress).Return("a@b");
|
||||
l_oStateInfoMock.Stub(x => x.Code).Return("234");
|
||||
|
||||
var l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
var l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual("My Station Name", l_oBikeInfo.StationName);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oBikeInfo.State.Value);
|
||||
|
@ -85,18 +87,18 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Reserved);
|
||||
l_oStateInfoMock.Stub(x => x.From).Return(new System.DateTime(2018, 01, 03));
|
||||
l_oStateInfoMock.Stub(x => x.MailAddress).Return("a@b");
|
||||
l_oStateInfoMock.Stub(x => x.Code).Return("234");
|
||||
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oBikeInfo.State.Value);
|
||||
|
@ -110,15 +112,15 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
l_oBikeInfoMock.Stub(x => x.Id).Return("22");
|
||||
l_oBikeInfoMock.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
||||
l_oBikeInfoMock.Stub(x => x.WheelType).Return(WheelType.Trike);
|
||||
l_oBikeInfoMock.Stub(x => x.CurrentStation).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.StationId).Return("23");
|
||||
l_oBikeInfoMock.Stub(x => x.State).Return(l_oStateInfoMock);
|
||||
l_oStateInfoMock.Stub(x => x.Value).Return(InUseStateEnum.Disposable);
|
||||
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock);
|
||||
l_oBikeInfo = new TINK.Model.Bike.BC.BikeInfoMutable(l_oBikeInfoMock, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.AreEqual("23", l_oBikeInfo.CurrentStation);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, l_oBikeInfo.State.Value);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using Rhino.Mocks;
|
||||
using System;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
|
||||
|
@ -18,6 +19,7 @@ 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
|
||||
"",
|
||||
l_oCopri).Command;
|
||||
|
@ -34,6 +36,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oCommand = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"123", // Logged in
|
||||
"a@b",
|
||||
l_oCopri).Command;
|
||||
|
@ -50,6 +53,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"",
|
||||
"",
|
||||
l_oCopri).Query;
|
||||
|
@ -66,6 +70,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
var l_oCopri = MockRepository.GenerateStub<ICopriServer>();
|
||||
|
||||
var l_oQuery = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
"123",
|
||||
"a@b",
|
||||
l_oCopri).Query;
|
||||
|
|
|
@ -5,6 +5,7 @@ using TINK.Model.Connector;
|
|||
using System.Linq;
|
||||
using TINK.Repository;
|
||||
using TestFramework.Repository;
|
||||
using System;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
|
@ -17,6 +18,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
public void TestGetStationsAll()
|
||||
{
|
||||
var connector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
@ -51,6 +53,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
|||
public void TestGetBikesAll()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory001());
|
||||
|
|
|
@ -614,5 +614,56 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
() => version.GetCopriVersion(),
|
||||
Throws.InstanceOf<InvalidResponseException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""1""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_No()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""0""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Invalid()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""ä""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Empty()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
var account = new TINK.Model.User.Account.Account(
|
||||
"hans.musterman@hotmail.com", // Mail
|
||||
"myPasswd", // Pwd
|
||||
false,
|
||||
"aktuellerKeks", // Cookie
|
||||
new List<string> { "Honkey", "Tonkey" }, // Group
|
||||
TINK.Model.User.Account.Permissions.None);
|
||||
|
@ -21,6 +22,7 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
// Assert
|
||||
Assert.AreEqual("hans.musterman@hotmail.com", account.Mail);
|
||||
Assert.AreEqual("myPasswd", account.Pwd);
|
||||
Assert.That(account.IsAgbAcknowledged, Is.False);
|
||||
Assert.AreEqual("aktuellerKeks", account.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
|
||||
|
@ -29,19 +31,26 @@ namespace UITest.Fixtures.ObjectTests.User.Account
|
|||
[Test]
|
||||
public void TestConstruct_Copy()
|
||||
{
|
||||
var l_oAccount = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account("a@b", "112", "3330", new List<string> { "Honkey", "Tonkey" },TINK.Model.User.Account.Permissions.None));
|
||||
var account = new TINK.Model.User.Account.Account(new TINK.Model.User.Account.Account(
|
||||
"a@b",
|
||||
"112",
|
||||
true, // Agbs have been acknowledged
|
||||
"3330",
|
||||
new List<string> { "Honkey", "Tonkey" },
|
||||
TINK.Model.User.Account.Permissions.None));
|
||||
|
||||
Assert.AreEqual("a@b", l_oAccount.Mail);
|
||||
Assert.AreEqual("112", l_oAccount.Pwd);
|
||||
Assert.AreEqual("3330", l_oAccount.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", l_oAccount.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, l_oAccount.DebugLevel);
|
||||
Assert.AreEqual("a@b", account.Mail);
|
||||
Assert.AreEqual("112", account.Pwd);
|
||||
Assert.That(account.IsAgbAcknowledged, Is.False);
|
||||
Assert.AreEqual("3330", account.SessionCookie);
|
||||
Assert.AreEqual("Honkey,Tonkey", String.Join(",", account.Group));
|
||||
Assert.AreEqual(TINK.Model.User.Account.Permissions.None, account.DebugLevel);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_InvalidGroup()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", "3330", null, TINK.Model.User.Account.Permissions.None));
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account("a@b", "112", false, "3330", null, TINK.Model.User.Account.Permissions.None));
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.User.Account.Account(null));
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ using TINK.Repository;
|
|||
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
using TestFramework.Model.User.Account;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestTINKLib
|
||||
{
|
||||
|
@ -18,11 +20,11 @@ namespace TestTINKLib
|
|||
[Test]
|
||||
public void TestConstruct_NotLoggedIn_NoUsername()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(); // Account without user name, password and cookie
|
||||
var storeMock = new StoreMock(); // Account without user name, password and cookie
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
storeMock,
|
||||
storeMock.Load().Result,
|
||||
"HwId1000000000000");
|
||||
|
||||
Assert.IsFalse(l_oUser.IsLoggedIn);
|
||||
|
@ -34,23 +36,23 @@ namespace TestTINKLib
|
|||
[Test]
|
||||
public void TestConstruct_NotLoggedIn_NoCookie()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", null, new List<string>())); // Account without session cookie.
|
||||
var storeMock = new StoreMock(new Account("John", "123", true, null, new List<string>())); // Account without session cookie.
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
var user = new User(
|
||||
storeMock,
|
||||
storeMock.Load().Result,
|
||||
"123456789");
|
||||
|
||||
Assert.IsFalse(l_oUser.IsLoggedIn);
|
||||
Assert.AreEqual("John", l_oUser.Mail);
|
||||
Assert.AreEqual("123", l_oUser.Password);
|
||||
Assert.IsNull(l_oUser.SessionCookie);
|
||||
Assert.IsFalse(user.IsLoggedIn);
|
||||
Assert.AreEqual("John", user.Mail);
|
||||
Assert.AreEqual("123", user.Password);
|
||||
Assert.IsNull(user.SessionCookie);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_LoggedIn()
|
||||
{
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", "9512", new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("John", "123", false, "9512", new List<string> { "TINK" }));
|
||||
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
|
@ -66,9 +68,10 @@ namespace TestTINKLib
|
|||
|
||||
/// <summary>Test logging in. </summary>
|
||||
[Test]
|
||||
public void TestSetCredentials()
|
||||
public async Task TestSetCredentials()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
@ -88,7 +91,7 @@ namespace TestTINKLib
|
|||
LoginSessionCopriInfo.JavaministerHardwareNr1.Pwd,
|
||||
l_oUser.DeviceId).Result;
|
||||
|
||||
l_oUser.Login(l_oAccount);
|
||||
await l_oUser.Login(l_oAccount);
|
||||
Assert.IsTrue(l_oUser.IsLoggedIn);
|
||||
|
||||
Assert.AreEqual(LoginSessionCopriInfo.JavaministerHardwareNr1.Mail, l_oUser.Mail);
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -81,8 +82,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "UnknownCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "UnknownCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -121,8 +123,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -160,8 +163,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -199,7 +203,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "6103_112e96b36ba33de245943c5ffaf369cd_", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -212,6 +216,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Account
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -24,7 +24,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
public void TestCreate()
|
||||
{
|
||||
// Verify handler for disposable bike.
|
||||
var bike = new BikeInfoMutable(new BikeInfo("22", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12"));
|
||||
var bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12"),
|
||||
"My Station Name");
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, bike.State.Value);
|
||||
Assert.AreEqual(LockingState.Disconnected, bike.LockInfo.State);
|
||||
Assert.AreEqual(
|
||||
|
@ -42,7 +44,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state unknown.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id */, new Guid(), /*K User*/ null, /*K Admin*/ null, /*K Seed*/ null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id */, new Guid(), /*K User*/ null, /*K Admin*/ null, /*K Seed*/ null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedDisconnected),
|
||||
RequestHandlerFactory.Create(
|
||||
|
@ -58,7 +62,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state closed.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Closed;
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedClosed),
|
||||
|
@ -75,7 +81,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for requested bike with state open.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new DateTime(2020, 1, 1), "a@b.com", "12", null, null, () => new DateTime(2020, 1, 1), false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Open;
|
||||
Assert.AreEqual(
|
||||
typeof(ReservedOpen),
|
||||
|
@ -92,7 +100,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state closed.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Closed;
|
||||
Assert.AreEqual(
|
||||
typeof(BookedClosed),
|
||||
|
@ -109,7 +119,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state open.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
bike.LockInfo.State = LockingState.Open;
|
||||
Assert.AreEqual(
|
||||
typeof(BookedOpen),
|
||||
|
@ -126,7 +138,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
MockRepository.GenerateStub<IUser>()).GetType());
|
||||
|
||||
// Verify handler for booked bike with state unknown.
|
||||
bike = new BikeInfoMutable(new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround));
|
||||
bike = new BikeInfoMutable(
|
||||
new BikeInfo("22", 0 /* lock Id*/, new Guid(), null, null, null, new System.DateTime(2020, 1, 1), "a@b.com", "12", null /*operator uri*/, null, false, new List<string>(), TINK.Model.Bike.WheelType.Mono, TINK.Model.Bike.TypeOfBike.Allround),
|
||||
"My Station Name");
|
||||
|
||||
Assert.AreEqual(
|
||||
typeof(BookedDisconnected),
|
||||
|
|
|
@ -43,7 +43,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -120,7 +121,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -194,7 +196,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -263,7 +266,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -332,7 +336,8 @@ namespace TestShareeLib.UseCases.Startup
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory001( sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -416,6 +421,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -500,6 +506,7 @@ namespace TestShareeLib.UseCases.Startup
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory001(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -24,16 +24,17 @@ namespace UITest.Fixtures.ViewModel
|
|||
private class BikeInfoMutable : TINK.Model.Bike.BC.BikeInfoMutable
|
||||
{
|
||||
public BikeInfoMutable(
|
||||
string p_iId,
|
||||
bool p_bIsDemo = false,
|
||||
IEnumerable<string> p_oGroup = null,
|
||||
WheelType? p_eWheelType = null,
|
||||
TypeOfBike? p_eTypeOfBike = null,
|
||||
string id,
|
||||
bool isDemo = false,
|
||||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string p_strCurrentStationName = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
Func<DateTime> p_oDateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(p_iId, p_bIsDemo, p_oGroup, p_eWheelType, p_eTypeOfBike, description, p_strCurrentStationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +159,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de",
|
||||
"4asdfA");
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
|
||||
var l_oViewModel = new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
||||
null,
|
||||
|
@ -196,7 +197,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de",
|
||||
"4asdfA");
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("john@long", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
|
||||
var l_oViewModel = new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
||||
null,
|
||||
|
|
|
@ -17,16 +17,17 @@ namespace UITest.Fixtures.ViewModel
|
|||
private class BikeInfoMutable : TINK.Model.Bike.BC.BikeInfoMutable
|
||||
{
|
||||
public BikeInfoMutable(
|
||||
string p_iId,
|
||||
bool p_bIsDemo = false,
|
||||
IEnumerable<string> p_oGroup = null,
|
||||
WheelType? p_eWheelType = null,
|
||||
TypeOfBike? p_eTypeOfBike = null,
|
||||
string id,
|
||||
bool pisDemo = false,
|
||||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
string description = null,
|
||||
string p_strCurrentStationName = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
Func<DateTime> p_oDateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(p_iId, p_bIsDemo, p_oGroup, p_eWheelType, p_eTypeOfBike, description, p_strCurrentStationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, pisDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +44,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
TypeOfBike.Cargo,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
null,
|
||||
() => new DateTime(1980, 1, 1)); // Now time stamp
|
||||
|
||||
|
@ -52,7 +54,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
new DateTime(1980, 1, 1), // Date when bike was booked.
|
||||
"ragu@gnu-systems.de"); // Owner from Copri.
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
|
@ -82,6 +84,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
TypeOfBike.Cargo,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
null,
|
||||
() => (new DateTime(1980, 1, 1)).Add(new TimeSpan(0, 8, 0)));
|
||||
|
||||
|
@ -92,7 +95,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
"ragu@gnu-systems.de", // Owner from Copri.
|
||||
"4asdfA"); // Reservation code from Copri
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock, // Mocks account store functionality.
|
||||
l_oStoreMock.Load().Result,
|
||||
|
@ -124,7 +127,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
|
||||
var l_oCopriServer = new CopriCallsMemory(SampleSets.Set1, 1);
|
||||
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oStoreMock = new StoreMock(new Account("ragu@gnu-systems.de", "123456789" /* password */, false, "987654321" /* session cookie */, new List<string> { "TINK" }));
|
||||
var l_oUser = new User(
|
||||
l_oStoreMock,
|
||||
l_oStoreMock.Load().Result,
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
null, // viewUpdateManager
|
||||
NSubstitute.Substitute.For<ISmartDevice>(),
|
||||
null, // viewService
|
||||
new TINK.Model.Bike.BC.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
|
||||
new TINK.Model.Bike.BC.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
||||
MockRepository.GenerateStub<IUser>(), // user
|
||||
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
||||
MockRepository.GenerateStub<IBikesViewModel>()).GetType()); // stateInfoProvider
|
||||
|
@ -44,7 +44,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
null, // viewUpdateManager
|
||||
NSubstitute.Substitute.For<ISmartDevice>(),
|
||||
null, // viewService
|
||||
new TINK.Model.Bike.BluetoothLock.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42")),
|
||||
new TINK.Model.Bike.BluetoothLock.BikeInfoMutable(new TINK.Model.Bike.BluetoothLock.BikeInfo("42", 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "42"), "My Station Name"),
|
||||
MockRepository.GenerateStub<IUser>(), // user
|
||||
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
|
||||
MockRepository.GenerateStub<IBikesViewModel>()).GetType()); // stateInfoProvider
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -70,8 +70,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" } )),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" } )),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -93,6 +94,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -117,8 +119,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Close lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Open lock & continue renting", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -161,8 +163,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -184,6 +187,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -213,8 +217,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -260,8 +264,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -283,6 +288,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -311,8 +317,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -354,8 +360,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -377,6 +384,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -403,8 +411,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -446,8 +454,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "5781_d47fc786e740ef77d85a24bcb6f0ff97_oiF2kahH", new List<string> { "300001", "300029" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.ShareeFr01_Set1, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
geolocation,
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -469,6 +478,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
geolocation.Active, // geolocation
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -499,8 +509,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
||||
var bike1545 = myBikes.FirstOrDefault(x => x.Id == "1545") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
var bike1537 = myBikes.FirstOrDefault(x => x.Id == "1537") as TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
|
||||
Assert.AreEqual("Rented since 06. November 17:53.", bike1545.StateText);
|
||||
Assert.AreEqual("Rented since 12. October 08:38.", bike1537.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-11-06 17:53:22.784681+01"):dd. MMMM HH:mm}.", bike1545.StateText);
|
||||
Assert.AreEqual($"Rented since {DateTime.Parse("2020-10-12 08:38:12.374231+02"):dd. MMMM HH:mm}.", bike1537.StateText);
|
||||
Assert.AreEqual("Search lock", bike1545.LockitButtonText);
|
||||
Assert.AreEqual("Search lock", bike1537.LockitButtonText);
|
||||
|
||||
|
@ -532,8 +542,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "Invalid_SessionCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "Invalid_SessionCookie", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -555,6 +566,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -593,8 +605,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1, sessionCookie)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -616,6 +629,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -657,7 +671,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -670,6 +684,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, new Exception("Source expection."))))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -691,6 +706,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
@ -735,7 +751,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
Serilog.Events.LogEventLevel.Error,
|
||||
activeLockService: locksService.GetType().FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
new StoreMock(new TINK.Model.User.Account.Account("a@b", "123456789", false, "4da3044c8657a04ba60e2eaa753bc51a", new List<string> { "TINK" })),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new TINK.Model.Connector.Connector(
|
||||
uri,
|
||||
new AppContextInfo("oiF2kahH", "sharee.bike.test", new Version(3, 0, 267)),
|
||||
|
@ -748,6 +764,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
sessionCookie: sessionCookie,
|
||||
cacheServer: new CopriCallsCacheMemory(sessionCookie: sessionCookie),
|
||||
httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
new DeviceMock(),
|
||||
|
@ -769,6 +786,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
(isConnected) => tinkApp.GetConnector(isConnected),
|
||||
new GeolocationMock(),
|
||||
locksService,
|
||||
tinkApp.Stations,
|
||||
tinkApp.Polling,
|
||||
(d, obj) => d(obj),
|
||||
Substitute.For<ISmartDevice>(),
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace TestTINKLib.Fixtures.UseCases.ConnectedOffline
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
"MyMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
public void TestBikesAtStation_AccountStoreMock_NoUser_CopriMock_Set2()
|
||||
{
|
||||
var l_oConnector = new ConnectorCache(
|
||||
new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)),
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
new CopriCallsMemory(SampleSets.Set2, 1));
|
||||
|
@ -39,7 +40,8 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
activeLockService: typeof(LocksServiceMock).FullName,
|
||||
activeGeolocationService: typeof(GeolocationMock).FullName),
|
||||
new StoreMock(),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => new ConnectorCache(new AppContextInfo("MyMerchId", "MyApp", new Version(1, 2)), sessionCookie, mail, new CopriCallsMemory(SampleSets.Set2, 1)),
|
||||
"myMerchId",
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
new LocksServiceMock(),
|
||||
new DeviceMock(),
|
||||
|
@ -50,25 +52,25 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
currentVersion: new Version(3, 2, 0, 115),
|
||||
lastVersion: new Version(3, 0, 173)); // Current app version. Must be larger or equal 3.0.173 to
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("5", new List<string>(), null);
|
||||
Assert.AreEqual(3, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("2").Id);
|
||||
Assert.AreEqual(3, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("2").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("10", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(
|
||||
1,
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
|
||||
Assert.AreEqual("18", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.GetById("18").Id);
|
||||
Assert.AreEqual("18", TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("18").Id);
|
||||
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Station.Station("91345", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual(0, TestHelper.GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Bike;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.User;
|
||||
|
||||
namespace TestTINKLib.Fixtures.UseCases
|
||||
|
@ -14,13 +16,14 @@ namespace TestTINKLib.Fixtures.UseCases
|
|||
public static async Task<BikeCollectionMutable> GetBikesAtStation(
|
||||
User user,
|
||||
TINK.Model.Connector.IConnector connector,
|
||||
string selectedStation)
|
||||
IEnumerable<IStation> stations,
|
||||
string selectedStationId)
|
||||
{
|
||||
var l_oBikesAtStation = new BikeCollectionMutable();
|
||||
|
||||
var l_oBikesAvailable = (await connector.Query.GetBikesAsync()).Response;
|
||||
|
||||
l_oBikesAtStation.Update(l_oBikesAvailable.GetAtStation(selectedStation));
|
||||
l_oBikesAtStation.Update(l_oBikesAvailable.GetAtStation(selectedStationId), stations);
|
||||
|
||||
return l_oBikesAtStation;
|
||||
}
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
namespace TestTINKLib
|
||||
{
|
||||
/// <summary>
|
||||
/// Object do define login session info from copri.
|
||||
/// </summary>
|
||||
public struct LoginSessionCopriInfo
|
||||
{
|
||||
public LoginSessionCopriInfo(
|
||||
string p_strMail,
|
||||
string p_strPwd,
|
||||
string p_strAuthCookie,
|
||||
string p_strDeviceId)
|
||||
{
|
||||
Mail = p_strMail;
|
||||
Pwd = p_strPwd;
|
||||
AuthCookie = p_strAuthCookie;
|
||||
DeviceId = p_strDeviceId;
|
||||
}
|
||||
|
||||
public string Mail { get; private set; }
|
||||
public string Pwd { get; private set; }
|
||||
public string AuthCookie { get; private set; }
|
||||
public string DeviceId { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// First test user which typically has some bikes.
|
||||
/// </summary>
|
||||
public static LoginSessionCopriInfo JavaministerHardwareNr1 = new LoginSessionCopriInfo(
|
||||
"javaminister@gmail.com",
|
||||
"javaminister",
|
||||
"6103_4da3044c8657a04ba60e2eaa753bc51a_",
|
||||
"HwId1000000000000"
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// First test user which typically has some bikes.
|
||||
/// </summary>
|
||||
public static LoginSessionCopriInfo SkiministerHardwareNr1 = new LoginSessionCopriInfo(
|
||||
"skiminister@posteo.de",
|
||||
"skiminister",
|
||||
"",
|
||||
"HwId1000000000000"
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// User which does not exist in copri.
|
||||
/// </summary>
|
||||
public static LoginSessionCopriInfo JavaministerGibtsNet = new LoginSessionCopriInfo(
|
||||
"javaminister@gmail.com.GibtsNet",
|
||||
"javaminister",
|
||||
"",
|
||||
"HwId1000000000000"
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// User which does not exist in copri.
|
||||
/// </summary>
|
||||
public static LoginSessionCopriInfo JavaministerKeksGibtsNet = new LoginSessionCopriInfo(
|
||||
"javaminister@gmail.com",
|
||||
"javaminister",
|
||||
"6103_ThisKeksDoesNotExist_",
|
||||
"HwId1000000000000"
|
||||
);
|
||||
}
|
||||
}
|
|
@ -47,7 +47,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\Services\TestServicesContainerMutable.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\Settings\BluetoothLock\TestLockIt.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\Account\TestAccountPageViewModel.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BC\TestBikeInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestBikeInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestLockInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\BluetoothLock\TestLockInfoHelper.cs" />
|
||||
|
@ -107,7 +106,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\ViewModel\Settings\TestFilterCollectionMutable.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeAtStationInUseStateInfoProvider.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeAtStationViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikesAtStationPageViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeViewModel.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestBikeViewModelFactory.cs" />
|
||||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestMyBikeInUseStateInfoProvider.cs" />
|
||||
|
@ -116,7 +114,6 @@
|
|||
<Compile Include="Fixtures\ObjectTests\ViewModel\TestViewModelHelper.cs" />
|
||||
<Compile Include="Fixtures\UseCases\ConnectedOffline\TestTinkApp.cs" />
|
||||
<Compile Include="Fixtures\UseCases\TestHelper.cs" />
|
||||
<Compile Include="LoginSessionCopriInfo.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestBikeSerializeJSON.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestBikeCollectionSerializeJSON.cs" />
|
||||
<None Include="Fixtures\ObjectTests\Bike\TestStateBookedInfoSerializeJSON.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue