mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 03:27:29 +02:00
3.0.271
This commit is contained in:
parent
e0c75d5b37
commit
f38b516d25
57 changed files with 12835 additions and 9925 deletions
738
TestShareeLib/Model/Connector/TestTextToTypeHelper.cs
Normal file
738
TestShareeLib/Model/Connector/TestTextToTypeHelper.cs
Normal file
|
@ -0,0 +1,738 @@
|
|||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TINK.Model.Bike;
|
||||
using TINK.Model.Connector;
|
||||
using TINK.Repository.Exception;
|
||||
using TINK.Repository.Response;
|
||||
using JsonConvertRethrow = TINK.Repository.Response.JsonConvertRethrow;
|
||||
|
||||
namespace TestTINKLib.Fixtures.Connector
|
||||
{
|
||||
|
||||
[TestFixture]
|
||||
public class TestTextToTypeHelper
|
||||
{
|
||||
[Test]
|
||||
public void TestGetWheelType_InvalidDescription()
|
||||
{
|
||||
var l_oInfo = new BikeInfoBase();
|
||||
|
||||
// Verify prerequisites
|
||||
Assert.IsNull(l_oInfo.description);
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsNull(TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetWheelType()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""2"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Long"",
|
||||
""gps"" : { ""latitude"": ""47.6612083333"", ""longitude"": ""9.16637533333"" },
|
||||
""station"" : ""9"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(WheelType.Two, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""11"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Trike"",
|
||||
""gps"" : { ""latitude"": ""47.665051"", ""longitude"": ""9.174096"" },
|
||||
""station"" : ""1"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(WheelType.Trike, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Demo Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(WheelType.Two, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(WheelType.Two, TextToTypeHelper.GetWheelType(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetTypeOfBike_InvalidDescription()
|
||||
{
|
||||
var l_oInfo = new BikeInfoBase();
|
||||
|
||||
// Verify prerequisites
|
||||
Assert.IsNull(l_oInfo.description);
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsNull(TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetTypeOfBike()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""2"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Long"",
|
||||
""gps"" : { ""latitude"": ""47.6612083333"", ""longitude"": ""9.16637533333"" },
|
||||
""station"" : ""9"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(TypeOfBike.Cargo, TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""11"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Trike"",
|
||||
""gps"" : { ""latitude"": ""47.665051"", ""longitude"": ""9.174096"" },
|
||||
""station"" : ""1"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(TypeOfBike.Cargo, TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Demo Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(TypeOfBike.Citybike, TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.AreEqual(TypeOfBike.Citybike, TextToTypeHelper.GetTypeOfBike(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetState_InvalidDescription()
|
||||
{
|
||||
var l_oInfo = new BikeInfoBase();
|
||||
|
||||
// Verify prerequisites
|
||||
Assert.IsNull(l_oInfo.state);
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.Throws<InvalidResponseException<BikeInfoBase>>(() => TextToTypeHelper.GetState(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsDemo()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""2"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Long"",
|
||||
""gps"" : { ""latitude"": ""47.6612083333"", ""longitude"": ""9.16637533333"" },
|
||||
""station"" : ""9"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""11"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""description"" : ""Cargo Trike"",
|
||||
""gps"" : { ""latitude"": ""47.665051"", ""longitude"": ""9.174096"" },
|
||||
""station"" : ""1"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Demo Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsTrue(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(@"
|
||||
{
|
||||
""bike"" : ""51"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""description"" : ""Stadtrad"",
|
||||
""gps"" : { ""latitude"": ""47.657766"", ""longitude"": ""9.176094"" },
|
||||
""station"" : ""8"",
|
||||
""state"" : ""available""
|
||||
}");
|
||||
|
||||
// Verify behaviour of member.
|
||||
Assert.IsFalse(TextToTypeHelper.GetIsDemo(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetPosition()
|
||||
{
|
||||
Assert.AreEqual(1.234d, TextToTypeHelper.GetPosition(JsonConvert.DeserializeObject<Position>("{ \"latitude\" : \"1.234\", \"longitude\" : \"5.678\"}")).Latitude);
|
||||
Assert.AreEqual(5.678d, TextToTypeHelper.GetPosition(JsonConvert.DeserializeObject<Position>("{ \"latitude\" : \"1.234\", \"longitude\" : \"5.678\"}")).Longitude);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMapSpan()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<ResponseBase>(@"
|
||||
{
|
||||
""init_map"": {
|
||||
""radius"": ""2.9"",
|
||||
""center"": {
|
||||
""longitude"": ""7.825490"",
|
||||
""latitude"": ""47.976634""
|
||||
}
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
TextToTypeHelper.GetMapSpan(response.init_map).Radius,
|
||||
Is.EqualTo(2.9));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMapSpan_EmptyRadius()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<ResponseBase>(@"
|
||||
{
|
||||
""init_map"": {
|
||||
""radius"": """",
|
||||
""center"": {
|
||||
""longitude"": ""7.825490"",
|
||||
""latitude"": ""47.976634""
|
||||
}
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
TextToTypeHelper.GetMapSpan(response.init_map).IsValid,
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMapSpan_EmptyPos()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<ResponseBase>(@"
|
||||
{
|
||||
""init_map"": {
|
||||
""radius"": """",
|
||||
""center"": {
|
||||
""longitude"": """",
|
||||
""latitude"": ""47.976634""
|
||||
}
|
||||
}
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
TextToTypeHelper.GetMapSpan(response.init_map).IsValid,
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMapSpan_Empty()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<ResponseBase>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
TextToTypeHelper.GetMapSpan(response.init_map).IsValid,
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationGroup_Invalid()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""gps"" : { ""latitude"": ""47.6586936667"", ""longitude"": ""9.16863116667"" }
|
||||
}");
|
||||
|
||||
// From COPRI version v4.1 no more exception thrown.
|
||||
Assert.That(l_oStation.GetGroup().Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationGroup_TINK()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""station_group"" : [ ""TINK"" ],
|
||||
""gps"" : { ""latitude"": ""47.6586936667"", ""longitude"": ""9.16863116667"" }
|
||||
}");
|
||||
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oStation.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetStationGroup_TINKAndKonrad()
|
||||
{
|
||||
var l_oStation = JsonConvertRethrow.DeserializeObject<StationsAvailableResponse.StationInfo>(
|
||||
@"{
|
||||
""station"" : ""4"",
|
||||
""station_group"": [ ""TINK"", ""Konrad"" ],
|
||||
""gps"" : { ""latitude"": ""47.6586936667"", ""longitude"": ""9.16863116667"" }
|
||||
}");
|
||||
|
||||
Assert.AreEqual("TINK,Konrad", string.Join(",", l_oStation.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikeGroup_TINK()
|
||||
{
|
||||
var l_oBike = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(
|
||||
@"{
|
||||
""state"" : ""available"",
|
||||
""bike"" : ""18"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""station"" : ""13"",
|
||||
}");
|
||||
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oBike.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikeGroup_TINKCopri()
|
||||
{
|
||||
var l_oBike = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(
|
||||
@"{
|
||||
""state"" : ""available"",
|
||||
""bike"" : ""18"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""system"" : ""BC"",
|
||||
""station"" : ""13"",
|
||||
}");
|
||||
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oBike.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikeGroup_TINKSMS()
|
||||
{
|
||||
var l_oBike = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(
|
||||
@"{
|
||||
""state"" : ""available"",
|
||||
""bike"" : ""18"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""system"" : ""Lock"",
|
||||
""station"" : ""13"",
|
||||
}");
|
||||
|
||||
Assert.AreEqual("TINK", string.Join(",", l_oBike.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikeGroup_Konrad()
|
||||
{
|
||||
var l_oBike = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(
|
||||
@"{
|
||||
""state"" : ""available"",
|
||||
""bike"" : ""18"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""bike_group"" : [ ""Konrad"" ],
|
||||
""station"" : ""13"",
|
||||
}");
|
||||
|
||||
Assert.AreEqual("Konrad", string.Join(",", l_oBike.GetGroup().ToArray()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBikeGroup_Null()
|
||||
{
|
||||
var l_oBike = JsonConvertRethrow.DeserializeObject<BikeInfoBase>(
|
||||
@"{
|
||||
""state"" : ""available"",
|
||||
""bike"" : ""18"",
|
||||
""description"" : ""Cargo Long"",
|
||||
""station"" : ""13"",
|
||||
}");
|
||||
|
||||
Assert.AreEqual(0, l_oBike.GetGroup().ToArray().Length);
|
||||
}
|
||||
[Test]
|
||||
public void TestGetAuthGroup()
|
||||
{
|
||||
// User group was of format [ ""TINK"", ""Konrad"" ] in early day...
|
||||
// Since COPRI 4.1 use group is no more used.
|
||||
// Groups are of format <OperatorId>_<BikeType> for this user group would be like below if it would be used.
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""response"" : ""authorization"",
|
||||
""authcookie"" : ""4da3044c8657a04ba60e2eaa753bc51a"",
|
||||
""user_group"" : [ ""KN_300102"", ""KN_300101"" ],
|
||||
""response_state"" : ""OK"",
|
||||
""apiserver"" : ""https://tinkwwp.copri-bike.de""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(2, response.GetGroup().ToList().Count);
|
||||
Assert.AreEqual($"KN_300102", response.GetGroup().ToList()[0]);
|
||||
Assert.AreEqual($"KN_300101", response.GetGroup().ToList()[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetGroupString()
|
||||
{
|
||||
// From COPRI version v4.1 no more exception thrown.
|
||||
Assert.That(TextToTypeHelper.GetGroup(new string[0]).Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetGroupString_Null()
|
||||
{
|
||||
// From COPRI version v4.1 no more exception thrown.
|
||||
Assert.That(TextToTypeHelper.GetGroup((string[])null).Count(), Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetGroupString_Roundtrip()
|
||||
{
|
||||
Assert.AreEqual("Tunk,Unk", TextToTypeHelper.GetGroup(TextToTypeHelper.GetGroup(new [] { "Tunk", "Unk" })));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetUserKey()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""total_price"": ""0.00"",
|
||||
""gps"" : { ""latitude"": ""47.6586133"", ""longitude"": ""9.16864"" },
|
||||
""unit_price"": ""3.00"",
|
||||
""K_u"": ""[99, 104, 120, 121, 63, 99, -10, -110, 94, 70, 15, -112, -6, 101, 117, -90, -113, -54, -90, -95, 0, 0, 0, 0]"",
|
||||
""tariff_description"": {""name"" : ""TINK Basic""},
|
||||
""end_time"": ""2020-04-07 16:55:18"",
|
||||
""K_seed"": ""[-18, -80, 20, -90, 3, 69, 96, 4, -35, 75, -95, 102, 7, 121, -122, 15]"",
|
||||
""system"": ""Ilockit"",
|
||||
""bike"": ""16"",
|
||||
""computed_hours"": ""0"",
|
||||
""request_time"": ""2020-04-07 16:55:06.823436+02"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""K_a"": ""[-19, 29, -60, 29, 35, -121, -69, 93, 27, -122, 107, -127, -30, 74, 82, 12, 4, -20, 40, 16, 0, 0, 0, 0]"",
|
||||
""state"": ""occupied"",
|
||||
""real_hours"": ""0"",
|
||||
""station"" : ""7"",
|
||||
""start_time"": ""2020-04-07 16:55:17.786551+02"",
|
||||
""description"": ""Cargo Long""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(
|
||||
99,
|
||||
TextToTypeHelper.GetUserKey(l_oInfo)[0]);
|
||||
Assert.AreEqual(
|
||||
104,
|
||||
TextToTypeHelper.GetUserKey(l_oInfo)[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetAdminKey()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""total_price"": ""0.00"",
|
||||
""gps"" : { ""latitude"": ""47.6586133"", ""longitude"": ""9.16864"" },
|
||||
""unit_price"": ""3.00"",
|
||||
""K_u"": ""[99, 104, 120, 121, 63, 99, -10, -110, 94, 70, 15, -112, -6, 101, 117, -90, -113, -54, -90, -95, 0, 0, 0, 0]"",
|
||||
""tariff_description"": {""name"" : ""TINK Basic""},
|
||||
""end_time"": ""2020-04-07 16:55:18"",
|
||||
""K_seed"": ""[-18, -80, 20, -90, 3, 69, 96, 4, -35, 75, -95, 102, 7, 121, -122, 15]"",
|
||||
""system"": ""Ilockit"",
|
||||
""bike"": ""16"",
|
||||
""computed_hours"": ""0"",
|
||||
""request_time"": ""2020-04-07 16:55:06.823436+02"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""K_a"": ""[-19, 29, -60, 29, 35, -121, -69, 93, 27, -122, 107, -127, -30, 74, 82, 12, 4, -20, 40, 16, 0, 0, 0, 0]"",
|
||||
""state"": ""occupied"",
|
||||
""real_hours"": ""0"",
|
||||
""station"" : ""7"",
|
||||
""start_time"": ""2020-04-07 16:55:17.786551+02"",
|
||||
""description"": ""Cargo Long""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(
|
||||
237,
|
||||
TextToTypeHelper.GetAdminKey(l_oInfo)[0]);
|
||||
Assert.AreEqual(
|
||||
29,
|
||||
TextToTypeHelper.GetAdminKey(l_oInfo)[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetSeed()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""total_price"": ""0.00"",
|
||||
""gps"" : { ""latitude"": ""47.6586133"", ""longitude"": ""9.16864"" },
|
||||
""unit_price"": ""3.00"",
|
||||
""K_u"": ""[99, 104, 120, 121, 63, 99, -10, -110, 94, 70, 15, -112, -6, 101, 117, -90, -113, -54, -90, -95, 0, 0, 0, 0]"",
|
||||
""tariff_description"": {""name"" : ""TINK Basic""},
|
||||
""end_time"": ""2020-04-07 16:55:18"",
|
||||
""K_seed"": ""[-18, -80, 20, -90, 3, 69, 96, 4, -35, 75, -95, 102, 7, 121, -122, 15]"",
|
||||
""system"": ""Ilockit"",
|
||||
""bike"": ""16"",
|
||||
""computed_hours"": ""0"",
|
||||
""request_time"": ""2020-04-07 16:55:06.823436+02"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""K_a"": ""[-19, 29, -60, 29, 35, -121, -69, 93, 27, -122, 107, -127, -30, 74, 82, 12, 4, -20, 40, 16, 0, 0, 0, 0]"",
|
||||
""state"": ""occupied"",
|
||||
""real_hours"": ""0"",
|
||||
""station"" : ""7"",
|
||||
""start_time"": ""2020-04-07 16:55:17.786551+02"",
|
||||
""description"": ""Cargo Long""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(
|
||||
238,
|
||||
TextToTypeHelper.GetSeed(l_oInfo)[0]);
|
||||
Assert.AreEqual(
|
||||
176,
|
||||
TextToTypeHelper.GetSeed(l_oInfo)[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetSeedUserKeyAdminKey_Invalid()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""total_price"": ""0.00"",
|
||||
""gps"" : { ""latitude"": ""47.6586133"", ""longitude"": ""9.16864"" },
|
||||
""unit_price"": ""3.00"",
|
||||
""K_u"": ""[]"",
|
||||
""tariff_description"": {""name"" : ""TINK Basic""},
|
||||
""end_time"": ""2020-04-07 16:55:18"",
|
||||
""K_seed"": ""[-18a, -80, 20, -90, 3, 69, 96, 4, -35, 75, -95, 102, 7, 121, -122, 15]"",
|
||||
""system"": ""Ilockit"",
|
||||
""bike"": ""16"",
|
||||
""computed_hours"": ""0"",
|
||||
""request_time"": ""2020-04-07 16:55:06.823436+02"",
|
||||
""bike_group"" : [ ""TINK"" ],
|
||||
""K_a"": ""{-19, 29, -60, 29, 35, -121, -69, 93, 27, -122, 107, -127, -30, 74, 82, 12, 4, -20, 40, 16, 0, 0, 0, 0}"",
|
||||
""state"": ""occupied"",
|
||||
""real_hours"": ""0"",
|
||||
""station"" : ""7"",
|
||||
""start_time"": ""2020-04-07 16:55:17.786551+02"",
|
||||
""description"": ""Cargo Long""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TextToTypeHelper.GetSeed(l_oInfo).Length);
|
||||
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TextToTypeHelper.GetUserKey(l_oInfo).Length);
|
||||
|
||||
Assert.AreEqual(
|
||||
0,
|
||||
TextToTypeHelper.GetAdminKey(l_oInfo).Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBluetoothLockId_FromBikeInfo_Invalid()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.AreEqual(0, TextToTypeHelper.GetBluetoothLockId (l_oInfo));
|
||||
|
||||
l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""Ilockit_ID"": """"
|
||||
}");
|
||||
|
||||
Assert.AreEqual(0, TextToTypeHelper.GetBluetoothLockId(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBluetoothLockId_FromBikeInfo()
|
||||
{
|
||||
var l_oInfo = JsonConvertRethrow.DeserializeObject<BikeInfoReservedOrBooked>(@"
|
||||
{
|
||||
""Ilockit_ID"": ""ISHAREIT-132""
|
||||
}");
|
||||
|
||||
Assert.AreEqual(
|
||||
132,
|
||||
TextToTypeHelper.GetBluetoothLockId(l_oInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBluetoothLockId_FromString_Invalid()
|
||||
{
|
||||
Assert.AreEqual(0, TextToLockItTypeHelper.GetBluetoothLockId((string)null));
|
||||
Assert.AreEqual(0, TextToLockItTypeHelper.GetBluetoothLockId(""));
|
||||
|
||||
Assert.AreEqual(0, TextToLockItTypeHelper.GetBluetoothLockId("HubbaBubba"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetBluetoothLockId_FromString()
|
||||
{
|
||||
Assert.AreEqual(
|
||||
132,
|
||||
TextToLockItTypeHelper.GetBluetoothLockId("ISHAREIT-132"));
|
||||
|
||||
Assert.AreEqual(
|
||||
132,
|
||||
TextToLockItTypeHelper.GetBluetoothLockId("ISHAREIT+132"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetCopriVersion()
|
||||
{
|
||||
var version = JsonConvertRethrow.DeserializeObject<CopriVersion>(@"
|
||||
{
|
||||
""copri_version"": ""4.3.2.1""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
version.GetCopriVersion(),
|
||||
Is.EqualTo(new Version(4,3,2,1)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetCopriVersion_Invald()
|
||||
{
|
||||
var version = JsonConvertRethrow.DeserializeObject<CopriVersion>(@"
|
||||
{
|
||||
""copri_version"": ""hellO""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => version.GetCopriVersion(),
|
||||
Throws.InstanceOf<InvalidResponseException>());
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestGetCopriVersion_Null()
|
||||
{
|
||||
|
||||
Assert.That(
|
||||
() => TextToTypeHelper.GetCopriVersion(null),
|
||||
Throws.InstanceOf<InvalidResponseException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetCopriVersion_NotContained()
|
||||
{
|
||||
var version = JsonConvertRethrow.DeserializeObject<CopriVersion>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => version.GetCopriVersion(),
|
||||
Throws.InstanceOf<InvalidResponseException>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""1""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_No()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""0""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Invalid()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
""agb_checked"" : ""ä""
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsAgbAcknowledged_Empty()
|
||||
{
|
||||
var response = JsonConvertRethrow.DeserializeObject<AuthorizationResponse>(@"
|
||||
{
|
||||
}");
|
||||
|
||||
Assert.That(
|
||||
() => response.GetIsAgbAcknowledged(),
|
||||
Is.False);
|
||||
}
|
||||
}
|
||||
}
|
58
TestShareeLib/Model/Map/TestMapSpan.cs
Normal file
58
TestShareeLib/Model/Map/TestMapSpan.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Map;
|
||||
|
||||
namespace TestShareeLib.Model.Map
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestMapSpan
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var mapSpan = MapSpanFactory.Create(PositionFactory.Create(12, 13), 11);
|
||||
|
||||
Assert.That(mapSpan.GetType(), Is.EqualTo(typeof(MapSpan)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
mapSpan.Radius,
|
||||
Is.EqualTo(11.0));
|
||||
|
||||
Assert.That(
|
||||
mapSpan.Center.Longitude,
|
||||
Is.EqualTo(13.0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValid()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpan.GetIsValid(PositionFactory.Create(14, 99), 2.9),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValidInvalidCenter()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpan.GetIsValid(PositionFactory.Create(), 2.9),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValidInvalidCenterNull()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpan.GetIsValid(null, 2.9),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValidInvalidRadius()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpan.GetIsValid(PositionFactory.Create(14, 99), double.NaN),
|
||||
Is.False);
|
||||
}
|
||||
}
|
||||
}
|
26
TestShareeLib/Model/Map/TestMapSpanFactory.cs
Normal file
26
TestShareeLib/Model/Map/TestMapSpanFactory.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Map;
|
||||
|
||||
namespace TestShareeLib.Model.Map
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestMapSpanFactory
|
||||
{
|
||||
[Test]
|
||||
public void TestCreatePositon()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpanFactory.Create(PositionFactory.Create(12, 13), 11).GetType(),
|
||||
Is.EqualTo(typeof(MapSpan)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateNullPositon()
|
||||
{
|
||||
Assert.That(
|
||||
MapSpanFactory.Create().GetType(),
|
||||
Is.EqualTo(typeof(NullMapSpan)));
|
||||
}
|
||||
}
|
||||
}
|
29
TestShareeLib/Model/Map/TestNullMapSpan.cs
Normal file
29
TestShareeLib/Model/Map/TestNullMapSpan.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model.Map;
|
||||
|
||||
namespace TestShareeLib.Model.Map
|
||||
{
|
||||
[TestFixture]
|
||||
internal class TestNullMapSpan
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var mapSpan = MapSpanFactory.Create();
|
||||
|
||||
Assert.That(mapSpan.GetType(), Is.EqualTo(typeof(NullMapSpan)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
mapSpan.IsValid,
|
||||
Is.False);
|
||||
|
||||
Assert.That(
|
||||
mapSpan.Radius,
|
||||
Is.EqualTo(double.NaN));
|
||||
|
||||
Assert.That(
|
||||
mapSpan.Center.Longitude,
|
||||
Is.EqualTo(double.NaN));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,43 +2,43 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using TestFramework;
|
||||
using TestShareeLib;
|
||||
using TINK.Model.State;
|
||||
|
||||
|
||||
namespace TestTINKLib.Fixtures.Bike
|
||||
namespace TestTINKLib.Fixtures.State
|
||||
{
|
||||
|
||||
|
||||
[TestFixture]
|
||||
public class TestStateBookedInfoSerializeJSON
|
||||
public class TestStateReInquestedfoSerializeJSON
|
||||
{
|
||||
[Test]
|
||||
public void TestSerializeJSON()
|
||||
{
|
||||
// Create object to test.
|
||||
var l_oInfoSource = new StateOccupiedInfo(
|
||||
new DateTime(2017, 09, 20, 23, 05, 0),
|
||||
"Heinz@mueller",
|
||||
"17 xxb");
|
||||
var l_oReservedInfo = new StateRequestedInfo(
|
||||
() => new DateTime(2017, 09, 20),
|
||||
new DateTime(2017, 09, 19),
|
||||
"a@b",
|
||||
"372");
|
||||
|
||||
// Serialize object
|
||||
// Serialize object and verify.
|
||||
var l_oDetected = JsonConvert.SerializeObject(l_oInfoSource);
|
||||
const string EXPECTED = @"
|
||||
{
|
||||
""From"":""2017 - 09 - 20T23: 05:00"",
|
||||
""MailAddress"":""Heinz@mueller"",
|
||||
""Code"":""17 xxb""
|
||||
}";
|
||||
var l_oDetected = JsonConvert.SerializeObject(l_oReservedInfo);
|
||||
// Verify xml
|
||||
const string EXPECTED = @"{""From"":""2017 - 09 - 19T00: 00:00"",""MailAddress"":""a @b"",""Code"":""372""}";
|
||||
Assert.AreEqual(
|
||||
TestHelper.PrepareXmlForStringCompare(EXPECTED.Replace("\n", string.Empty).Replace("\r", string.Empty)),
|
||||
TestHelper.PrepareXmlForStringCompare(l_oDetected.Replace("\n", string.Empty).Replace("\r", string.Empty)));
|
||||
TestHelper.PrepareXmlForStringCompare(EXPECTED),
|
||||
TestHelper.PrepareXmlForStringCompare(l_oDetected));
|
||||
|
||||
// Deserialize object and verify.
|
||||
var l_oInfoTarget = JsonConvert.DeserializeObject<StateOccupiedInfo>(l_oDetected);
|
||||
Assert.AreEqual(InUseStateEnum.Booked, l_oInfoTarget.Value);
|
||||
Assert.AreEqual("Heinz@mueller", l_oInfoTarget.MailAddress);
|
||||
Assert.AreEqual("17 xxb", l_oInfoTarget.Code);
|
||||
Assert.AreEqual(new DateTime(2017, 9, 20, 23, 5, 0), l_oInfoTarget.From);
|
||||
// Deserialize object.
|
||||
var l_oInfoTarge = JsonConvert.DeserializeObject<StateRequestedInfo>(l_oDetected);
|
||||
|
||||
// Verify state.
|
||||
Assert.AreEqual(InUseStateEnum.Reserved, l_oInfoTarge.Value);
|
||||
Assert.AreEqual("a@b", l_oInfoTarge.MailAddress);
|
||||
Assert.AreEqual("372", l_oInfoTarge.Code);
|
||||
Assert.AreEqual(new DateTime(2017, 9, 19, 0, 0, 0), l_oInfoTarge.From);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
28
TestShareeLib/Model/TestNullPosition.cs
Normal file
28
TestShareeLib/Model/TestNullPosition.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestNullPosition
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
var positon = PositionFactory.Create();
|
||||
Assert.That(positon.GetType(), Is.EqualTo(typeof(NullPostion)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positon.IsValid,
|
||||
Is.False);
|
||||
|
||||
Assert.That(
|
||||
positon.Longitude,
|
||||
Is.EqualTo(double.NaN));
|
||||
|
||||
Assert.That(
|
||||
positon.Latitude,
|
||||
Is.EqualTo(double.NaN));
|
||||
}
|
||||
}
|
||||
}
|
75
TestShareeLib/Model/TestPosition.cs
Normal file
75
TestShareeLib/Model/TestPosition.cs
Normal file
|
@ -0,0 +1,75 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestPosition
|
||||
{
|
||||
[Test]
|
||||
public void TestEquals()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(12, 13);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEqualsNotEquaLong()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(13, 13);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEqualsNotEquaLat()
|
||||
{
|
||||
var positonA = PositionFactory.Create(12, 13);
|
||||
var positonB = PositionFactory.Create(12, 12);
|
||||
|
||||
Assert.That(positonA.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
Assert.That(positonB.GetType(), Is.EqualTo(typeof(Position)), "Object under test is not of expected type.");
|
||||
|
||||
Assert.That(
|
||||
positonA.Equals(positonB),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValid()
|
||||
{
|
||||
Assert.That(
|
||||
Position.GetIsValid(1, 2),
|
||||
Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValidInvalidLong()
|
||||
{
|
||||
Assert.That(
|
||||
Position.GetIsValid(double.NaN, 2),
|
||||
Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetIsValidInvalidLat()
|
||||
{
|
||||
Assert.That(
|
||||
Position.GetIsValid(2, double.NaN),
|
||||
Is.False);
|
||||
}
|
||||
}
|
||||
}
|
28
TestShareeLib/Model/TestPositionFactory.cs
Normal file
28
TestShareeLib/Model/TestPositionFactory.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestPositionFactory
|
||||
{
|
||||
[Test]
|
||||
public void TestCreatePosition()
|
||||
{
|
||||
Assert.That(
|
||||
PositionFactory.Create(9.55, 8.33).GetType(),
|
||||
Is.EqualTo(typeof(Position)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateNullPosition()
|
||||
{
|
||||
Assert.That(
|
||||
PositionFactory.Create().GetType(),
|
||||
Is.EqualTo(typeof(NullPostion)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using TINK.Model;
|
||||
using TINK.Model.Map;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
namespace TestShareeLib.Services.CopriApi
|
||||
|
@ -11,19 +13,27 @@ namespace TestShareeLib.Services.CopriApi
|
|||
public void TestCtor()
|
||||
{
|
||||
Assert.That(
|
||||
new GeneralData(null, null).MerchantMessage,
|
||||
new GeneralData().MerchantMessage,
|
||||
Is.EqualTo(""));
|
||||
|
||||
Assert.That(
|
||||
new GeneralData(null, null).ApiVersion,
|
||||
new GeneralData().ApiVersion,
|
||||
Is.EqualTo(new Version(0,0)));
|
||||
|
||||
Assert.That(
|
||||
new GeneralData().InitialMapSpan?.IsValid,
|
||||
Is.False,
|
||||
"Object not not be null but invalid.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMessage()
|
||||
{
|
||||
Assert.That(
|
||||
new GeneralData("Hello", null).MerchantMessage,
|
||||
new GeneralData(
|
||||
MapSpanFactory.Create(),
|
||||
"Hello",
|
||||
null).MerchantMessage,
|
||||
Is.EqualTo("Hello"));
|
||||
}
|
||||
|
||||
|
@ -31,8 +41,30 @@ namespace TestShareeLib.Services.CopriApi
|
|||
public void TestVersion()
|
||||
{
|
||||
Assert.That(
|
||||
new GeneralData(null, new Version(1,2)).ApiVersion,
|
||||
new GeneralData(
|
||||
MapSpanFactory.Create(),
|
||||
null,
|
||||
new Version(1,2)).ApiVersion,
|
||||
Is.EqualTo(new Version(1, 2)));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestInitialMapSpan()
|
||||
{
|
||||
Assert.That(
|
||||
new GeneralData(
|
||||
MapSpanFactory.Create(PositionFactory.Create(0, 8), 15),
|
||||
null,
|
||||
new Version(1, 2)).InitialMapSpan.Center.Longitude,
|
||||
Is.EqualTo(8));
|
||||
|
||||
Assert.That(
|
||||
new GeneralData(
|
||||
MapSpanFactory.Create(PositionFactory.Create(0, 8), 15),
|
||||
null,
|
||||
new Version(1, 2)).InitialMapSpan.Radius,
|
||||
Is.EqualTo(15));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using TINK.Model.Map;
|
||||
using TINK.Model.Services.CopriApi;
|
||||
using TINK.Services.CopriApi;
|
||||
|
||||
|
@ -19,7 +21,10 @@ namespace TestShareeLib.Services.CopriApi
|
|||
public void TestGeneralData()
|
||||
{
|
||||
Assert.That(
|
||||
new Result<object>(typeof(TestResult), new TestResult(), new GeneralData("Hello")).GeneralData.MerchantMessage,
|
||||
new Result<object>(typeof(TestResult), new TestResult(), new GeneralData(
|
||||
MapSpanFactory.Create(),
|
||||
"Hello",
|
||||
new Version(0, 0))).GeneralData.MerchantMessage,
|
||||
Is.EqualTo("Hello"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31229.75
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31912.275
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestShareeLib", "TestShareeLib.csproj", "{FE15D644-F638-48B8-AD63-A3A9D01A8033}"
|
||||
EndProject
|
||||
|
@ -9,6 +9,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TINKLib", "..\TINKLib\TINKL
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFramework", "..\TestFramework\TestFramework.csproj", "{F86692DF-BCB9-4236-8337-04CB65EE4256}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LockItBLE", "..\LockItBLE\LockItBLE.csproj", "{2F7F8786-3655-452E-A697-878C86EFD56A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LockItShared", "..\LockItShared\LockItShared.csproj", "{9E828F60-CC79-4C5D-B647-F15552104524}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -27,6 +31,14 @@ Global
|
|||
{F86692DF-BCB9-4236-8337-04CB65EE4256}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F86692DF-BCB9-4236-8337-04CB65EE4256}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F86692DF-BCB9-4236-8337-04CB65EE4256}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2F7F8786-3655-452E-A697-878C86EFD56A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2F7F8786-3655-452E-A697-878C86EFD56A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2F7F8786-3655-452E-A697-878C86EFD56A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2F7F8786-3655-452E-A697-878C86EFD56A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E828F60-CC79-4C5D-B647-F15552104524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E828F60-CC79-4C5D-B647-F15552104524}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E828F60-CC79-4C5D-B647-F15552104524}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E828F60-CC79-4C5D-B647-F15552104524}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue