mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +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);
|
||||
|
|
|
@ -6,6 +6,7 @@ using TINK.Model.Connector;
|
|||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector.Query
|
||||
|
|
|
@ -7,6 +7,7 @@ using TINK.Model.Connector;
|
|||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
namespace TestShareeLib.Model.Connector
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
|
@ -37,7 +37,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Request
|
|||
// Ensure that answer holds a valid bike.
|
||||
var l_oBike = CopriCallsStatic.DeserializeResponse<BikesAvailableResponse>(VALID_RESPONSE).bikes.FirstOrDefault().Value;
|
||||
Assert.NotNull(l_oBike, "Response must contain at leas one bike.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike despcription must never be empty.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike description must never be empty.");
|
||||
Assert.AreEqual(l_oBike.bike, "26");
|
||||
Assert.That(
|
||||
l_oBike.station,
|
||||
|
@ -108,7 +108,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Request
|
|||
// Ensure that answer holds a valid bike.
|
||||
var l_oBike = CopriCallsStatic.DeserializeResponse<BikesAvailableResponse>(VALID_RESPONSE).bikes.FirstOrDefault().Value;
|
||||
Assert.NotNull(l_oBike, "Response must contain at leas one bike.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike despcription must never be empty.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike description must never be empty.");
|
||||
Assert.That(l_oBike.bike, Is.Null);
|
||||
Assert.That(l_oBike.station, Is.Not.Null);
|
||||
Assert.AreEqual("available", l_oBike.state);
|
||||
|
@ -150,7 +150,7 @@ namespace TestTINKLib.Fixtures.ObjectTests.Connector.Request
|
|||
// Ensure that answer holds a valid bike.
|
||||
var l_oBike = CopriCallsStatic.DeserializeResponse<BikesReservedOccupiedResponse>(VALID_RESPONSE).bikes_occupied.FirstOrDefault().Value;
|
||||
Assert.NotNull(l_oBike, "Response must contain at leas one bike.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike despcription must never be empty.");
|
||||
Assert.Greater(l_oBike.description.Length, 0, "Bike description must never be empty.");
|
||||
Assert.That(l_oBike.bike, Is.Not.Null);
|
||||
Assert.That(l_oBike.station, Is.Not.Null);
|
||||
Assert.Greater(l_oBike.state.Length, 0, "State info must never be null or empty.");
|
||||
|
|
|
@ -8,6 +8,7 @@ using TINK.Model.Services.CopriApi;
|
|||
using TINK.Repository;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
|
|
|
@ -4,10 +4,11 @@ using NSubstitute;
|
|||
using NUnit.Framework;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Query
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class TestQuery
|
||||
{
|
||||
private const string BIKESAVAILABLE = @"{
|
||||
|
|
|
@ -6,10 +6,11 @@ using NUnit.Framework;
|
|||
using TINK.Model.Connector;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Connector
|
||||
{
|
||||
[TestFixture]
|
||||
[TestFixture]
|
||||
public class TestQueryLoggedIn
|
||||
{
|
||||
private const string BIKESAVAILABLE = @"{
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.Internal;
|
||||
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using TINK.Repository.Response.Stations.Station;
|
||||
using JsonConvertRethrow = TINK.Repository.Response.JsonConvertRethrow;
|
||||
|
||||
namespace TestTINKLib.Fixtures.Connector
|
||||
|
@ -22,7 +25,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
// Verify prerequisites
|
||||
Assert.IsNull(l_oInfo.description);
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsNull(TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
}
|
||||
|
||||
|
@ -43,7 +46,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.AreEqual(WheelType.Two, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -60,7 +63,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.AreEqual(WheelType.Trike, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -73,7 +76,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.That(TextToTypeHelper.GetWheelType(l_oInfo), Is.Null); // Was WheelType.Two up to 3.0.322
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -86,7 +89,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.That(TextToTypeHelper.GetWheelType(l_oInfo), Is.Null); // Was WheelType.Two up to 3.0.322
|
||||
}
|
||||
|
||||
|
@ -98,7 +101,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
// Verify prerequisites
|
||||
Assert.IsNull(l_oInfo.description);
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsNull(TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
}
|
||||
|
||||
|
@ -119,7 +122,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.AreEqual(TypeOfBike.Cargo, TextToTypeHelper.GetTypeOfBike(info));
|
||||
|
||||
info = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -136,7 +139,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.AreEqual(TypeOfBike.Cargo, TextToTypeHelper.GetTypeOfBike(info));
|
||||
|
||||
info = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -153,7 +156,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.AreEqual(TypeOfBike.City, TextToTypeHelper.GetTypeOfBike(info));
|
||||
|
||||
info = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -168,12 +171,38 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.That(
|
||||
TextToTypeHelper.GetTypeOfBike(info),
|
||||
Is.Null); // Version up to 3.0.322 considered this bike to be a city bike to to description "Stadtrad"
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAaRideTypeNoAa() =>
|
||||
Assert.That(
|
||||
JsonConvert.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""aa_ride"": ""0"",
|
||||
}").GetAaRideType(),
|
||||
Is.EqualTo(AaRideType.NoAaRide));
|
||||
|
||||
[Test]
|
||||
public void TestGetAaRideTypeAa() =>
|
||||
Assert.That(
|
||||
JsonConvert.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""aa_ride"": ""1"",
|
||||
}").GetAaRideType(),
|
||||
Is.EqualTo(AaRideType.AaRide));
|
||||
|
||||
[Test]
|
||||
public void TestGetAaRideTypeNull() =>
|
||||
Assert.That(
|
||||
JsonConvert.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
}").GetAaRideType(),
|
||||
Is.Null);
|
||||
|
||||
[Test]
|
||||
public void TestGetStateAvailable()
|
||||
=> Assert.That(
|
||||
|
@ -229,7 +258,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
// Verify prerequisites
|
||||
Assert.IsNull(info.state);
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.Throws<InvalidResponseException<BikeInfoBase>>(() => TextToTypeHelper.GetState(info));
|
||||
}
|
||||
|
||||
|
@ -246,7 +275,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -259,7 +288,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -272,7 +301,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsTrue(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
|
@ -285,7 +314,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
// Verify behavior of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
}
|
||||
|
||||
|
@ -368,7 +397,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestGetStationGroup_Invalid()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""gps"" : { ""latitude"": ""47.6586936667"", ""longitude"": ""9.16863116667"" }
|
||||
|
@ -381,7 +410,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestGetStationGroup_TINK()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
|
@ -394,7 +423,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestGetStationGroup_TINKAndKonrad()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""station_group"": [ ""TINK"", ""Konrad"" ],
|
||||
|
@ -1027,4 +1056,4 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
}").GetFrom(),
|
||||
Is.EqualTo(DateTime.MinValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ using TINK.Model.State;
|
|||
using TINK.Model.User.Account;
|
||||
using TINK.Repository;
|
||||
using TINK.Repository.Response;
|
||||
using TINK.Repository.Response.Stations;
|
||||
using Xamarin.Forms;
|
||||
using static TINK.Repository.CopriCallsMemory;
|
||||
|
||||
|
@ -165,7 +166,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
[Test]
|
||||
public void TestUpdateBikesAvailable_BikeNr5GetBooked()
|
||||
{
|
||||
// Bike 5 is availalbe.
|
||||
// Bike 5 is centered.
|
||||
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(DataSource.Copri);
|
||||
|
||||
Assert.AreEqual(12, l_oBikesTarget.Count, "Bike 5 is available an must be part of available bikes collection");
|
||||
|
@ -241,7 +242,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
|
||||
public void TestGetBikesAvailable_BikeNr5GetBooked()
|
||||
{
|
||||
// Bike 5 is availalbe.
|
||||
// Bike 5 is centered.
|
||||
var l_oBikesTarget = GetBikesAvailable(TinkApp.MerchantId, sampleSet: SampleSets.Set2, stageIndex: 1).GetBikesAvailable(DataSource.Copri);
|
||||
|
||||
Assert.AreEqual(11, l_oBikesTarget.Count, "Bike 5 is available an must be part of available bikes collection");
|
||||
|
@ -420,7 +421,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikesAll_BikesAvaialbleResponse()
|
||||
public void TestGetBikesAll_BikesAvailbleResponse()
|
||||
{
|
||||
var availableResponse = JsonConvert.DeserializeObject<BikesAvailableResponse>(
|
||||
@"{
|
||||
|
@ -460,7 +461,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
"There must be one ILockitBike and one BC bike (BikeInfo class).");
|
||||
}
|
||||
[Test]
|
||||
public void TestGetBikesAll_BikesAvaialbleResponse_InvalidState()
|
||||
public void TestGetBikesAll_BikesAvailbleResponse_InvalidState()
|
||||
{
|
||||
var availableResponse = JsonConvert.DeserializeObject<BikesAvailableResponse>(
|
||||
@"{
|
||||
|
@ -489,7 +490,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikesAll_BikesAvaialbleResponse_InvalidStation()
|
||||
public void TestGetBikesAll_BikesAvailableResponse_InvalidStation()
|
||||
{
|
||||
var availableResponse = JsonConvert.DeserializeObject<BikesAvailableResponse>(
|
||||
@"{
|
||||
|
@ -518,7 +519,7 @@ namespace TestShareeLib.Model.Connector.Updater
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikesAll_BikesAvaialbleResponse_DuplicateId()
|
||||
public void TestGetBikesAll_BikesAvailableResponse_DuplicateId()
|
||||
{
|
||||
var availableResponse = JsonConvert.DeserializeObject<BikesAvailableResponse>(
|
||||
@"{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Map;
|
||||
|
||||
|
@ -8,7 +8,7 @@ namespace TestShareeLib.Model.Map
|
|||
public class TestMapSpanFactory
|
||||
{
|
||||
[Test]
|
||||
public void TestCreatePositon()
|
||||
public void TestCreatePosition()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpanFactory.Create(PositionFactory.Create(12, 13), 11).GetType(),
|
||||
|
@ -16,7 +16,7 @@ namespace TestShareeLib.Model.Map
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateNullPositon()
|
||||
public void TestCreateNullPosition()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpanFactory.Create().GetType(),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace TestShareeLib.Model.Station
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace TestShareeLib.Model.Station
|
|||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var data = new TINK.Model.Station.Operator.Data();
|
||||
var data = new TINK.Model.Stations.StationNS.Operator.Data();
|
||||
Assert.That(
|
||||
data.Color,
|
||||
Is.Null);
|
||||
|
@ -33,7 +33,7 @@ namespace TestShareeLib.Model.Station
|
|||
[Test]
|
||||
public void TestCtor_Null()
|
||||
{
|
||||
var data = new TINK.Model.Station.Operator.Data(null, null, null, null, null);
|
||||
var data = new TINK.Model.Stations.StationNS.Operator.Data(null, null, null, null, null);
|
||||
Assert.That(
|
||||
data.Color,
|
||||
Is.Null);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Linq;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations;
|
||||
|
||||
namespace TestTINKLib.Fixtures.ObjectTests.Station
|
||||
{
|
||||
|
@ -10,9 +10,9 @@ namespace TestTINKLib.Fixtures.ObjectTests.Station
|
|||
[Test]
|
||||
public void TestConstruct()
|
||||
{
|
||||
var nullStation = new NullStation();
|
||||
var nullStation = new TINK.Model.Stations.StationNS.NullStation();
|
||||
|
||||
// Was -1 before swiching type of id from int to string when switching from COPRI version v4.0 to v4.1
|
||||
// Was -1 before switching type of id from int to string when switching from COPRI version v4.0 to v4.1
|
||||
Assert.That(
|
||||
nullStation.Id,
|
||||
Is.Null);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
@ -13,7 +13,7 @@ namespace TestTINKLib.Fixtures.Station
|
|||
[Test]
|
||||
public void TestConstruct()
|
||||
{
|
||||
var l_oStation = new TINK.Model.Station.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), "Hallo");
|
||||
var l_oStation = new TINK.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), "Hallo");
|
||||
Assert.AreEqual("7", l_oStation.Id);
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oStation.Group));
|
||||
Assert.AreEqual(1, l_oStation.Position.Latitude);
|
||||
|
@ -24,7 +24,7 @@ namespace TestTINKLib.Fixtures.Station
|
|||
[Test]
|
||||
public void TestConstruct_InvalidStationName()
|
||||
{
|
||||
var l_oStation = new TINK.Model.Station.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), null);
|
||||
var l_oStation = new TINK.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), null);
|
||||
Assert.AreEqual("7", l_oStation.Id);
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oStation.Group));
|
||||
Assert.AreEqual(1, l_oStation.Position.Latitude);
|
||||
|
@ -35,14 +35,14 @@ namespace TestTINKLib.Fixtures.Station
|
|||
[Test]
|
||||
public void TestConstruct_InvalidStationGroup()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.Station.Station("7", null, PositionFactory.Create(1, 2), "Hallo"));
|
||||
Assert.Throws<ArgumentException>(() => new TINK.Model.Stations.StationNS.Station("7", null, PositionFactory.Create(1, 2), "Hallo"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstruct_NoOperator()
|
||||
{
|
||||
Assert.That(
|
||||
new TINK.Model.Station.Station("7", new List<string>(), PositionFactory.Create(1, 2), "Hallo").OperatorData,
|
||||
new TINK.Model.Stations.StationNS.Station("7", new List<string>(), PositionFactory.Create(1, 2), "Hallo").OperatorData,
|
||||
Is.Not.Null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,29 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
public void TestGetAtStation()
|
||||
{
|
||||
var coll = new BikeCollection(
|
||||
new Dictionary<string, TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo>
|
||||
new Dictionary<string, BikeInfo>
|
||||
{
|
||||
{"3", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("7", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"3" /* Stadion id */) },
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) },
|
||||
{"12", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) }
|
||||
{"3", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
|
||||
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("7", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
17, /* Lock id */
|
||||
new Guid(),
|
||||
"3" /* Station id */) },
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
|
||||
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
17, /* Lock id */
|
||||
new Guid(),
|
||||
"12" /* Station id */) },
|
||||
{"12",
|
||||
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
17, /* Lock id */
|
||||
new Guid(),
|
||||
"12" /* Station id */) }
|
||||
});
|
||||
|
||||
Assert.AreEqual(
|
||||
|
@ -57,10 +75,18 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
{
|
||||
// Holds no LockIt bikes
|
||||
var coll = new BikeCollection(
|
||||
new Dictionary<string, TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo>
|
||||
new Dictionary<string, BikeInfo>
|
||||
{
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) },
|
||||
{"12", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) }
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
"12", /* Station id */
|
||||
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()) },
|
||||
{"12", new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
"12", /* Station id */
|
||||
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()) }
|
||||
});
|
||||
|
||||
Assert.AreEqual(
|
||||
|
@ -74,11 +100,24 @@ namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
|
||||
// Holds no LockIt bike with matching station number.
|
||||
var coll = new BikeCollection(
|
||||
new Dictionary<string, TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo>
|
||||
new Dictionary<string, BikeInfo>
|
||||
{
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) },
|
||||
{"11", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt), new Drive(), DataSource.Copri, 5200544, new Guid("00000000-0000-0000-0000-000000000001"), "12" /* Stadion id */) },
|
||||
{"12", new TINK.Model.Bikes.BikeInfoNS.BC.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt), new Drive(), TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,"12" /* Stadion id */) }
|
||||
{"7", new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("8", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
"12", /* Station id */
|
||||
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()) },
|
||||
{"11", new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
5200544,
|
||||
new Guid("00000000-0000-0000-0000-000000000001"),
|
||||
"12" /* Station id */) },
|
||||
{"12", new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("33", LockModel.ILockIt),
|
||||
new Drive(),
|
||||
DataSource.Copri,
|
||||
"12", /* Station id */
|
||||
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()) }
|
||||
});
|
||||
|
||||
Assert.AreEqual(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
|
@ -9,19 +9,19 @@ namespace TestShareeLib.Model
|
|||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var positon = PositionFactory.Create();
|
||||
Assert.That(positon.GetType(), Is.EqualTo(typeof(NullPostion)), "Object under test is not of expected type.");
|
||||
var position = PositionFactory.Create();
|
||||
Assert.That(position.GetType(), Is.EqualTo(typeof(NullPosition)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positon.IsValid,
|
||||
position.IsValid,
|
||||
Is.False);
|
||||
|
||||
Assert.That(
|
||||
positon.Longitude,
|
||||
position.Longitude,
|
||||
Is.EqualTo(double.NaN));
|
||||
|
||||
Assert.That(
|
||||
positon.Latitude,
|
||||
position.Latitude,
|
||||
Is.EqualTo(double.NaN));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
|
@ -9,42 +9,42 @@ namespace TestShareeLib.Model
|
|||
[Test]
|
||||
public void TestEquals()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(12, 13);
|
||||
var positionA = PositionFactory.Create(12, 13);
|
||||
var positionB = PositionFactory.Create(12, 13);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
positionA.Equals(positionB),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEqualsNotEquaLong()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(13, 13);
|
||||
var positionA = PositionFactory.Create(12, 13);
|
||||
var positionB = PositionFactory.Create(13, 13);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
positionA.Equals(positionB),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEqualsNotEquaLat()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(12, 12);
|
||||
var positionA = PositionFactory.Create(12, 13);
|
||||
var positionB = PositionFactory.Create(12, 12);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
positionA.Equals(positionB),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace TestShareeLib.Model
|
|||
{
|
||||
Assert.That(
|
||||
PositionFactory.Create().GetType(),
|
||||
Is.EqualTo(typeof(NullPostion)));
|
||||
Is.EqualTo(typeof(NullPosition)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ using TINK.Model;
|
|||
using TINK.Model.Bikes;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Model.Settings;
|
||||
using TINK.Model.Station;
|
||||
using TINK.Model.Stations.StationNS;
|
||||
using TINK.Model.User;
|
||||
using TINK.Repository;
|
||||
using TINK.Services;
|
||||
|
@ -84,13 +84,13 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
|
||||
Assert.AreEqual(0, 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);
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Stations.StationNS.Station("5", new List<string>(), null);
|
||||
Assert.AreEqual(3, GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
Assert.AreEqual("25", GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("25").Id);
|
||||
Assert.AreEqual("11", GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.GetById("11").Id);
|
||||
Assert.AreEqual("2", 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);
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Stations.StationNS.Station("10", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(
|
||||
1,
|
||||
|
@ -98,7 +98,7 @@ namespace TestTINKLib.Fixtures.UseCases.SelectStation
|
|||
|
||||
Assert.AreEqual("18", 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);
|
||||
l_oTinkApp.SelectedStation = new TINK.Model.Stations.StationNS.Station("91345", new List<string>(), null);
|
||||
|
||||
Assert.AreEqual(0, GetBikesAtStation(l_oTinkApp.ActiveUser, l_oConnector, l_oTinkApp.Stations, l_oTinkApp.SelectedStation.Id).Result.Count);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
@ -41,8 +41,8 @@ namespace TestTINKLib.Fixtures.ObjectTests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// This test verified old implementedation which worked with the different versions to determine whenther whats new has to be shown or not.
|
||||
/// Test updated to new implmentedation (based on filtering of AllFlavorsAndPlatformMessages)
|
||||
/// This test verified old implementation which worked with the different versions to determine whenther whats new has to be shown or not.
|
||||
/// Test updated to new implementation (based on filtering of AllFlavorsAndPlatformMessages)
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestIsShowRequired_Update_VersionWhichSupporsWhatsNew()
|
||||
|
@ -54,13 +54,13 @@ namespace TestTINKLib.Fixtures.ObjectTests
|
|||
new Version(3, 0, 111), /* Version when whats new was shown */
|
||||
AppFlavor.ShareeBike,
|
||||
DevicePlatform.Android).IsShowRequired,
|
||||
"If whats new was last shonw for version 3.0.111 and current version is 2.0.335 info must be shown");
|
||||
"If whats new was last shown for version 3.0.111 and current version is 2.0.335 info must be shown");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This test verified old implementedation which worked with the different versions to determine whenther whats new has to be shown or not.
|
||||
/// Test updated to new implmentedation (based on filtering of AllFlavorsAndPlatformMessages)
|
||||
/// This test verified old implementation which worked with the different versions to determine whenther whats new has to be shown or not.
|
||||
/// Test updated to new implementation (based on filtering of AllFlavorsAndPlatformMessages)
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestIsShowRequired_Update_VersionWithoutWhatsNew()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue