2022-08-30 15:42:25 +02:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using TINK.Model.Connector.Updater;
|
|
|
|
|
using TINK.Repository.Response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace TestShareeLib.Model.Connector.Updater
|
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestTariffDescriptionFactory
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Name,
|
|
|
|
|
Is.EqualTo("Tester Basic"));
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Id,
|
|
|
|
|
Is.EqualTo(5494));
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["1"].Value, // Free time per session
|
|
|
|
|
Is.EqualTo("1.50 hour(s)/day")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["2"].Value, // FeeEuroPerHour
|
|
|
|
|
Is.EqualTo("10.50 €/hour")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["4"].Value, // Abo euro per month
|
|
|
|
|
Is.EqualTo("920.99 €/month"));
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Name()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Name,
|
|
|
|
|
Is.EqualTo("Tester Basic"));
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Number()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Id,
|
|
|
|
|
Is.EqualTo(5494));
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FreeTimePerSession()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["1"].Value, // Free time per session
|
|
|
|
|
Is.EqualTo("1.50 hour(s)/day")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FeeEuroPerHour()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["2"].Value, // FeeEuroPerHour
|
|
|
|
|
Is.EqualTo("10.50 €/hour")); // Did not contain unit before switching signature from TariffDescription to TariffDescription2.
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_AboEuroPerMonth()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{
|
2022-08-30 15:42:25 +02:00
|
|
|
|
""eur_per_hour"" : ""10.50"",
|
|
|
|
|
""abo_eur_per_month"" : ""920.99"",
|
|
|
|
|
""free_hours"" : ""1.50"",
|
|
|
|
|
""number"" : ""5494"",
|
|
|
|
|
""name"" : ""Tester Basic""
|
|
|
|
|
}");
|
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries["4"].Value, // Abo euro per month
|
|
|
|
|
Is.EqualTo("920.99 €/month"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Name_Empty()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{}");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Name,
|
|
|
|
|
Is.Null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Number_Empty()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{}");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().Id,
|
|
|
|
|
Is.Null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FreeTimePerSession_Empty()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{}");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries.ContainsKey("1"), // Free time per session
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FeeEuroPerHour_Empty()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{}");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries.ContainsKey("2"), // FeeEuroPerHour
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_AboEuroPerMonth_Empty()
|
|
|
|
|
{
|
|
|
|
|
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
|
|
|
|
@"{}");
|
|
|
|
|
|
|
|
|
|
Assert.That(
|
|
|
|
|
tariffDescription.Create().TariffEntries.ContainsKey("4"), // Abo euro per month
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Name_Null()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
TariffDescriptionFactory.Create(null).Name,
|
|
|
|
|
Is.Null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_Number_Null()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
TariffDescriptionFactory.Create(null).Id,
|
|
|
|
|
Is.Null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FreeTimePerSession_Null()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
TariffDescriptionFactory.Create(null).TariffEntries.ContainsKey("1"), // Free time per session
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_FeeEuroPerHour_Null()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
TariffDescriptionFactory.Create(null).TariffEntries.ContainsKey("2"), // FeeEuroPerHour
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestCreateTariffDescription_AboEuroPerMonth_Null()
|
|
|
|
|
{
|
|
|
|
|
Assert.That(
|
|
|
|
|
TariffDescriptionFactory.Create(null).TariffEntries.ContainsKey("4"), // Abo euro per month
|
|
|
|
|
Is.False);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-30 15:42:25 +02:00
|
|
|
|
}
|