2022-08-30 15:42:25 +02:00
|
|
|
|
using System;
|
|
|
|
|
using NUnit.Framework;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
using Rhino.Mocks;
|
|
|
|
|
using TINK.Model.Device;
|
|
|
|
|
using TINK.ViewModel;
|
|
|
|
|
using TINK.ViewModel.Bikes;
|
|
|
|
|
|
|
|
|
|
namespace UITest.Fixtures.ViewModel
|
|
|
|
|
{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestMyBikesPageViewModel
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tests base class functionaltiy by using child.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestStateText_LoggedIn_Reserved()
|
|
|
|
|
{
|
|
|
|
|
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_Reserved(
|
|
|
|
|
(bike, user) => new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
|
|
|
null,
|
|
|
|
|
bike,
|
|
|
|
|
user,
|
|
|
|
|
new MyBikeInUseStateInfoProvider(),
|
|
|
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
|
|
|
url => { }));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual("Location Station 3, still 15 min. reserved.", l_oViewModel.StateText);
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tests base class functionaltiy by using child.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestStateText_LoggedIn_ReservedWithCopriConnect()
|
|
|
|
|
{
|
|
|
|
|
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_ReservedWithCopriConnect(
|
|
|
|
|
(bike, user) => new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
|
|
|
null,
|
|
|
|
|
bike,
|
|
|
|
|
user,
|
|
|
|
|
new MyBikeInUseStateInfoProvider(),
|
|
|
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
|
|
|
url => { }));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual("Code 4asdfA, location Station 3, still 7 min. reserved.", l_oViewModel.StateText);
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tests base class functionaltiy by using child.
|
|
|
|
|
/// </summary>
|
|
|
|
|
///
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestStateText_LoggedIn_Booked()
|
|
|
|
|
{
|
|
|
|
|
var l_oViewModel = TestBikeViewModel.TestStateText_LoggedIn_Booked(
|
|
|
|
|
(bike, user) => new TINK.ViewModel.Bikes.Bike.BC.BikeViewModel(
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
null,
|
|
|
|
|
NSubstitute.Substitute.For<ISmartDevice>(),
|
|
|
|
|
null,
|
|
|
|
|
bike,
|
|
|
|
|
user,
|
|
|
|
|
new MyBikeInUseStateInfoProvider(),
|
|
|
|
|
MockRepository.GenerateStub<IBikesViewModel>(),
|
|
|
|
|
url => { }));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
$"Code 4asdfA, location Station 3, rented since {new DateTime(2018, 10, 24, 21, 49, 00).ToString("dd. MMMM HH:mm")}.",
|
|
|
|
|
l_oViewModel.StateText);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
}
|