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 TestBookingDeclinedException
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestIsBookingDeclined()
|
|
|
|
|
{
|
|
|
|
|
const string responseText = "OK: BOOKING_REQUEST declined. Max count of 8 occupied bikes has been reached";
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
BookingDeclinedException exception = null;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => BookingDeclinedException.IsBookingDeclined(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.MaxBikesCount,
|
|
|
|
|
Is.EqualTo(8));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestIsBookingDeclined_InvalidNumber()
|
|
|
|
|
{
|
|
|
|
|
const string responseText = "OK: BOOKING_REQUEST declined. Max count of 8 occupied bikes has been reached";
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
BookingDeclinedException exception = null;
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(() => BookingDeclinedException.IsBookingDeclined(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.MaxBikesCount,
|
|
|
|
|
Is.EqualTo(8));
|
2021-07-12 21:31:46 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-12 21:31:46 +02:00
|
|
|
|
}
|