sharee.bike-App/SharedBusinessLogic.Tests/ViewModel/Bikes/Bike/BC/TestMyBikePageViewModel.cs
2024-04-09 12:53:23 +02:00

87 lines
2.2 KiB
C#

using System;
using NSubstitute;
using NUnit.Framework;
using ShareeBike.Model.Device;
using ShareeBike.ViewModel;
using ShareeBike.ViewModel.Bikes;
namespace UITest.Fixtures.ViewModel
{
[TestFixture]
public class TestMyBikesPageViewModel
{
/// <summary>
/// Tests base class functionality by using child.
/// </summary>
[Test]
public void TestStateText_LoggedIn_Reserved()
{
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_Reserved(
(bike, user) => new ShareeBike.ViewModel.Bikes.Bike.BC.BikeViewModel(
null,
null,
null,
null,
Substitute.For<ISmartDevice>(),
null,
bike,
user,
new MyBikeInUseStateInfoProvider(),
Substitute.For<IBikesViewModel>(),
url => { }));
Assert.That(l_oViewModel.StateText, Is.EqualTo("Location Station 3, still 15 min. reserved."));
}
/// <summary>
/// Tests base class functionality by using child.
/// </summary>
[Test]
public void TestStateText_LoggedIn_ReservedWithCopriConnect()
{
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_ReservedWithCopriConnect(
(bike, user) => new ShareeBike.ViewModel.Bikes.Bike.BC.BikeViewModel(
null,
null,
null,
null,
Substitute.For<ISmartDevice>(),
null,
bike,
user,
new MyBikeInUseStateInfoProvider(),
Substitute.For<IBikesViewModel>(),
url => { }));
Assert.That(l_oViewModel.StateText, Is.EqualTo("Code 4asdfA, location Station 3, still 7 min. reserved."));
}
/// <summary>
/// Tests base class functionality by using child.
/// </summary>
///
[Test]
public void TestStateText_LoggedIn_Booked()
{
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_Booked(
(bike, user) => new ShareeBike.ViewModel.Bikes.Bike.BC.BikeViewModel(
null,
null,
null,
null,
Substitute.For<ISmartDevice>(),
null,
bike,
user,
new MyBikeInUseStateInfoProvider(),
Substitute.For<IBikesViewModel>(),
url => { }));
Assert.That(
l_oViewModel.StateText, Is.EqualTo($"Code 4asdfA, location Station 3, rented since {new DateTime(2018, 10, 24, 21, 49, 00).ToString("dd. MMMM HH:mm")}."));
}
}
}