Version 3.0.339

This commit is contained in:
Anja 2022-09-16 11:19:46 +02:00
parent 0468955d49
commit 52c9f6f1d9
43 changed files with 993 additions and 614 deletions

View file

@ -0,0 +1,39 @@
using NUnit.Framework;
using TINK.Repository.Exception;
namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception
{
[TestFixture]
public class TestBookingDeclinedException
{
[Test]
public void TestIsBookingDeclined()
{
const string responseText = "OK: BOOKING_REQUEST declined. Max count of 8 occupied bikes has been reached";
BookingDeclinedException exception = null;
Assert.That(() => BookingDeclinedException.IsBookingDeclined(responseText, out exception),
Is.EqualTo(true));
Assert.That(() => exception.MaxBikesCount,
Is.EqualTo(8));
}
[Test]
public void TestIsBookingDeclined_InvalidNumber()
{
const string responseText = "OK: BOOKING_REQUEST declined. Max count of 8 occupied bikes has been reached";
BookingDeclinedException exception = null;
Assert.That(() => BookingDeclinedException.IsBookingDeclined(responseText, out exception),
Is.EqualTo(true));
Assert.That(() => exception.MaxBikesCount,
Is.EqualTo(8));
}
}
}

View file

@ -0,0 +1,31 @@
using NUnit.Framework;
using TINK.Repository.Exception;
namespace TestTINKLib.Fixtures.ObjectTests.Repository.Exception
{
[TestFixture]
public class TestNoGPSDataException
{
[Test]
public void TestIsNotAtStation()
{
const string responseText = "Failure 2245: No GPS data, state change forbidden.";
NoGPSDataException exception = null;
Assert.That(() => NoGPSDataException.IsNoGPSData(responseText, out exception),
Is.EqualTo(true));
}
[Test]
public void TestIsNotAtStation_InvalidNr()
{
const string responseText = "Failure 2248: No GPS data, state change forbidden.";
NoGPSDataException exception = null;
Assert.That(() => NoGPSDataException.IsNoGPSData(responseText, out exception),
Is.EqualTo(false));
}
}
}

View file

@ -0,0 +1,71 @@
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));
}
}
}