mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
89 lines
2.9 KiB
C#
89 lines
2.9 KiB
C#
using Newtonsoft.Json;
|
|
using NUnit.Framework;
|
|
using TINK.Repository.Response;
|
|
|
|
namespace TestShareeLib.Repository.Response
|
|
{
|
|
[TestFixture]
|
|
public class TestBikeInfoBase
|
|
{
|
|
[Test]
|
|
public void TestAaRide()
|
|
{
|
|
// Response for bike S3X1010 is a real world answer.
|
|
var bike = JsonConvert.DeserializeObject<BikeInfoBase>(@"
|
|
{
|
|
""gps"": {
|
|
""latitude"": ""49.802095"",
|
|
""longitude"": ""9.944987""
|
|
},
|
|
""station"": ""SX9224997072021"",
|
|
""bike"": ""S3X1010"",
|
|
""state"": ""available"",
|
|
""unlock_allowed"": ""1"",
|
|
""authed"": ""0"",
|
|
""bike_type"": {
|
|
""engine"": {
|
|
""manufacturer"": ""sigo""
|
|
},
|
|
""battery"": {
|
|
""backend_accessible"": ""1"",
|
|
""hidden"": ""0"",
|
|
""charge_current_bars"": ""5"",
|
|
""charge_max_bars"": ""5"",
|
|
""charge_current_percent"": ""99""
|
|
}
|
|
},
|
|
""aa_ride"": ""1"",
|
|
""uri_operator"": ""https://shareeapp-sx.copri.eu"",
|
|
""system"": ""sigo"",
|
|
""rental_description"": {
|
|
""tarif_elements"": {
|
|
""1"": [
|
|
""Mietgebühr"",
|
|
""1,50 € / 30 Min ""
|
|
],
|
|
""4"": [
|
|
""Max. Gebühr"",
|
|
""25,00 € / Tag""
|
|
],
|
|
""6"": [
|
|
""Gratis Mietzeit"",
|
|
""30 Min ""
|
|
]
|
|
},
|
|
""id"": ""100"",
|
|
""reserve_timerange"": ""30"",
|
|
""rental_info"": {
|
|
""1"": [
|
|
""Tracking"",
|
|
""Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!""
|
|
],
|
|
""2"": [
|
|
""AAFahrten"",
|
|
""Dieses E-Lastenrad darf nur an der Station zurück gegeben werden an der es ausgeliehen wurde!""
|
|
]
|
|
},
|
|
""name"": ""Basis""
|
|
},
|
|
""description"": ""E-Lastenrad"",
|
|
""lock_state"": ""locked"",
|
|
""bike_group"": [
|
|
""SX300101""
|
|
]}");
|
|
|
|
Assert.That(
|
|
bike.aa_ride,
|
|
Is.EqualTo("1"));
|
|
}
|
|
|
|
[Test]
|
|
public void TestAaRideFalse() =>
|
|
Assert.That(
|
|
JsonConvert.DeserializeObject<BikeInfoBase>(@"
|
|
{
|
|
""aa_ride"": ""0"",
|
|
}").aa_ride,
|
|
Is.EqualTo("0"));
|
|
}
|
|
}
|