2021-07-12 21:31:46 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System;
|
|
|
|
|
using TINK.Repository.Exception;
|
|
|
|
|
using TINK.Repository.Request;
|
|
|
|
|
|
2021-08-01 17:24:15 +02:00
|
|
|
|
namespace TestShareeLib.Repository.Request
|
2021-07-12 21:31:46 +02:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestRequestBuilder
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestDoAuthorize()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"request=authorization&merchant_id=123&user_id=abc%40cde&user_pw=%2B%3F&hw_id=789",
|
|
|
|
|
new RequestBuilder("123").DoAuthorization("abc@cde", "+?", "789"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestDoAuthout()
|
|
|
|
|
{
|
|
|
|
|
Assert.Throws<CallNotRequiredException>(() =>
|
|
|
|
|
new RequestBuilder("123").DoAuthout());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetBikesAvailable()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"request=bikes_available&system=all&authcookie=123",
|
|
|
|
|
new RequestBuilder("123").GetBikesAvailable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetBikesOccupied()
|
|
|
|
|
{
|
|
|
|
|
Assert.Throws< NotSupportedException>(() =>
|
|
|
|
|
new RequestBuilder("123").GetBikesOccupied());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestGetStations()
|
|
|
|
|
{
|
|
|
|
|
Assert.AreEqual(
|
|
|
|
|
"request=stations_available&authcookie=123",
|
|
|
|
|
new RequestBuilder("123").GetStations());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestDoReserve()
|
|
|
|
|
{
|
|
|
|
|
Assert.Throws<NotSupportedException>(() =>
|
|
|
|
|
new RequestBuilder("123").DoReserve("42"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestDoCancelReservation()
|
|
|
|
|
{
|
|
|
|
|
Assert.Throws<NotSupportedException>(() =>
|
|
|
|
|
new RequestBuilder("123").DoCancelReservation("42"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestDoSubmitFeedback()
|
|
|
|
|
{
|
|
|
|
|
Assert.Throws<NotSupportedException>(() =>
|
|
|
|
|
new RequestBuilder("123").DoSubmitFeedback("bike3", "Hi", false));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|