sharee.bike-App/TestShareeLib/Model/Station/TestStation.cs

50 lines
1.5 KiB
C#
Raw Normal View History

2023-04-19 12:14:14 +02:00
using System;
2021-07-12 21:31:46 +02:00
using System.Collections.Generic;
using System.Linq;
2022-08-30 15:42:25 +02:00
using NUnit.Framework;
2022-01-22 18:16:10 +01:00
using TINK.Model;
2021-07-12 21:31:46 +02:00
namespace TestTINKLib.Fixtures.Station
{
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[TestFixture]
public class TestStation
{
[Test]
public void TestConstruct()
{
2023-04-19 12:14:14 +02:00
var l_oStation = new TINK.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), "Hallo");
2022-09-06 16:08:19 +02:00
Assert.AreEqual("7", l_oStation.Id);
Assert.AreEqual("TINK", string.Join(",", l_oStation.Group));
Assert.AreEqual(1, l_oStation.Position.Latitude);
Assert.AreEqual(2, l_oStation.Position.Longitude);
Assert.AreEqual("Hallo", l_oStation.StationName);
}
2021-07-12 21:31:46 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestConstruct_InvalidStationName()
{
2023-04-19 12:14:14 +02:00
var l_oStation = new TINK.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "TINK" }).ToList(), PositionFactory.Create(1, 2), null);
2022-09-06 16:08:19 +02:00
Assert.AreEqual("7", l_oStation.Id);
Assert.AreEqual("TINK", string.Join(",", l_oStation.Group));
Assert.AreEqual(1, l_oStation.Position.Latitude);
Assert.AreEqual(2, l_oStation.Position.Longitude);
Assert.AreEqual("", l_oStation.StationName);
}
2021-07-12 21:31:46 +02:00
2022-09-06 16:08:19 +02:00
[Test]
public void TestConstruct_InvalidStationGroup()
{
2023-04-19 12:14:14 +02:00
Assert.Throws<ArgumentException>(() => new TINK.Model.Stations.StationNS.Station("7", null, PositionFactory.Create(1, 2), "Hallo"));
2022-09-06 16:08:19 +02:00
}
2022-09-06 16:08:19 +02:00
[Test]
public void TestConstruct_NoOperator()
{
Assert.That(
2023-04-19 12:14:14 +02:00
new TINK.Model.Stations.StationNS.Station("7", new List<string>(), PositionFactory.Create(1, 2), "Hallo").OperatorData,
2022-09-06 16:08:19 +02:00
Is.Not.Null);
}
}
2021-07-12 21:31:46 +02:00
}