2021-07-12 21:31:46 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using TINK.Repository.Exception;
|
|
|
|
|
|
|
|
|
|
namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestNotAtStationException
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestIsNotAtStation()
|
|
|
|
|
{
|
|
|
|
|
const string responseText = "Failure 2178: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed";
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
NotAtStationException exception = null;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
|
|
|
|
Is.EqualTo(true));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => exception.StationNr,
|
|
|
|
|
Is.EqualTo(105));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => exception.Distance,
|
|
|
|
|
Is.EqualTo(15986));
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestIsNotAtStation_InvalidNr()
|
|
|
|
|
{
|
|
|
|
|
const string responseText = "Failure 2177: bike 1545 out of GEO fencing. 15986 meter distance to next station 105. OK: bike 1545 locked confirmed";
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
NotAtStationException exception = null;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => NotAtStationException.IsNotAtStation(responseText, out exception),
|
|
|
|
|
Is.EqualTo(false));
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
}
|