sharee.bike-App/SharedBusinessLogic.Tests/Model/Bikes/BikeInfoNS/CopriLock/TestBikeInfo.cs

94 lines
2.5 KiB
C#
Raw Normal View History

2024-04-09 12:53:23 +02:00
using System;
using NUnit.Framework;
using ShareeBike.Model.Bikes.BikeInfoNS;
using ShareeBike.Model.Bikes.BikeInfoNS.BC;
using ShareeBike.Model.Bikes.BikeInfoNS.BikeNS;
using ShareeBike.Model.Bikes.BikeInfoNS.DriveNS;
namespace SharedBusinessLogic.Tests.Model.Bike.CopriLock
{
[TestFixture]
public class TestBikeInfo
{
[Test]
public void TestCtorAvailable()
{
var bike = new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike("bikeId", LockModel.Sigo),
new DriveMutable(),
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
"stationId",
new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.LockInfo());
Assert.That(
bike.State.Value,
Is.EqualTo(ShareeBike.Model.State.InUseStateEnum.Disposable));
}
[Test]
public void TestCtorAvailableBikeNull()
{
Assert.That(
() => new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new DriveMutable(),
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
"stationId",
new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()),
Throws.ArgumentNullException);
}
[Test]
public void TestCtorFeedbackRequired()
{
var bike = new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
new ShareeBike.Model.Bikes.BikeInfoNS.BikeNS.Bike("bikeId", LockModel.Sigo),
new DriveMutable(),
ShareeBike.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
"stationId",
new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
true);
Assert.That(
bike.State.Value,
Is.EqualTo(ShareeBike.Model.State.InUseStateEnum.FeedbackPending));
}
[Test]
public void TestCtorRequestedBikeNull()
{
Assert.That(
() => new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new DriveMutable(),
DataSource.Copri,
DateTime.Now,
"a@b",
"stationId",
new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
new Uri("https://sharee.bike"),
new RentalDescription(),
() => DateTime.Now),
Throws.ArgumentNullException);
}
[Test]
public void TestCtorOccupiedBikeNull()
{
Assert.That(
() => new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new DriveMutable(),
DataSource.Copri,
DateTime.Now,
"a@b",
"stationId",
new ShareeBike.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
new Uri("https://sharee.bike"),
new RentalDescription()),
Throws.ArgumentNullException);
}
}
}