sharee.bike-App/TestShareeLib/Model/Bikes/BikeInfoNS/BluetoothLock/TestBikeInfoMutalbe.cs

80 lines
2.2 KiB
C#
Raw Normal View History

2023-02-22 14:03:35 +01:00
using System;
2023-08-31 12:20:06 +02:00
using NSubstitute;
2023-02-22 14:03:35 +01:00
using NUnit.Framework;
using TINK.Model.Bikes.BikeInfoNS.BluetoothLock;
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
2023-08-31 12:20:06 +02:00
using TINK.Model.Connector;
using TINK.Services.BluetoothLock;
using TINK.Services.Geolocation;
using TINK.ViewModel;
2023-02-22 14:03:35 +01:00
namespace TestShareeLib.Model.Bike.BluetoothLock
{
[TestFixture]
public class TestBikeInfoMutalbe
{
[Test]
public void TestCtor()
{
Assert.That(
new BikeInfoMutable(
2023-08-31 12:20:06 +02:00
Substitute.For<IGeolocationService>(),
Substitute.For<ILocksService>(),
() => false /* not connected */,
(_) => Substitute.For<IConnector>(),
() => Substitute.For<IPollingUpdateTaskManager>(),
2023-02-22 14:03:35 +01:00
new TINK.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike(
"MyBikeId",
TINK.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt),
2023-08-31 12:31:38 +02:00
new DriveMutable(),
2023-02-22 14:03:35 +01:00
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(
2023-08-31 12:20:06 +02:00
Substitute.For<IGeolocationService>(),
Substitute.For<ILocksService>(),
() => false /* not connected */,
(_) => Substitute.For<IConnector>(),
() => Substitute.For<IPollingUpdateTaskManager>(),
2023-02-22 14:03:35 +01:00
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),
2023-08-31 12:31:38 +02:00
new DriveMutable(),
2023-02-22 14:03:35 +01:00
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
42,
new Guid(),
"17"),
"My Station Name").ToString(),
Is.EqualTo("Id=MyBikeId;type=Cargo;state=Disposable"));
}
[Test]
public void TestCtorBikeNull()
{
Assert.That(
2023-08-31 12:20:06 +02:00
() => new BikeInfoMutable(
Substitute.For<IGeolocationService>(),
Substitute.For<ILocksService>(),
() => false /* not connected */,
(_) => Substitute.For<IConnector>(),
() => Substitute.For<IPollingUpdateTaskManager>(),
null,
"My Station Name"),
2023-02-22 14:03:35 +01:00
Throws.ArgumentNullException);
}
}
}