sharee.bike-App/TestTINKLib/Fixtures/ObjectTests/Bike/TestBikeMutable.cs

68 lines
2.5 KiB
C#
Raw Normal View History

2021-07-12 21:31:46 +02:00
using System;
using System.Collections.Generic;
using NUnit.Framework;
using TINK.Model.Bike;
using TINK.Model.State;
using BikeInfoMutable = TINK.Model.Bike.BC.BikeInfoMutable;
namespace TestTINKLib
{
/// <summary>
/// Moved to TestShareeLib (.Net Core)
/// </summary>
[TestFixture]
class TestBikeMutable
{
[Test]
public void TestConstruct()
{
var l_oBike = new BikeInfoMutable(
42,
false,
new List<string> { "TINK" },
WheelType.Two,
TypeOfBike.Cargo);
Assert.AreEqual(42, l_oBike.Id);
Assert.IsFalse(l_oBike.IsDemo);
Assert.AreEqual(WheelType.Two, l_oBike.WheelType);
Assert.AreEqual(TypeOfBike.Cargo, l_oBike.TypeOfBike);
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
Assert.IsNull(l_oBike.CurrentStation);
l_oBike = new BikeInfoMutable(
17,
true,
new List<string> { "TINK" },
WheelType.Mono,
TypeOfBike.Allround,
"Test description",
1);
Assert.AreEqual(17, l_oBike.Id);
Assert.IsTrue(l_oBike.IsDemo);
Assert.AreEqual(WheelType.Mono, l_oBike.WheelType);
Assert.AreEqual(TypeOfBike.Allround, l_oBike.TypeOfBike);
Assert.AreEqual(InUseStateEnum.Disposable, l_oBike.State.Value);
Assert.AreEqual(1, l_oBike.CurrentStation);
}
[Test]
public void TestToString()
{
var l_oBike = new BikeInfoMutable(3, false, new List<string> { "TINK" }, WheelType.Two, TypeOfBike.Cargo, p_oDateTimeProvider: () => new DateTime(1970, 1, 1));
Assert.AreEqual(
"Id=3, wheel(s)=Two, type=Cargo, demo=False, state=Disposable, location=On the road.",
l_oBike.ToString());
l_oBike = new BikeInfoMutable(3, true, new List<string> { "TINK" }, WheelType.Trike, TypeOfBike.Allround, "Test description", 5, p_oDateTimeProvider: () => new DateTime(1970, 1, 1));
Assert.AreEqual(
"Id=3, wheel(s)=Trike, type=Allround, demo=True, state=Disposable, location=Station 5.",
l_oBike.ToString());
}
}
}