mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-15 14:46:39 +01:00
75 lines
1.8 KiB
C#
75 lines
1.8 KiB
C#
using NUnit.Framework;
|
|
using ShareeBike.Model;
|
|
|
|
namespace SharedBusinessLogic.Tests.Model
|
|
{
|
|
[TestFixture]
|
|
public class TestPosition
|
|
{
|
|
[Test]
|
|
public void TestEquals()
|
|
{
|
|
var positionA = PositionFactory.Create(12, 13);
|
|
var positionB = PositionFactory.Create(12, 13);
|
|
|
|
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
Assert.That(
|
|
positionA.Equals(positionB),
|
|
Is.True);
|
|
}
|
|
|
|
[Test]
|
|
public void TestEqualsNotEquaLong()
|
|
{
|
|
var positionA = PositionFactory.Create(12, 13);
|
|
var positionB = PositionFactory.Create(13, 13);
|
|
|
|
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
Assert.That(
|
|
positionA.Equals(positionB),
|
|
Is.False);
|
|
}
|
|
|
|
[Test]
|
|
public void TestEqualsNotEquaLat()
|
|
{
|
|
var positionA = PositionFactory.Create(12, 13);
|
|
var positionB = PositionFactory.Create(12, 12);
|
|
|
|
Assert.That(positionA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
Assert.That(positionB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
|
|
|
Assert.That(
|
|
positionA.Equals(positionB),
|
|
Is.False);
|
|
}
|
|
|
|
[Test]
|
|
public void TestGetIsValid()
|
|
{
|
|
Assert.That(
|
|
Position.GetIsValid(1, 2),
|
|
Is.True);
|
|
}
|
|
|
|
[Test]
|
|
public void TestGetIsValidInvalidLong()
|
|
{
|
|
Assert.That(
|
|
Position.GetIsValid(double.NaN, 2),
|
|
Is.False);
|
|
}
|
|
|
|
[Test]
|
|
public void TestGetIsValidInvalidLat()
|
|
{
|
|
Assert.That(
|
|
Position.GetIsValid(2, double.NaN),
|
|
Is.False);
|
|
}
|
|
}
|
|
}
|