sharee.bike-App/TestTINKLib/Fixtures/ObjectTests/ViewModel/TestBikeAtStationInUseStateInfoProvider.cs

28 lines
1.3 KiB
C#
Raw Normal View History

2022-08-30 15:42:25 +02:00
using System;
using NUnit.Framework;
2021-07-12 21:31:46 +02:00
using TINK.ViewModel;
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
{
[TestFixture]
public class TestBikeAtStationInUseStateInfoProvider
{
[Test]
public void TestGetReservedInfo()
{
2022-08-30 15:42:25 +02:00
Assert.That(new BikeAtStationInUseStateInfoProvider().GetReservedInfo(null), Is.EqualTo("Max. reservation time of 15 min. expired."));
2021-07-12 21:31:46 +02:00
Assert.That(new BikeAtStationInUseStateInfoProvider().GetReservedInfo(null, code: "Code123"), Is.Not.Null);
Assert.That(new BikeAtStationInUseStateInfoProvider().GetReservedInfo(TimeSpan.FromSeconds(3), code: "Code123"), Is.Not.Null);
2022-08-30 15:42:25 +02:00
Assert.That(new BikeAtStationInUseStateInfoProvider().GetReservedInfo(TimeSpan.FromSeconds(60)), Is.EqualTo("Still 1 min. reserved."));
2021-07-12 21:31:46 +02:00
}
[Test]
public void Test()
{
Assert.That(new BikeAtStationInUseStateInfoProvider().GetBookedInfo(null), Is.EqualTo("Bike is rented."));
Assert.That(new BikeAtStationInUseStateInfoProvider().GetBookedInfo(DateTime.Parse("2020-12-19 0:22"), code: "Code123"), Is.Not.Null);
Assert.That(new BikeAtStationInUseStateInfoProvider().GetBookedInfo(DateTime.Parse("2020-12-19 0:22"), code: "Code123"), Is.EqualTo("Code Code123, rented since 19. December 00:22."));
}
}
}