sharee.bike-App/TestShareeLib/Repository/Response/TestBikesAvailableResponse.cs

67 lines
2.5 KiB
C#
Raw Normal View History

2021-05-13 20:09:46 +02:00
using Newtonsoft.Json;
using NUnit.Framework;
using TINK.Model.Repository.Response;
namespace TestTINKLib.Fixtures.ObjectTests.Bike
{
[TestFixture]
public class TestBikesAvailableResponse
{
[Test]
public void TestDeserializeStationEmpty()
{
// Response for bike 231 is a real world answer.
var l_oBikes = JsonConvert.DeserializeObject<BikesAvailableResponse>(@"
{
""apiserver"" : ""https://app.tink-konstanz.de"",
""response"" : ""bikes_available"",
""bikes"" : {
""231"" : {
""bike"" : ""231"",
""description"" : ""Stadtrad"",
""system"" : ""BC"",
""bike_group"" : ""Konrad"",
""station"" : """",
""state"" : ""available"",
""gps"" : ""9.1594501, 47.6749928""
}
},
""copri_version"" : ""3.0.0.0"",
""authcookie"" : """",
""response_state"" : ""OK""
}
");
Assert.IsNull(l_oBikes.bikes[231].station);
}
[Test]
public void TestDeserializeStationInfoMissing()
{
// Response for bike 231 might not be real world answer.
var l_oBikes = JsonConvert.DeserializeObject<BikesAvailableResponse>(@"
{
""apiserver"" : ""https://app.tink-konstanz.de"",
""response"" : ""bikes_available"",
""bikes"" : {
""231"" : {
""bike"" : ""231"",
""description"" : ""Stadtrad"",
""system"" : ""BC"",
""bike_group"" : ""Konrad"",
""state"" : ""available"",
""gps"" : ""9.1594501, 47.6749928""
}
},
""copri_version"" : ""3.0.0.0"",
""authcookie"" : """",
""response_state"" : ""OK""
}
");
Assert.IsNull(l_oBikes.bikes[231].station);
}
}
}