2022-10-03 17:55:10 +02:00
using NUnit.Framework ;
2022-08-30 15:42:25 +02:00
using TINK.Model.Bikes.BikeInfoNS ;
2022-06-17 14:17:58 +02:00
using TINK.ViewModel.Bikes.Bike ;
namespace TestShareeLib.ViewModel.Bikes.Bike
{
2022-09-06 16:08:19 +02:00
[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 >
{
2023-02-22 14:03:35 +01:00
{ "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" } } ,
2022-09-06 16:08:19 +02:00
}
} ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
var viewModel = new TariffDescriptionViewModel ( model ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . Name ,
Is . EqualTo ( "Fancy Tarif" ) ) ;
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TariffEntries . Count ,
Is . EqualTo ( 2 ) ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . InfoEntries . Count ,
Is . EqualTo ( 1 ) ) ;
2022-08-30 15:42:25 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry1 . Value ,
Is . EqualTo ( "Max Gebühr" ) ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry1 . Description ,
Is . EqualTo ( "9.00 € / Tag" ) ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry2 . Value ,
Is . EqualTo ( "Gratis Mietzeit" ) ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry2 . Description ,
Is . EqualTo ( "30 Min / Tag" ) ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry3 . Value ,
Is . Empty ) ;
2022-06-17 14:17:58 +02:00
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . TarifEntry3 . Description ,
Is . Empty ) ;
2022-06-17 14:17:58 +02:00
2023-02-22 14:03:35 +01:00
Assert . That (
viewModel . TrackingInfoText ,
Is . Empty ) ;
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . InfoEntry1 ,
2023-02-22 14:03:35 +01:00
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 ,
2022-09-06 16:08:19 +02:00
Is . EqualTo ( "Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!" ) ) ;
2022-06-17 14:17:58 +02:00
2023-02-22 14:03:35 +01:00
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" ) ) ;
2022-09-06 16:08:19 +02:00
Assert . That (
viewModel . InfoEntry2 ,
Is . Empty ) ;
}
}
2022-06-17 14:17:58 +02:00
}