mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-25 00:26:27 +01:00
32 lines
1.8 KiB
C#
32 lines
1.8 KiB
C#
|
using NUnit.Framework;
|
|||
|
using System;
|
|||
|
using TINK.ViewModel;
|
|||
|
|
|||
|
namespace TestTINKLib.Fixtures.ObjectTests.ViewModel
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestMyBikeInUseStateInfoProvider
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void TestGetReservedInfo()
|
|||
|
{
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(null), Is.EqualTo("Max. reservation time of 15 minutes expired."));
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(null, code: "Code12"), Is.Not.Null);
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(null, "12"), Is.EqualTo("Location 12, max. reservation time of 15 minutes expired."));
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(null, "12", "Code12"), Is.Not.Null);
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(TimeSpan.FromSeconds(10)), Is.Not.Null);
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(TimeSpan.FromSeconds(10), "123"), Is.EqualTo("Location Station 123, still 0 minutes reserved."));
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetReservedInfo(TimeSpan.FromSeconds(10), "123", "code123"), Is.Not.Null);
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetBookedInfoInfo()
|
|||
|
{
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetBookedInfo(null), Is.EqualTo("Bike is rented."));
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetBookedInfo(DateTime.Now, "123", "Code123"), Is.Not.Null);
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetBookedInfo(DateTime.Now, code: "Code123"), Is.Not.Null);
|
|||
|
Assert.That(new MyBikeInUseStateInfoProvider().GetBookedInfo(DateTime.Parse("2020-12-19 0:22"), "123"), Is.EqualTo("Rented since 19. December 00:22."));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|