/// <summary> /// Create a new MinPower tariff restriction. /// </summary> /// <param name="MinPower">The minimum power value.</param> public static ChargingTariffRestriction MinPower(Decimal MinPower) => new ChargingTariffRestriction(Power: DecimalMinMax.FromMin(MinPower));
/// <summary> /// Create a new MinkWh tariff restriction. /// </summary> /// <param name="MinkWh">The minimum kWh value.</param> public static ChargingTariffRestriction MinkWh(Decimal MinkWh) => new ChargingTariffRestriction(kWh: DecimalMinMax.FromMin(MinkWh));
/// <summary> /// Create a new MinkWh tariff restriction. /// </summary> /// <param name="MinkWh">The minimum kWh value.</param> public static TariffRestriction MinkWh(Decimal MinkWh) { return(new TariffRestriction(kWh: DecimalMinMax.FromMin(MinkWh))); }
/// <summary> /// Create a new MinPower tariff restriction. /// </summary> /// <param name="MinPower">The minimum power value.</param> public static TariffRestriction MinPower(Decimal MinPower) { return(new TariffRestriction(Power: DecimalMinMax.FromMin(MinPower))); }
public static void Tariff0004() { var tariff = new Tariff(Tariff_Id.Parse("11"), Currency.EUR, TariffUrl: new Uri("https://company.com/tariffs/11"), TariffElements: new List <TariffElement>() { // 2.50 euro start tariff new TariffElement( PriceComponent.FlatRate(2.50M) ), // 1.00 euro per hour charging tariff for less than 32A (paid per 15 minutes) new TariffElement( PriceComponent.ChargingTime(1.00M, TimeSpan.FromSeconds(900)), TariffRestriction.MaxPower(32M) ), // 2.00 euro per hour charging tariff for more than 32A on weekdays (paid per 10 minutes) new TariffElement( PriceComponent.ChargingTime(2.00M, TimeSpan.FromSeconds(600)), new TariffRestriction(Power: DecimalMinMax.FromMin(32M), DayOfWeek: Enumeration.Create( DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday )) ), // 1.25 euro per hour charging tariff for more then 32A during the weekend (paid per 10 minutes) new TariffElement( PriceComponent.ChargingTime(1.25M, TimeSpan.FromSeconds(600)), new TariffRestriction(Power: DecimalMinMax.FromMin(32M), DayOfWeek: Enumeration.Create( DayOfWeek.Saturday, DayOfWeek.Sunday )) ), // Parking on weekdays: between 09:00 and 18:00: 5 euro(paid per 5 minutes) new TariffElement( PriceComponent.ParkingTime(5M, TimeSpan.FromSeconds(300)), new TariffRestriction(Time: TimeRange.From(9).To(18), DayOfWeek: Enumeration.Create( DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday )) ), // Parking on saturday: between 10:00 and 17:00: 6 euro (paid per 5 minutes) new TariffElement( PriceComponent.ParkingTime(6M, TimeSpan.FromSeconds(300)), new TariffRestriction(Time: TimeRange.From(10).To(17), DayOfWeek: new DayOfWeek[] { DayOfWeek.Saturday }) ) } ); var expected = new JObject(new JProperty("id", "11"), new JProperty("currency", "EUR"), new JProperty("tariff_alt_url", "https://company.com/tariffs/11"), new JProperty("elements", new JArray( // 2.50 euro start tariff new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "FLAT"), new JProperty("price", "2.50"), new JProperty("step_size", 1) ))) ), // 1.00 euro per hour charging tariff for less than 32A (paid per 15 minutes) new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "TIME"), new JProperty("price", "1.00"), new JProperty("step_size", 900) ))), new JProperty("restrictions", new JArray( new JObject( new JProperty("max_power", "32.00") ) )) ), // 2.00 euro per hour charging tariff for more than 32A on weekdays (paid per 10 minutes) new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "TIME"), new JProperty("price", "2.00"), new JProperty("step_size", 600) ))), new JProperty("restrictions", new JArray( new JObject( new JProperty("min_power", "32.00"), new JProperty("day_of_week", new JArray("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY")) ) )) ), // 1.25 euro per hour charging tariff for more then 32A during the weekend (paid per 10 minutes) new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "TIME"), new JProperty("price", "1.25"), new JProperty("step_size", 600) ))), new JProperty("restrictions", new JArray( new JObject( new JProperty("min_power", "32.00"), new JProperty("day_of_week", new JArray("SATURDAY", "SUNDAY")) ) )) ), // Parking on weekdays: between 09:00 and 18:00: 5 euro(paid per 5 minutes) new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "PARKING_TIME"), new JProperty("price", "5.00"), new JProperty("step_size", 300) ))), new JProperty("restrictions", new JArray( new JObject( new JProperty("start_time", "09:00"), new JProperty("end_time", "18:00"), new JProperty("day_of_week", new JArray("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY")) ) )) ), // Parking on saturday: between 10:00 and 17:00: 6 euro (paid per 5 minutes) new JObject( new JProperty("price_components", new JArray( new JObject( new JProperty("type", "PARKING_TIME"), new JProperty("price", "6.00"), new JProperty("step_size", 300) ))), new JProperty("restrictions", new JArray( new JObject( new JProperty("start_time", "10:00"), new JProperty("end_time", "17:00"), new JProperty("day_of_week", new JArray("SATURDAY")) ) )) ) ))); Assert.AreEqual(expected.ToString(), tariff.ToJSON().ToString()); }