mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-20 12:06:29 +02:00
Version 3.0.294
This commit is contained in:
parent
d92fb4a40f
commit
8f40f2c208
133 changed files with 17890 additions and 14246 deletions
|
@ -17,6 +17,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
{
|
||||
public BikeInfoMutable(
|
||||
string id,
|
||||
LockModel lockModel,
|
||||
bool isDemo = false,
|
||||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
|
@ -27,7 +28,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
Uri operatorUri = null,
|
||||
TariffDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(id, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
IStateInfo stateInfo = null) : base(id, lockModel, isDemo, group, wheelType, typeOfBike, description, stationId, stationName, operatorUri, tariffDescription, dateTimeProvider, stateInfo)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +36,14 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
[Test]
|
||||
public void TestConstruct()
|
||||
{
|
||||
var l_oBikeInfo = new BikeInfoMutable("17");
|
||||
var l_oBikeInfo = new BikeInfoMutable("17", LockModel.ILockIt);
|
||||
Assert.AreEqual("17", l_oBikeInfo.Id);
|
||||
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);
|
||||
|
||||
l_oBikeInfo = new BikeInfoMutable("22", false, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Cargo, "Test description", "23");
|
||||
l_oBikeInfo = new BikeInfoMutable("22", LockModel.ILockIt, 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.StationId);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestDeserialize_StateAvailable()
|
||||
{
|
||||
// Deserialize object and verify.
|
||||
var l_oContainer = GetBikesAvailable(TinkApp.MerchantId, p_eSampleSet: SampleSets.Set2, p_lStageIndex: 1);
|
||||
var l_oContainer = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1);
|
||||
Assert.AreEqual(12, l_oContainer.bikes.Count);
|
||||
|
||||
// Check first entry.
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", null, lock_state.locked, 15.03),
|
||||
builder.UpateLockingState("12", lock_state.locked, null, 15.03),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&voltage=15.03&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", null, lock_state.locked, double.NaN),
|
||||
builder.UpateLockingState("12", lock_state.locked, null, double.NaN),
|
||||
Is.EqualTo("request=booking_update&bike=12&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, 12),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 12),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&voltage=12&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, double.NaN),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), double.NaN),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_age=0.07&lock_state=locked&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Model.Repository.Request
|
|||
{
|
||||
var builder = new RequestBuilderLoggedIn("MyMeranctIt", "MySessionCookie");
|
||||
Assert.That(
|
||||
builder.UpateLockingState("12", new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), lock_state.locked, 98),
|
||||
builder.UpateLockingState("12", lock_state.locked, new LocationDto.Builder { Latitude = 21, Longitude = 17, Accuracy = 5.7, Age = new TimeSpan(0, 0, 0, 0, 70) }.Build(), 98),
|
||||
Is.EqualTo("request=booking_update&bike=12&gps=21,17&gps_accuracy=5.7&gps_age=0.07&lock_state=locked&voltage=98&authcookie=MySessionCookieMyMeranctIt"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue