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

66 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using NSubstitute;
using NUnit.Framework;
using ShareeBike.Model.Bikes.BikeInfoNS;
using ShareeBike.Model.Bikes.BikeInfoNS.BikeNS;
using ShareeBike.Model.State;
using IBikeInfo = ShareeBike.Model.Bikes.BikeInfoNS.BC.IBikeInfo;
namespace SharedBusinessLogic.Tests.Fixtures.ObjectTests.Bike
{
[TestFixture]
public class TestBikeInfoMutable
{
private class BikeInfoMutable : ShareeBike.Model.Bikes.BikeInfoNS.BC.BikeInfoMutable
{
public BikeInfoMutable(
string id,
LockModel lockModel,
bool isDemo = false,
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,
RentalDescription tariffDescription = null,
Func<DateTime> dateTimeProvider = null,
IStateInfo stateInfo = null) : base(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike(id, lockModel, wheelType, typeOfBike, aaRideType, description),
new ShareeBike.Model.Bikes.BikeInfoNS.DriveNS.DriveMutable(),
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
isDemo,
group,
stationId,
stationName,
operatorUri,
tariffDescription,
dateTimeProvider,
stateInfo)
{
}
}
[Test]
public void TestConstruct()
{
var l_oBikeInfo = new BikeInfoMutable("17", LockModel.ILockIt);
Assert.That(l_oBikeInfo.Id, Is.EqualTo("17"));
Assert.That(l_oBikeInfo.StationId, Is.Null);
Assert.That(l_oBikeInfo.State.Value, Is.EqualTo(InUseStateEnum.Disposable));
Assert.That(l_oBikeInfo.WheelType, Is.EqualTo(null));
Assert.That(l_oBikeInfo.TypeOfBike, Is.EqualTo(null));
l_oBikeInfo = new BikeInfoMutable("22", LockModel.ILockIt, false, new List<string> { "ShareeBike" }, WheelType.Trike, TypeOfBike.Cargo, AaRideType.NoAaRide, "Test description", "23");
Assert.That(l_oBikeInfo.Id, Is.EqualTo("22"));
Assert.That(l_oBikeInfo.IsDemo, Is.False);
Assert.That(l_oBikeInfo.StationId, Is.EqualTo("23"));
Assert.That(l_oBikeInfo.State.Value, Is.EqualTo(InUseStateEnum.Disposable));
Assert.That(l_oBikeInfo.WheelType, Is.EqualTo(WheelType.Trike));
Assert.That(l_oBikeInfo.TypeOfBike, Is.EqualTo(TypeOfBike.Cargo));
}
}
}