sharee.bike-App/SharedBusinessLogic.Tests/Model/Station/TestStation.cs
2024-04-09 12:53:23 +02:00

49 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using ShareeBike.Model;
namespace SharedBusinessLogic.Tests.Fixtures.Station
{
[TestFixture]
public class TestStation
{
[Test]
public void TestConstruct()
{
var l_oStation = new ShareeBike.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "ShareeBike" }).ToList(), PositionFactory.Create(1, 2), "Hallo");
Assert.That(l_oStation.Id, Is.EqualTo("7"));
Assert.That(string.Join(",", l_oStation.Group), Is.EqualTo("ShareeBike"));
Assert.That(l_oStation.Position.Latitude, Is.EqualTo(1));
Assert.That(l_oStation.Position.Longitude, Is.EqualTo(2));
Assert.That(l_oStation.StationName, Is.EqualTo("Hallo"));
}
[Test]
public void TestConstruct_InvalidStationName()
{
var l_oStation = new ShareeBike.Model.Stations.StationNS.Station("7", new HashSet<string>(new List<string> { "ShareeBike" }).ToList(), PositionFactory.Create(1, 2), null);
Assert.That(l_oStation.Id, Is.EqualTo("7"));
Assert.That(string.Join(",", l_oStation.Group), Is.EqualTo("ShareeBike"));
Assert.That(l_oStation.Position.Latitude, Is.EqualTo(1));
Assert.That(l_oStation.Position.Longitude, Is.EqualTo(2));
Assert.That(l_oStation.StationName, Is.EqualTo(""));
}
[Test]
public void TestConstruct_InvalidStationGroup()
{
Assert.Throws<ArgumentException>(() => new ShareeBike.Model.Stations.StationNS.Station("7", null, PositionFactory.Create(1, 2), "Hallo"));
}
[Test]
public void TestConstruct_NoOperator()
{
Assert.That(
new ShareeBike.Model.Stations.StationNS.Station("7", new List<string>(), PositionFactory.Create(1, 2), "Hallo").OperatorData,
Is.Not.Null);
}
}
}