Version 3.0.270

This commit is contained in:
Oliver Hauff 2022-01-04 18:59:16 +01:00
parent 67999ef4ae
commit e0c75d5b37
81 changed files with 812 additions and 474 deletions

View file

@ -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(),

View file

@ -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),

View file

@ -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(),

View file

@ -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,

View file

@ -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,

View file

@ -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

View file

@ -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>(),