mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-23 07:36:31 +01:00
96 lines
2.5 KiB
C#
96 lines
2.5 KiB
C#
|
using NSubstitute;
|
|||
|
using NUnit.Framework;
|
|||
|
using TINK.Model.Bikes.Bike.BC;
|
|||
|
using TINK.ViewModel;
|
|||
|
|
|||
|
namespace TestShareeLib.ViewModel
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestViewModelHelper
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void TestGetFullDisplayName()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("MyStation");
|
|||
|
bike.Id.Returns("MyId");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetFullDisplayName(),
|
|||
|
Is.EqualTo("MyStation, Nr. MyId"));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetFullDisplayNameIdEmpty()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("MyStation");
|
|||
|
bike.Id.Returns("");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetFullDisplayName(),
|
|||
|
Is.EqualTo("MyStation, Nr. "));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetFullDisplayNameEmpty()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("");
|
|||
|
bike.Id.Returns("Id33");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetDisplayName(),
|
|||
|
Is.EqualTo("Id33"));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetDisplayName()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("MyStation");
|
|||
|
bike.Id.Returns("Id33");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetDisplayName(),
|
|||
|
Is.EqualTo("MyStation"));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetDisplayNameEmpty()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("");
|
|||
|
bike.Id.Returns("Id33");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetDisplayName(),
|
|||
|
Is.EqualTo("Id33"));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetDisplayId()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("ValidName");
|
|||
|
bike.Id.Returns("Id33");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetDisplayId(),
|
|||
|
Is.EqualTo("Id33"));
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetDisplayIdNameEmpty()
|
|||
|
{
|
|||
|
var bike = Substitute.For<IBikeInfoMutable>();
|
|||
|
bike.Description.Returns("");
|
|||
|
bike.Id.Returns("Id33");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
bike.GetDisplayId(),
|
|||
|
Is.EqualTo(""));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|