sharee.bike-App/TestShareeLib/Repository/TestBikesOccupiedResponse.cs
2023-03-08 13:18:54 +01:00

51 lines
2 KiB
C#

using NUnit.Framework;
using TINK.Repository;
using static TINK.Repository.CopriCallsMemory;
namespace TestTINKLib.Fixtures.Connector.Response
{
[TestFixture]
public class TestBikesOccupiedResponse
{
[Test]
public void TestDeserialize()
{
// Deserialize object and verify.
var l_oContainer = GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 1);
Assert.AreEqual(2, l_oContainer.bikes_occupied.Count);
// Check first entry.
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);
// Check first entry.
Assert.AreEqual("2931", l_oContainer.bikes_occupied["87782"].timeCode);
Assert.AreEqual("occupied", l_oContainer.bikes_occupied["87782"].state);
Assert.AreEqual("4", l_oContainer.bikes_occupied["87782"].station);
Assert.AreEqual("Cargo Long", l_oContainer.bikes_occupied["87782"].description);
Assert.AreEqual("2017-11-28 13:06:55.147368+01", l_oContainer.bikes_occupied["87782"].start_time);
Assert.AreEqual("7", l_oContainer.bikes_occupied["87782"].bike);
}
[Test]
public void TestDeserialize_StateReserved()
{
// Deserialize object and verify.
var l_oContainer = CopriCallsMemory.GetBikesOccupied("4da3044c8657a04ba60e2eaa753bc51a", SampleSets.Set2, 2);
Assert.AreEqual(3, l_oContainer.bikes_occupied.Count);
// Check first entry.
Assert.AreEqual("Cargo Long", l_oContainer.bikes_occupied["2360"].description);
Assert.AreEqual("5", l_oContainer.bikes_occupied["2360"].bike);
Assert.AreEqual("reserved", l_oContainer.bikes_occupied["2360"].state);
Assert.AreEqual("4", l_oContainer.bikes_occupied["2360"].station);
}
}
}