2022-01-22 18:16:10 +01:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using TINK.Model;
|
|
|
|
|
|
|
|
|
|
namespace TestShareeLib.Model
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestPosition
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestEquals()
|
|
|
|
|
{
|
|
|
|
|
var positonA = PositionFactory.Create(12, 13);
|
|
|
|
|
var positonB = PositionFactory.Create(12, 13);
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
|
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
positonA.Equals(positonB),
|
|
|
|
|
Is.True);
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestEqualsNotEquaLong()
|
|
|
|
|
{
|
|
|
|
|
var positonA = PositionFactory.Create(12, 13);
|
|
|
|
|
var positonB = PositionFactory.Create(13, 13);
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
|
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
positonA.Equals(positonB),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestEqualsNotEquaLat()
|
|
|
|
|
{
|
|
|
|
|
var positonA = PositionFactory.Create(12, 13);
|
|
|
|
|
var positonB = PositionFactory.Create(12, 12);
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
|
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
positonA.Equals(positonB),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValid()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
Position.GetIsValid(1, 2),
|
|
|
|
|
Is.True);
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValidInvalidLong()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
Position.GetIsValid(double.NaN, 2),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetIsValidInvalidLat()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
Position.GetIsValid(2, double.NaN),
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-22 18:16:10 +01:00
|
|
|
|
}
|