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

94 lines
2.3 KiB
C#
Raw Normal View History

2023-01-18 14:22:51 +01:00
using System;
2022-08-30 15:42:25 +02:00
using NUnit.Framework;
using TINK.Model.Bikes.BikeInfoNS;
2023-01-18 14:22:51 +01:00
using TINK.Model.Bikes.BikeInfoNS.BC;
2022-08-30 15:42:25 +02:00
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
using TINK.Model.Bikes.BikeInfoNS.DriveNS;
namespace TestShareeLib.Model.Bike.CopriLock
{
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestBikeInfo
{
[Test]
public void TestCtorAvailable()
{
var bike = new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("bikeId", LockModel.Sigo),
new Drive(),
2023-01-18 14:22:51 +01:00
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
2022-09-06 16:08:19 +02:00
"stationId",
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo());
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
Assert.That(
bike.State.Value,
Is.EqualTo(TINK.Model.State.InUseStateEnum.Disposable));
}
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestCtorAvailableBikeNull()
{
Assert.That(
() => new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new Drive(),
2023-01-18 14:22:51 +01:00
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
2022-09-06 16:08:19 +02:00
"stationId",
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo()),
Throws.ArgumentNullException);
}
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestCtorFeedbackRequired()
{
var bike = new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
new TINK.Model.Bikes.BikeInfoNS.BikeNS.Bike("bikeId", LockModel.Sigo),
new Drive(),
2023-01-18 14:22:51 +01:00
TINK.Model.Bikes.BikeInfoNS.BC.DataSource.Copri,
2022-09-06 16:08:19 +02:00
"stationId",
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
true);
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
Assert.That(
bike.State.Value,
Is.EqualTo(TINK.Model.State.InUseStateEnum.FeedbackPending));
}
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestCtorRequestedBikeNull()
{
Assert.That(
() => new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new Drive(),
2023-01-18 14:22:51 +01:00
DataSource.Copri,
2022-09-06 16:08:19 +02:00
DateTime.Now,
"a@b",
"stationId",
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
new Uri("https://sharee.bike"),
new RentalDescription(),
() => DateTime.Now),
Throws.ArgumentNullException);
}
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestCtorOccupiedBikeNull()
{
Assert.That(
() => new TINK.Model.Bikes.BikeInfoNS.CopriLock.BikeInfo(
null,
new Drive(),
2023-01-18 14:22:51 +01:00
DataSource.Copri,
2022-09-06 16:08:19 +02:00
DateTime.Now,
"a@b",
"stationId",
new TINK.Model.Bikes.BikeInfoNS.CopriLock.LockInfo(),
new Uri("https://sharee.bike"),
new RentalDescription()),
Throws.ArgumentNullException);
}
}
2022-08-30 15:42:25 +02:00
}