mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-16 23:26:26 +01:00
79 lines
2.2 KiB
C#
79 lines
2.2 KiB
C#
using System;
|
|
using NSubstitute;
|
|
using NUnit.Framework;
|
|
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
|
|
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
|
|
using TINK.Model.Connector;
|
|
using TINK.Services.BluetoothLock;
|
|
using TINK.Services.Geolocation;
|
|
using TINK.ViewModel;
|
|
|
|
namespace TestShareeLib.Model.Bike.BluetoothLock
|
|
{
|
|
[TestFixture]
|
|
public class TestBikeInfoMutalbe
|
|
{
|
|
[Test]
|
|
public void TestCtor()
|
|
{
|
|
Assert.That(
|
|
new BikeInfoMutable(
|
|
Substitute.For<IGeolocationService>(),
|
|
Substitute.For<ILocksService>(),
|
|
() => false /* not connected */,
|
|
(_) => Substitute.For<IConnector>(),
|
|
() => Substitute.For<IPollingUpdateTaskManager>(),
|
|
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
|
|
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(
|
|
"MyBikeId",
|
|
TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt),
|
|
new DriveMutable(),
|
|
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
42,
|
|
new Guid(),
|
|
"17"),
|
|
"My Station Name").StationName,
|
|
Is.EqualTo("My Station Name"));
|
|
}
|
|
|
|
[Test]
|
|
public void TestToString()
|
|
{
|
|
Assert.That(
|
|
new BikeInfoMutable(
|
|
Substitute.For<IGeolocationService>(),
|
|
Substitute.For<ILocksService>(),
|
|
() => false /* not connected */,
|
|
(_) => Substitute.For<IConnector>(),
|
|
() => Substitute.For<IPollingUpdateTaskManager>(),
|
|
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
|
|
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(
|
|
"MyBikeId",
|
|
TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt,
|
|
TINK.Model.Bikes.BikeInfoNS.BikeNS.WheelType.Trike,
|
|
TINK.Model.Bikes.BikeInfoNS.BikeNS.TypeOfBike.Cargo),
|
|
new DriveMutable(),
|
|
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
|
|
42,
|
|
new Guid(),
|
|
"17"),
|
|
"My Station Name").ToString(),
|
|
Is.EqualTo("Id=MyBikeId;type=Cargo;state=Disposable;Lock id=42"));
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorBikeNull()
|
|
{
|
|
Assert.That(
|
|
() => new BikeInfoMutable(
|
|
Substitute.For<IGeolocationService>(),
|
|
Substitute.For<ILocksService>(),
|
|
() => false /* not connected */,
|
|
(_) => Substitute.For<IConnector>(),
|
|
() => Substitute.For<IPollingUpdateTaskManager>(),
|
|
null,
|
|
"My Station Name"),
|
|
Throws.ArgumentNullException);
|
|
}
|
|
}
|
|
}
|