mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-14 22:36:26 +01:00
70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
|
using Newtonsoft.Json;
|
|||
|
using NUnit.Framework;
|
|||
|
using TINK.Repository.Response;
|
|||
|
|
|||
|
namespace TestTINKLib.Fixtures.ObjectTests.Bike
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Moved to TestShareeLib (.Net Core)
|
|||
|
/// </summary>
|
|||
|
[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"" : { ""latitude"": ""9.1594501"", ""longitude"": ""47.6749928"" }
|
|||
|
}
|
|||
|
},
|
|||
|
""copri_version"" : ""4.1.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"" : { ""latitude"": ""9.1594501"", ""longitude"": ""47.6749928"" }
|
|||
|
}
|
|||
|
},
|
|||
|
""copri_version"" : ""4.1.0.0"",
|
|||
|
""authcookie"" : """",
|
|||
|
""response_state"" : ""OK""
|
|||
|
}
|
|||
|
");
|
|||
|
|
|||
|
Assert.IsNull(l_oBikes.bikes[231].station);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|