2021-07-12 21:31:46 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Rhino.Mocks;
|
2022-08-30 15:42:25 +02:00
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS.BC;
|
|
|
|
|
using TINK.Model.Bikes.BikeInfoNS.BikeNS;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
using TINK.ViewModel;
|
2022-04-25 22:15:15 +02:00
|
|
|
|
|
2021-07-12 21:31:46 +02:00
|
|
|
|
namespace UITest.Fixtures.ObjectTests.ViewModel
|
|
|
|
|
{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestViewModelHelper
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetDisplayName_DefinedTypes()
|
|
|
|
|
{
|
|
|
|
|
var l_oBike = MockRepository.GenerateStub<IBikeInfoMutable>();
|
|
|
|
|
l_oBike.Stub(x => x.WheelType).Return(WheelType.Two);
|
|
|
|
|
l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.City);
|
|
|
|
|
l_oBike.Stub(x => x.Description).Return("MeinStadtrad");
|
|
|
|
|
l_oBike.Stub(x => x.Id).Return("22");
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"MeinStadtrad",
|
|
|
|
|
l_oBike.GetDisplayName());
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"22",
|
|
|
|
|
l_oBike.GetDisplayId());
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
l_oBike = MockRepository.GenerateStub<IBikeInfoMutable>();
|
|
|
|
|
l_oBike.Stub(x => x.WheelType).Return(WheelType.Two);
|
|
|
|
|
l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.City);
|
|
|
|
|
l_oBike.Stub(x => x.Id).Return("22");
|
|
|
|
|
l_oBike.Stub(x => x.IsDemo).Return(true);
|
|
|
|
|
l_oBike.Stub(x => x.Description).Return("MeinStadtrad");
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"MeinStadtrad",
|
|
|
|
|
l_oBike.GetDisplayName());
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"22",
|
|
|
|
|
l_oBike.GetDisplayId());
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
l_oBike = MockRepository.GenerateStub<IBikeInfoMutable>();
|
|
|
|
|
l_oBike.Stub(x => x.WheelType).Return(WheelType.Trike);
|
|
|
|
|
l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
|
|
|
|
l_oBike.Stub(x => x.Description).Return("MeinCargoDreiradl");
|
|
|
|
|
l_oBike.Stub(x => x.Id).Return("22");
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"MeinCargoDreiradl",
|
|
|
|
|
l_oBike.GetDisplayName());
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"22",
|
|
|
|
|
l_oBike.GetDisplayId());
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
l_oBike = MockRepository.GenerateStub<IBikeInfoMutable>();
|
|
|
|
|
l_oBike.Stub(x => x.WheelType).Return(WheelType.Two);
|
|
|
|
|
l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
|
|
|
|
l_oBike.Stub(x => x.Description).Return("MeinCargoALololong");
|
|
|
|
|
l_oBike.Stub(x => x.Id).Return("22");
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"MeinCargoALololong",
|
|
|
|
|
l_oBike.GetDisplayName());
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"22",
|
|
|
|
|
l_oBike.GetDisplayId());
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetDisplayName_UndefinedTypes()
|
|
|
|
|
{
|
|
|
|
|
var l_oBike = MockRepository.GenerateStub<IBikeInfoMutable>();
|
|
|
|
|
l_oBike.Stub(x => x.WheelType).Return(WheelType.Mono);
|
|
|
|
|
l_oBike.Stub(x => x.TypeOfBike).Return(TypeOfBike.Cargo);
|
|
|
|
|
l_oBike.Stub(x => x.Description).Return("SuperCargo");
|
|
|
|
|
l_oBike.Stub(x => x.Id).Return("22");
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"SuperCargo",
|
|
|
|
|
l_oBike.GetDisplayName());
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"22",
|
|
|
|
|
l_oBike.GetDisplayId());
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
}
|