mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
72 lines
2 KiB
C#
72 lines
2 KiB
C#
|
using NUnit.Framework;
|
||
|
using TINK.Repository.Exception;
|
||
|
|
||
|
namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception
|
||
|
{
|
||
|
[TestFixture]
|
||
|
public class TestNotAtStationException
|
||
|
{
|
||
|
[Test]
|
||
|
public void TestIsNotAtStationNumericBikeAndStationId()
|
||
|
{
|
||
|
const string responseText = "Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed";
|
||
|
|
||
|
NotAtStationException exception = null;
|
||
|
|
||
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
||
|
Is.EqualTo(true));
|
||
|
|
||
|
Assert.That(() => exception.StationNr,
|
||
|
Is.EqualTo("105"));
|
||
|
|
||
|
Assert.That(() => exception.Distance,
|
||
|
Is.EqualTo(15986));
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void TestIsNotAtStationAlphanumBikeAndStationId()
|
||
|
{
|
||
|
const string responseText = "Failure 2178: bike KN247 out of GEO fencing. 764 meter distance to next station KN20 . OK: bike KN247 locked confirmed";
|
||
|
|
||
|
NotAtStationException exception = null;
|
||
|
|
||
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
||
|
Is.EqualTo(true));
|
||
|
|
||
|
Assert.That(() => exception.StationNr,
|
||
|
Is.EqualTo("KN20"));
|
||
|
|
||
|
Assert.That(() => exception.Distance,
|
||
|
Is.EqualTo(764));
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void TestIsNotAtStationUnexpected()
|
||
|
{
|
||
|
const string responseText = "Failure 2178: Message from COPRI does not match expectations.";
|
||
|
|
||
|
NotAtStationException exception = null;
|
||
|
|
||
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
||
|
Is.EqualTo(true));
|
||
|
|
||
|
Assert.That(() => exception.StationNr,
|
||
|
Is.EqualTo(string.Empty));
|
||
|
|
||
|
Assert.That(() => exception.Distance,
|
||
|
Is.Null);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void TestIsNotAtStation_InvalidFailureNr()
|
||
|
{
|
||
|
const string responseText = "Failure 2177: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed";
|
||
|
|
||
|
NotAtStationException exception = null;
|
||
|
|
||
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
||
|
Is.EqualTo(false));
|
||
|
}
|
||
|
}
|
||
|
}
|