mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-08-19 08:24:45 +02:00
55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
|
using NUnit.Framework;
|
|||
|
using TINK.Repository;
|
|||
|
using TINK.Repository.Response;
|
|||
|
using static TINK.Repository.CopriCallsMemory;
|
|||
|
|
|||
|
namespace TestTINKLib.Fixtures.Connector.Response
|
|||
|
{
|
|||
|
|
|||
|
[TestFixture]
|
|||
|
public class TestBookingResponse
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void TestDeserialize()
|
|||
|
{
|
|||
|
// Deserialize object and verify.
|
|||
|
var l_oContainer = CopriCallsMemory.DoReserve("8", "b76b97e43a2d76b8499f32e6dd597af8", SampleSets.Set2, 1);
|
|||
|
|
|||
|
Assert.AreEqual(2, l_oContainer.bikes_occupied.Count);
|
|||
|
Assert.AreEqual("3630", l_oContainer.timeCode);
|
|||
|
Assert.AreEqual("OK: requested bike 8", l_oContainer.response_state);
|
|||
|
|
|||
|
// Check first entry which is bike #8
|
|||
|
Assert.AreEqual("3630", l_oContainer.bikes_occupied["87781"].timeCode);
|
|||
|
Assert.AreEqual("occupied", l_oContainer.bikes_occupied["87781"].state);
|
|||
|
Assert.AreEqual("5", l_oContainer.bikes_occupied["87781"].station);
|
|||
|
Assert.AreEqual("Cargo Long", l_oContainer.bikes_occupied["87781"].description);
|
|||
|
Assert.AreEqual("2017-11-28 11:01:51.637747+01", l_oContainer.bikes_occupied["87781"].start_time);
|
|||
|
Assert.AreEqual("8", l_oContainer.bikes_occupied["87781"].bike);
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestGetIsBookingResponseSucceeded()
|
|||
|
{
|
|||
|
// Create response to check
|
|||
|
var l_oResponse = DoReserve(
|
|||
|
"8",
|
|||
|
"4da3044c8657a04ba60e2eaa753bc51a",
|
|||
|
SampleSets.Set2,
|
|||
|
1);
|
|||
|
|
|||
|
Assert.AreEqual(
|
|||
|
"4da3044c8657a04ba60e2eaa753bc51aoiF2kahH",
|
|||
|
l_oResponse.authcookie);
|
|||
|
|
|||
|
Assert.AreEqual(
|
|||
|
"OK: requested bike 8",
|
|||
|
l_oResponse.response_state);
|
|||
|
|
|||
|
Assert.NotNull(
|
|||
|
l_oResponse.GetIsReserveResponseOk("8"),
|
|||
|
"Booking did succeed, response must not be null.");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|