sharee.bike-App/SharedBusinessLogic.Tests/Model/Bikes/BikeInfoNS/BluetoothLock/TestBikeInfoMutalbe.cs
2024-04-09 12:53:23 +02:00

80 lines
2.3 KiB
C#

using System;
using NSubstitute;
using NUnit.Framework;
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;
namespace SharedBusinessLogic.Tests.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 ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike(
"MyBikeId",
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt),
new DriveMutable(),
ShareeBike.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 ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike(
"MyBikeId",
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.LockModel.ILockIt,
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.WheelType.Trike,
ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.TypeOfBike.Cargo),
new DriveMutable(),
ShareeBike.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);
}
}
}