Version 3.0.294

This commit is contained in:
Oliver Hauff 2022-04-25 22:15:15 +02:00
parent d92fb4a40f
commit 8f40f2c208
133 changed files with 17890 additions and 14246 deletions

View file

@ -10,7 +10,6 @@ using TINK.Model.State;
using Rhino.Mocks;
using System.Collections.Generic;
using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable;
using TINK.ViewModel.Bikes;
using TINK.Model.Device;
using TestFramework.Model.User.Account;
@ -25,6 +24,7 @@ namespace UITest.Fixtures.ViewModel
{
public BikeInfoMutable(
string id,
LockModel lockModel,
bool isDemo = false,
IEnumerable<string> group = null,
WheelType? wheelType = null,
@ -33,8 +33,8 @@ namespace UITest.Fixtures.ViewModel
string stationId = null,
string stationName = null,
Uri operatorUri = null,
Func<DateTime> p_oDateTimeProvider = null,
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(id, lockModel, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, dateTimeProvider, stateInfo)
{
}
}
@ -44,7 +44,7 @@ namespace UITest.Fixtures.ViewModel
[Test]
public void TestStateText_NotLoggedIn()
{
var l_oBike = new BikeInfoMutable("2", false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo);
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo);
var l_oStoreMock = new StoreMock(); // Account without user name, password and cookie
@ -155,7 +155,7 @@ namespace UITest.Fixtures.ViewModel
[Test]
public void TestStateText_LoggedIn_ReservedBySomeoneElse()
{
var l_oBike = new BikeInfoMutable("2", false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
l_oBike.State.Load(
InUseStateEnum.Reserved,
@ -194,7 +194,7 @@ namespace UITest.Fixtures.ViewModel
[Test]
public void TestStateText_LoggedIn_BookedBySomeoneElse()
{
var l_oBike = new BikeInfoMutable("2", false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
l_oBike.State.Load(
InUseStateEnum.Booked,

View file

@ -18,6 +18,7 @@ namespace UITest.Fixtures.ViewModel
{
public BikeInfoMutable(
string id,
LockModel lockModel,
bool pisDemo = false,
IEnumerable<string> group = null,
WheelType? wheelType = null,
@ -26,8 +27,8 @@ namespace UITest.Fixtures.ViewModel
string stationId = null,
string stationName = null,
Uri operatorUri = null,
Func<DateTime> p_oDateTimeProvider = null,
IStateInfo stateInfo = null) : base(id, pisDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, p_oDateTimeProvider, stateInfo)
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(id, lockModel, pisDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, null, dateTimeProvider, stateInfo)
{
}
}
@ -38,10 +39,11 @@ namespace UITest.Fixtures.ViewModel
{
var l_oBike = new BikeInfoMutable(
"2",
LockModel.ILockIt,
false,
new List<string> { "TINK" },
WheelType.Trike,
TypeOfBike.Cargo,
TypeOfBike.Cargo,
"Test description",
"3",
"Radstation",
@ -77,7 +79,8 @@ namespace UITest.Fixtures.ViewModel
public static BikeViewModelBase TestStateText_LoggedIn_ReservedWithCopriConnect(Func<TINK.Model.Bike.BC.BikeInfoMutable, User, BikeViewModelBase> p_oFactory)
{
var l_oBike = new BikeInfoMutable(
"2",
"2",
LockModel.ILockIt,
false,
new List<string> { "TINK" },
WheelType.Trike,
@ -116,7 +119,7 @@ namespace UITest.Fixtures.ViewModel
/// </summary>
public static BikeViewModelBase TestStateText_LoggedIn_Booked(Func<TINK.Model.Bike.BC.BikeInfoMutable, User, BikeViewModelBase> p_oFactory)
{
var l_oBike = new BikeInfoMutable("2", false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, "Test description", "3");
// Update from Copri.
l_oBike.State.Load(

View file

@ -15,25 +15,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
public class TestBikeViewModelFactory
{
[Test]
public void TestCreate()
public void TestCreateBluetoothLock()
{
Assert.AreEqual(
typeof(TINK.ViewModel.Bikes.Bike.BC.BikeViewModel),
BikeViewModelFactory.Create(
() => false, // Is connected delegate,
(isconnected) => null, // connectorFactory
new GeolocationMock(), // geolocation
new LocksServiceMock(), // lock service
(index) => { }, // bikeRemoveDelegate
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"), "My Station Name"),
MockRepository.GenerateStub<IUser>(), // user
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
MockRepository.GenerateStub<IBikesViewModel>(),
url => { }).GetType()); // stateInfoProvider
Assert.AreEqual(
typeof(TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel),
BikeViewModelFactory.Create(
@ -51,5 +34,47 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
MockRepository.GenerateStub<IBikesViewModel>(),
url => { }).GetType()); // stateInfoProvider
}
[Test]
public void TestCreateCopri()
{
Assert.AreEqual(
typeof(TINK.ViewModel.Bikes.Bike.CopriLock.BikeViewModel),
BikeViewModelFactory.Create(
() => false, // Is connected delegate,
(isconnected) => null, // connectorFactory
new GeolocationMock(), // geolocation
new LocksServiceMock(), // lock service
(index) => { }, // bikeRemoveDelegate
null, // viewUpdateManager
NSubstitute.Substitute.For<ISmartDevice>(),
null, // viewService
new TINK.Model.Bike.CopriLock.BikeInfoMutable(new TINK.Model.Bike.CopriLock.BikeInfo("42", "17", new TINK.Model.Bikes.Bike.CopriLock.LockInfo.Builder { State = TINK.Model.Bikes.Bike.CopriLock.LockingState.Closed}.Build()), "My Station Name"),
MockRepository.GenerateStub<IUser>(), // user
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
MockRepository.GenerateStub<IBikesViewModel>(),
url => { }).GetType()); // stateInfoProvider
}
[Test]
public void TestCreateUnsupported()
{
Assert.That(
BikeViewModelFactory.Create(
() => false, // Is connected delegate,
(isconnected) => null, // connectorFactory
new GeolocationMock(), // geolocation
new LocksServiceMock(), // lock service
(index) => { }, // bikeRemoveDelegate
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"), "My Station Name"),
MockRepository.GenerateStub<IUser>(), // user
MockRepository.GenerateStub<IInUseStateInfoProvider>(),
MockRepository.GenerateStub<IBikesViewModel>(),
url => { }),
Is.Null);
}
}
}

View file

@ -656,8 +656,8 @@ namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
Assert.IsTrue(myBikes.IsIdle);
Assert.IsTrue(myBikes.IsBikesListVisible, "If there are any bikes, list must be visible.");
Assert.AreEqual("Code 2931, location Station 4, rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Code 3630, location Station 5, rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.AreEqual("Rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.IsFalse(myBikes.IsNoBikesOccupiedVisible);
Assert.AreEqual(string.Empty, myBikes.NoBikesOccupiedText);
@ -738,8 +738,8 @@ httpsServer: new ExceptionServer((msg) => new WebConnectFailureException(msg, ne
Assert.IsTrue(myBikes.IsIdle);
Assert.IsTrue(myBikes.IsBikesListVisible, "If there are any bikes, list must be visible.");
Assert.AreEqual("Code 2931, location Station 4, rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Code 3630, location Station 5, rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.AreEqual("Rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.IsFalse(myBikes.IsNoBikesOccupiedVisible);
Assert.AreEqual(string.Empty, myBikes.NoBikesOccupiedText);
@ -820,8 +820,8 @@ httpsServer: new ExceptionServer((msg) => new Exception(msg)))),
Assert.IsTrue(myBikes.IsIdle);
Assert.IsTrue(myBikes.IsBikesListVisible, "If there are any bikes, list must be visible.");
Assert.AreEqual("Code 2931, location Station 4, rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Code 3630, location Station 5, rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.AreEqual("Rented since 28. November 13:06.", myBikes.FirstOrDefault(x => x.Id == "7").StateText);
Assert.AreEqual("Rented since 28. November 11:01.", myBikes.FirstOrDefault(x => x.Id == "8").StateText);
Assert.IsFalse(myBikes.IsNoBikesOccupiedVisible);
Assert.AreEqual(string.Empty, myBikes.NoBikesOccupiedText);

View file

@ -3,6 +3,7 @@ using Rhino.Mocks;
using TINK.Model.Bike;
using TINK.Model.Bikes.Bike.BC;
using TINK.ViewModel;
namespace UITest.Fixtures.ObjectTests.ViewModel
{