sharee.bike-App/TestShareeLib/Repository/Request/TestRequestBuilder.cs
Oliver Hauff e321764119 Mini survey added.
Minor fiexes.
2021-08-01 17:24:15 +02:00

70 lines
1.9 KiB
C#

using NUnit.Framework;
using System;
using TINK.Repository.Exception;
using TINK.Repository.Request;
namespace TestShareeLib.Repository.Request
{
[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));
}
}
}