sharee.bike-App/TestShareeLib/Services/CopriApi/TestGeneralData.cs

75 lines
2 KiB
C#
Raw Normal View History

2022-01-04 18:54:03 +01:00
using NUnit.Framework;
using System;
2022-01-22 18:16:10 +01:00
using TINK.Model;
using TINK.Model.Map;
2022-01-04 18:54:03 +01:00
using TINK.Services.CopriApi;
namespace TestShareeLib.Services.CopriApi
{
[TestFixture]
public class TestGeneralData
{
[Test]
public void TestCtor()
{
Assert.That(
2022-01-22 18:16:10 +01:00
new GeneralData().MerchantMessage,
2022-01-04 18:54:03 +01:00
Is.EqualTo(""));
Assert.That(
2022-01-22 18:16:10 +01:00
new GeneralData().ApiVersion,
2022-01-04 18:54:03 +01:00
Is.EqualTo(new Version(0,0)));
2022-01-22 18:16:10 +01:00
Assert.That(
new GeneralData().InitialMapSpan?.IsValid,
Is.False,
"Object not not be null but invalid.");
2022-01-04 18:54:03 +01:00
}
[Test]
public void TestMessage()
{
Assert.That(
2022-01-22 18:16:10 +01:00
new GeneralData(
MapSpanFactory.Create(),
"Hello",
2022-01-22 18:28:01 +01:00
null,
new ResourceUrls()).MerchantMessage,
2022-01-04 18:54:03 +01:00
Is.EqualTo("Hello"));
}
[Test]
public void TestVersion()
{
Assert.That(
2022-01-22 18:16:10 +01:00
new GeneralData(
MapSpanFactory.Create(),
null,
2022-01-22 18:28:01 +01:00
new Version(1,2),
new ResourceUrls()).ApiVersion,
2022-01-04 18:54:03 +01:00
Is.EqualTo(new Version(1, 2)));
}
2022-01-22 18:16:10 +01:00
[Test]
public void TestInitialMapSpan()
{
Assert.That(
new GeneralData(
MapSpanFactory.Create(PositionFactory.Create(0, 8), 15),
null,
2022-01-22 18:28:01 +01:00
new Version(1, 2),
new ResourceUrls()).InitialMapSpan.Center.Longitude,
2022-01-22 18:16:10 +01:00
Is.EqualTo(8));
Assert.That(
new GeneralData(
MapSpanFactory.Create(PositionFactory.Create(0, 8), 15),
null,
2022-01-22 18:28:01 +01:00
new Version(1, 2),
new ResourceUrls()).InitialMapSpan.Radius,
2022-01-22 18:16:10 +01:00
Is.EqualTo(15));
}
2022-01-04 18:54:03 +01:00
}
}