mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-11-05 10:36:30 +01:00
223 lines
6.2 KiB
C#
223 lines
6.2 KiB
C#
using NUnit.Framework;
|
|
using ShareeBike.Model.Bikes.BikeInfoNS;
|
|
using ShareeBike.ViewModel.Bikes.Bike;
|
|
|
|
namespace SharedBusinessLogic.Tests.ViewModel.Bikes.Bike
|
|
{
|
|
[TestFixture]
|
|
public class TestTariffDescriptionViewModel
|
|
{
|
|
[Test]
|
|
public void TestCtor()
|
|
{
|
|
var model = new RentalDescription
|
|
{
|
|
Name = "Fancy Tarif",
|
|
Id = 47,
|
|
TariffEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.TariffElement>
|
|
{
|
|
{ "23", new RentalDescription.TariffElement { Value = "Max Gebühr", Description = "9.00 € / Tag"} },
|
|
{ "24", new RentalDescription.TariffElement { Value = "Gratis Mietzeit", Description = "30 Min / Tag"} },
|
|
},
|
|
InfoEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.InfoElement>
|
|
{
|
|
{ "14", new RentalDescription.InfoElement { Key = "AGB" , Value = "Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt" } },
|
|
}
|
|
};
|
|
|
|
var viewModel = new TariffDescriptionViewModel(model);
|
|
|
|
Assert.That(
|
|
viewModel.Name,
|
|
Is.EqualTo("Fancy Tarif"));
|
|
|
|
Assert.That(
|
|
viewModel.TariffEntries.Count,
|
|
Is.EqualTo(2));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntries.Count,
|
|
Is.EqualTo(1));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Value,
|
|
Is.EqualTo("Max Gebühr"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Description,
|
|
Is.EqualTo("9.00 € / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Value,
|
|
Is.EqualTo("Gratis Mietzeit"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Description,
|
|
Is.EqualTo("30 Min / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Value,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Description,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TrackingInfoText,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry1,
|
|
Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry2,
|
|
Is.Empty);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorTracking()
|
|
{
|
|
var model = new RentalDescription
|
|
{
|
|
Name = "Fancy Tarif",
|
|
Id = 47,
|
|
TariffEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.TariffElement>
|
|
{
|
|
{ "23", new RentalDescription.TariffElement { Value = "Max Gebühr", Description = "9.00 € / Tag"} },
|
|
{ "24", new RentalDescription.TariffElement { Value = "Gratis Mietzeit", Description = "30 Min / Tag"} },
|
|
},
|
|
InfoEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.InfoElement>
|
|
{
|
|
{ "14", new RentalDescription.InfoElement { Key = "AGB" , Value = "Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt" } },
|
|
{ "15", new RentalDescription.InfoElement { Key = "Tracking", Value = "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!" } },
|
|
}
|
|
};
|
|
|
|
var viewModel = new TariffDescriptionViewModel(model);
|
|
|
|
Assert.That(
|
|
viewModel.Name,
|
|
Is.EqualTo("Fancy Tarif"));
|
|
|
|
Assert.That(
|
|
viewModel.TariffEntries.Count,
|
|
Is.EqualTo(2));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntries.Count,
|
|
Is.EqualTo(1));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Value,
|
|
Is.EqualTo("Max Gebühr"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Description,
|
|
Is.EqualTo("9.00 € / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Value,
|
|
Is.EqualTo("Gratis Mietzeit"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Description,
|
|
Is.EqualTo("30 Min / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Value,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Description,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TrackingInfoText,
|
|
Is.EqualTo("Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!"));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry1,
|
|
Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry2,
|
|
Is.Empty);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCtorAaFahrten()
|
|
{
|
|
var model = new RentalDescription
|
|
{
|
|
Name = "Fancy Tarif",
|
|
Id = 47,
|
|
TariffEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.TariffElement>
|
|
{
|
|
{ "23", new RentalDescription.TariffElement { Value = "Max Gebühr", Description = "9.00 € / Tag"} },
|
|
{ "24", new RentalDescription.TariffElement { Value = "Gratis Mietzeit", Description = "30 Min / Tag"} },
|
|
},
|
|
InfoEntries = new System.Collections.Generic.Dictionary<string, RentalDescription.InfoElement>
|
|
{
|
|
{ "14", new RentalDescription.InfoElement { Key = "AGB" , Value = "Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt" } },
|
|
{ "15", new RentalDescription.InfoElement { Key = "AAFahrten", Value = "Testtext aa Fahrten." } },
|
|
}
|
|
};
|
|
|
|
var viewModel = new TariffDescriptionViewModel(model);
|
|
|
|
Assert.That(
|
|
viewModel.Name,
|
|
Is.EqualTo("Fancy Tarif"));
|
|
|
|
Assert.That(
|
|
viewModel.TariffEntries.Count,
|
|
Is.EqualTo(2));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntries.Count,
|
|
Is.EqualTo(1));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Value,
|
|
Is.EqualTo("Max Gebühr"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry1.Description,
|
|
Is.EqualTo("9.00 € / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Value,
|
|
Is.EqualTo("Gratis Mietzeit"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry2.Description,
|
|
Is.EqualTo("30 Min / Tag"));
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Value,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TarifEntry3.Description,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.TrackingInfoText,
|
|
Is.Empty);
|
|
|
|
Assert.That(
|
|
viewModel.RideTypeText,
|
|
Is.EqualTo("Testtext aa Fahrten."));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry1,
|
|
Is.EqualTo("Mit der Mietrad Anmietung wird folgender Betreiber <a href='$varenv->{wwwhost}/site/agb.html' target='_blank'>AGB</a> zugestimmt"));
|
|
|
|
Assert.That(
|
|
viewModel.InfoEntry2,
|
|
Is.Empty);
|
|
}
|
|
}
|
|
}
|