mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-22 21:06:30 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -39,14 +39,6 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCtorCopyNull()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(
|
||||
() => new BikeInfo(null),
|
||||
"Verify that no unspecific reference not set to... exception is thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCtorBikeNull()
|
||||
{
|
||||
|
@ -62,13 +54,5 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BC
|
|||
() => new TestBikeInfoSubClass(new StateInfo(), new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(string.Empty, LockModel.ILockIt), null),
|
||||
Throws.ArgumentNullException);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCtorCopy()
|
||||
{
|
||||
Assert.That(
|
||||
() => new BikeInfo(null),
|
||||
Throws.ArgumentNullException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
|
@ -28,7 +29,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
RentalDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(
|
||||
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(id, lockModel, wheelType, typeOfBike, description),
|
||||
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(id, lockModel, wheelType, typeOfBike, aaRideType, description),
|
||||
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
isDemo,
|
||||
|
@ -53,7 +54,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
Assert.AreEqual(null, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(null, l_oBikeInfo.TypeOfBike);
|
||||
|
||||
l_oBikeInfo = new BikeInfoMutable("22", LockModel.ILockIt, 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, AaRideType.NoAaRide, "Test description", "23");
|
||||
Assert.AreEqual("22", l_oBikeInfo.Id);
|
||||
Assert.IsFalse(l_oBikeInfo.IsDemo);
|
||||
Assert.AreEqual("23", l_oBikeInfo.StationId);
|
||||
|
@ -61,93 +62,5 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
Assert.AreEqual(WheelType.Trike, l_oBikeInfo.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, l_oBikeInfo.TypeOfBike);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestConstructCopyBooked()
|
||||
{
|
||||
// State Booked
|
||||
var bikeInfoSource = Substitute.For<IBikeInfo>();
|
||||
var stateSource = Substitute.For<IStateInfo>();
|
||||
|
||||
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
|
||||
bikeInfoSource.StationId.Returns("23");
|
||||
bikeInfoSource.State.Returns(stateSource);
|
||||
stateSource.Value.Returns(InUseStateEnum.Booked);
|
||||
stateSource.From.Returns(new System.DateTime(2018, 01, 03));
|
||||
stateSource.MailAddress.Returns("a@b");
|
||||
stateSource.Code.Returns("234");
|
||||
|
||||
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Booked, bikeInfoTarget.State.Value);
|
||||
Assert.AreEqual("22", bikeInfoTarget.Id);
|
||||
Assert.AreEqual("23", bikeInfoTarget.StationId);
|
||||
Assert.AreEqual("My Station Name", bikeInfoTarget.StationName);
|
||||
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, bikeInfoTarget.State.Value);
|
||||
Assert.AreEqual(new System.DateTime(2018, 01, 03), bikeInfoTarget.State.From);
|
||||
Assert.AreEqual("a@b", bikeInfoTarget.State.MailAddress);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstructCopyReserved()
|
||||
{
|
||||
// State Reserved
|
||||
var bikeInfoSource = Substitute.For<IBikeInfo>();
|
||||
var stateSource = Substitute.For<IStateInfo>();
|
||||
|
||||
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
|
||||
bikeInfoSource.StationId.Returns("23");
|
||||
bikeInfoSource.State.Returns(stateSource);
|
||||
stateSource.Value.Returns(InUseStateEnum.Reserved);
|
||||
stateSource.From.Returns(new System.DateTime(2018, 01, 03));
|
||||
stateSource.MailAddress.Returns("a@b");
|
||||
stateSource.Code.Returns("234");
|
||||
|
||||
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, bikeInfoTarget.State.Value);
|
||||
Assert.AreEqual("22", bikeInfoTarget.Id);
|
||||
Assert.AreEqual("23", bikeInfoTarget.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, bikeInfoTarget.State.Value);
|
||||
Assert.AreEqual(new System.DateTime(2018, 01, 03), bikeInfoTarget.State.From);
|
||||
Assert.AreEqual("a@b", bikeInfoTarget.State.MailAddress);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstructCopyAvailable()
|
||||
{
|
||||
// State Disposable
|
||||
var bikeInfoSource = Substitute.For<IBikeInfo>();
|
||||
var stateSource = Substitute.For<IStateInfo>();
|
||||
|
||||
bikeInfoSource.Bike.Returns(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("22", LockModel.BordComputer, WheelType.Trike, TypeOfBike.Cargo));
|
||||
bikeInfoSource.StationId.Returns("23");
|
||||
bikeInfoSource.State.Returns(stateSource);
|
||||
stateSource.Value.Returns(InUseStateEnum.Disposable);
|
||||
|
||||
var bikeInfoTarget = new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(bikeInfoSource, "My Station Name");
|
||||
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, bikeInfoTarget.State.Value);
|
||||
Assert.AreEqual("22", bikeInfoTarget.Id);
|
||||
Assert.AreEqual("23", bikeInfoTarget.StationId);
|
||||
Assert.AreEqual(WheelType.Trike, bikeInfoTarget.WheelType);
|
||||
Assert.AreEqual(TypeOfBike.Cargo, bikeInfoTarget.TypeOfBike);
|
||||
Assert.AreEqual(InUseStateEnum.Disposable, bikeInfoTarget.State.Value);
|
||||
Assert.IsNull(bikeInfoTarget.State.From);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstructBikeNull()
|
||||
{
|
||||
Assert.That(
|
||||
() => new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable(null, "My Station Name"),
|
||||
Throws.ArgumentNullException);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace TestTINKLib
|
|||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
|
@ -26,7 +27,7 @@ namespace TestTINKLib
|
|||
RentalDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(
|
||||
new Bike(id, lockType, wheelType, typeOfBike, description),
|
||||
new Bike(id, lockType, wheelType, typeOfBike, aaRideType, description),
|
||||
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
isDemo,
|
||||
|
@ -66,6 +67,7 @@ namespace TestTINKLib
|
|||
new List<string> { "TINK" },
|
||||
WheelType.Mono,
|
||||
TypeOfBike.Allround,
|
||||
AaRideType.NoAaRide,
|
||||
"Test description",
|
||||
"1");
|
||||
|
||||
|
@ -86,7 +88,7 @@ namespace TestTINKLib
|
|||
"Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road.",
|
||||
l_oBike.ToString());
|
||||
|
||||
l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, true, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", "5", dateTimeProvider: () => new DateTime(1970, 1, 1));
|
||||
l_oBike = new BikeInfoMutable("3", LockModel.ILockIt, true, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround, AaRideType.NoAaRide, "Test description", "5", dateTimeProvider: () => new DateTime(1970, 1, 1));
|
||||
Assert.AreEqual(
|
||||
"Id=3, wheel(s)=Trike, type=Allround, demo=True, state=Disposable, location=Station 5.",
|
||||
l_oBike.ToString());
|
||||
|
|
|
@ -23,13 +23,14 @@ namespace UITest.Fixtures.ViewModel
|
|||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
Uri operatorUri = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(
|
||||
new Bike(id, lockModel, wheelType, typeOfBike, description),
|
||||
new Bike(id, lockModel, wheelType, typeOfBike, aaRideType, description),
|
||||
new TINK.Model.Bikes.BikeInfoNS.DriveNS.Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
pisDemo,
|
||||
|
@ -55,6 +56,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
new List<string> { "TINK" },
|
||||
WheelType.Trike,
|
||||
TypeOfBike.Cargo,
|
||||
AaRideType.NoAaRide,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
|
@ -96,6 +98,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
new List<string> { "TINK" },
|
||||
WheelType.Trike,
|
||||
TypeOfBike.Cargo,
|
||||
AaRideType.NoAaRide,
|
||||
"Test description",
|
||||
"3",
|
||||
"Radstation",
|
||||
|
@ -130,7 +133,7 @@ namespace UITest.Fixtures.ViewModel
|
|||
/// </summary>
|
||||
public static BikeViewModelBase TestStateText_LoggedIn_Booked(Func<TINK.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable, User, BikeViewModelBase> p_oFactory)
|
||||
{
|
||||
var l_oBike = new BikeInfoMutable("2", LockModel.ILockIt, 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, AaRideType.NoAaRide, "Test description", "3");
|
||||
|
||||
// Update from Copri.
|
||||
l_oBike.State.Load(
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using NSubstitute.ExceptionExtensions;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
||||
|
@ -12,17 +11,11 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike.BluetoothLock
|
|||
public class TestBikeInfo
|
||||
{
|
||||
[Test]
|
||||
public void TestCtorCopyNull()
|
||||
{
|
||||
public void TestCtorCopyNull() =>
|
||||
Assert.Throws<ArgumentException>(
|
||||
() => new BikeInfo(null, null),
|
||||
"Verify that no unspecific reference not set to... exception is thrown");
|
||||
|
||||
Assert.Throws<ArgumentException>(
|
||||
() => new BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("12", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, "1"), null),
|
||||
"Verify that no unspecific reference not set to... exception is thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCtorAvailable()
|
||||
{
|
||||
|
|
|
@ -7,31 +7,6 @@ namespace TestShareeLib.Model.Bike.CopriLock
|
|||
[TestFixture]
|
||||
public class TestBikeInfoMutable
|
||||
{
|
||||
[Test]
|
||||
public void TestCtorBikeInfoNull()
|
||||
{
|
||||
Assert.That(
|
||||
() => new BikeInfoMutable(null, "Station 32"),
|
||||
Throws.ArgumentNullException);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCtorBikeInfo()
|
||||
{
|
||||
var bike = new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(
|
||||
"MyId",
|
||||
TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.Sigo);
|
||||
|
||||
var bikeInfo = new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
|
||||
bike,
|
||||
new Drive(new TINK.Model.Bikes.BikeInfoNS.DriveNS.EngineNS.Engine("BackendLock")),
|
||||
DataSource.Copri,
|
||||
"StationId",
|
||||
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo());
|
||||
|
||||
Assert.That(
|
||||
new BikeInfoMutable(bikeInfo, "Station 32").Drive.Type,
|
||||
Is.EqualTo(DriveType.Pedelec));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
|||
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
||||
using TINK.Model.Connector.Updater;
|
||||
using TINK.Model.State;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using BikeInfo = TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo;
|
||||
|
||||
namespace TestTINKLib
|
||||
|
@ -26,6 +27,7 @@ namespace TestTINKLib
|
|||
IEnumerable<string> group = null,
|
||||
WheelType? wheelType = null,
|
||||
TypeOfBike? typeOfBike = null,
|
||||
AaRideType? aaRideType = null,
|
||||
string description = null,
|
||||
string stationId = null,
|
||||
string stationName = null,
|
||||
|
@ -33,7 +35,7 @@ namespace TestTINKLib
|
|||
RentalDescription tariffDescription = null,
|
||||
Func<DateTime> dateTimeProvider = null,
|
||||
IStateInfo stateInfo = null) : base(
|
||||
new Bike(id, lockType, wheelType, typeOfBike, description),
|
||||
new Bike(id, lockType, wheelType, typeOfBike, aaRideType, description),
|
||||
new Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
isDemo,
|
||||
|
@ -167,14 +169,14 @@ namespace TestTINKLib
|
|||
|
||||
var stations = new List<IStation>
|
||||
{
|
||||
new Station("7", new List<string>(), null, "My facy station")
|
||||
new Station("7", new List<string>(), null, "My fancy station")
|
||||
};
|
||||
|
||||
bikeColl.Update(l_oBikeResponse, stations);
|
||||
|
||||
// Verify modified state
|
||||
Assert.That(bikeColl.GetById("57").StationId, Is.EqualTo("7"));
|
||||
Assert.That(bikeColl.GetById("57").StationName, Is.EqualTo("My facy station"));
|
||||
Assert.That(bikeColl.GetById("57").StationName, Is.EqualTo("My fancy station"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -192,12 +194,28 @@ namespace TestTINKLib
|
|||
|
||||
var bikeResponse = new List<BikeInfo>
|
||||
{
|
||||
new BikeInfo(new Bike("57" /* bike id*/, LockModel.ILockIt, WheelType.Trike, TypeOfBike.Allround, "Test description"), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri, false, new List<string> {"TINK" }, "7" /*station id*/, null /*operator uri*/, null, DateTime.Now, "john@long,", "1234"),
|
||||
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
|
||||
new Bike("57" /* bike id*/, LockModel.ILockIt, WheelType.Trike, TypeOfBike.Allround, AaRideType.NoAaRide, "Test description"),
|
||||
new Drive(),
|
||||
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
||||
17, /* Lock id */
|
||||
new Guid(),
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
new byte[0],
|
||||
DateTime.Now,
|
||||
"john@long,",
|
||||
"7", /*station id*/
|
||||
null, /*operator uri*/
|
||||
null, /* tariff description */
|
||||
false, /* is demo */
|
||||
new List<string> {"TINK" } /* group id */
|
||||
),
|
||||
};
|
||||
|
||||
var stations = new List<IStation>
|
||||
{
|
||||
new Station("7", new List<string>(), null, "My facy station")
|
||||
new Station("7", new List<string>(), null, "My fancy station")
|
||||
};
|
||||
|
||||
bikeColl.Update(bikeResponse, stations);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue