2022-01-22 18:16:10 +01:00
|
|
|
|
using NUnit.Framework;
|
2024-04-09 12:53:23 +02:00
|
|
|
|
using ShareeBike.Model;
|
|
|
|
|
using ShareeBike.Model.Map;
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
|
namespace SharedBusinessLogic.Tests.Model.Map
|
2022-01-22 18:16:10 +01:00
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestMapSpan
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCtor()
|
|
|
|
|
{
|
|
|
|
|
var mapSpan = MapSpanFactory.Create(PositionFactory.Create(12, 13), 11);
|
|
|
|
|
|
|
|
|
|
Assert.That(mapSpan.GetType(), Is.EqualTo(typeof(MapSpan)), "Object under test is not of expected type.");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
mapSpan.Radius,
|
|
|
|
|
Is.EqualTo(11.0));
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
mapSpan.Center.Longitude,
|
|
|
|
|
Is.EqualTo(13.0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValid()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
MapSpan.GetIsValid(PositionFactory.Create(14, 99), 2.9),
|
|
|
|
|
Is.True);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValidInvalidCenter()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
MapSpan.GetIsValid(PositionFactory.Create(), 2.9),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValidInvalidCenterNull()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
MapSpan.GetIsValid(null, 2.9),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValidInvalidRadius()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
MapSpan.GetIsValid(PositionFactory.Create(14, 99), double.NaN),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
}
|