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

80 lines
2.3 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;
2024-04-09 12:53:23 +02:00
using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS;
using ShareeBike.Model.Connector;
using ShareeBike.Services.BluetoothLock;
using ShareeBike.Services.Geolocation;
using ShareeBike.ViewModel;
2023-02-22 14:03:35 +01:00
2024-04-09 12:53:23 +02:00
namespace SharedBusinessLogic.Tests.Model.Bike.BluetoothLock
2023-02-22 14:03:35 +01:00
{
[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>(),
2024-04-09 12:53:23 +02:00
new ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike(
2023-02-22 14:03:35 +01:00
"MyBikeId",
2024-04-09 12:53:23 +02:00
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt),
2023-08-31 12:31:38 +02:00
new DriveMutable(),
2024-04-09 12:53:23 +02:00
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
2023-02-22 14:03:35 +01:00
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>(),
2024-04-09 12:53:23 +02:00
new ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike(
2023-02-22 14:03:35 +01:00
"MyBikeId",
2024-04-09 12:53:23 +02:00
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt,
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.WheelType.Trike,
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.TypeOfBike.Cargo),
2023-08-31 12:31:38 +02:00
new DriveMutable(),
2024-04-09 12:53:23 +02:00
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
2023-02-22 14:03:35 +01:00
42,
new Guid(),
"17"),
"My Station Name").ToString(),
2023-11-06 12:23:09 +01:00
Is.EqualTo("Id=MyBikeId;type=Cargo;state=Disposable;Lock id=42"));
2023-02-22 14:03:35 +01:00
}
[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);
}
}
}