sharee.bike-App/TestShareeLib/Repository/TestBookingResponse.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2021-07-12 21:31:46 +02:00
using NUnit.Framework;
using TINK.Repository;
using TINK.Repository.Response;
using static TINK.Repository.CopriCallsMemory;
namespace TestTINKLib.Fixtures.Connector.Response
{
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
[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.");
}
}
2021-07-12 21:31:46 +02:00
}