Ejemplo n.º 1
0
    public void ShouldGetAllowedDateTimeRanges()
    {
        var schedule = Schedule
                       .On(new YearDay(4, 18), new YearDay(9, 7))
                       .At(TimeRange.From(10, 13).ForOneHour());
        var allowedDateTimeRanges = schedule.DateTimeRanges
                                    (
            DateRange.Between
            (
                new DateTime(2021, 9, 1),
                new DateTime(2021, 10, 11)
            )
                                    );

        Assert.That
        (
            allowedDateTimeRanges,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 9, 7, 10, 13, 0),
                new DateTime(2021, 9, 7, 11, 13, 0)
            )
        }
            )
        );
    }
Ejemplo n.º 2
0
    public void ShouldNotBeInSchedule_WhenNotInTimeRange()
    {
        var schedule = new AggregateSchedule
                       (
            Schedule.On(DayOfWeek.Monday)
            .At(TimeRange.From(10, 0).For(2).Hours())
                       );
        var result = schedule.IsInSchedule(new DateTime(2020, 10, 19, 8, 0, 0));

        Assert.That(result, Is.False, "Should not be in schedule");
    }
Ejemplo n.º 3
0
    public void ShouldBeInRange_WhenDateIsOneMonthIntervalPastTheStartDate()
    {
        var schedule = Schedule
                       .Every(3).Months().Starting(new DateTime(2021, 10, 5))
                       .At(TimeRange.From(19, 35).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2022, 1, 5, 19, 35, 0)),
            Is.True,
            "Should be in range when date is one month interval past the start date"
        );
    }
Ejemplo n.º 4
0
    public void ShouldBeInRange_WhenDateIsTwoWeekIntervalsPastTheStartDate()
    {
        var schedule = Schedule
                       .Every(2).Weeks().Starting(new DateTime(2021, 10, 1))
                       .At(TimeRange.From(19, 35).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 29, 19, 35, 0)),
            Is.True,
            "Should be in range when date is two week intervals past the start date"
        );
    }
Ejemplo n.º 5
0
    public void ShouldBeInRange_WhenDateIsEqualToStartTime()
    {
        var schedule = Schedule
                       .Every(3).Days().Starting(new DateTime(2021, 10, 1))
                       .At(TimeRange.From(19, 35).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 1, 19, 35, 0)),
            Is.True,
            "Should be in range when date is equal to the start date"
        );
    }
Ejemplo n.º 6
0
    public void ShouldNotBeInRange_WhenDateIsBeforeTheStartDate()
    {
        var schedule = Schedule
                       .Every(3).Days().Starting(new DateTime(2021, 10, 1))
                       .At(TimeRange.From(19, 35).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTimeOffset(new DateTime(2021, 9, 28, 19, 35, 0))),
            Is.False,
            "Should not be in range when date is before the start date"
        );
    }
Ejemplo n.º 7
0
    public void ShouldNotBeInRange_WhenDateIsNotAllowed()
    {
        var schedule = Schedule
                       .Every(3).Months().Starting(new DateTime(2021, 10, 5))
                       .At(TimeRange.From(19, 35).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2022, 4, 4, 19, 35, 0)),
            Is.False,
            "Should not be in range when date is not allowed"
        );
    }
Ejemplo n.º 8
0
    public void ShouldBeInRange_WhenDateIsOnAllowedDayAndTimeIsWithinTheTimeRange()
    {
        var schedule = Schedule
                       .On(DayOfWeek.Monday)
                       .At(TimeRange.From(10, 13).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 4, 10, 45, 0)),
            Is.True,
            "Should be in range when date is on an allowed day and time is within the range"
        );
    }
Ejemplo n.º 9
0
    public void ShouldNotBeInRange_WhenDateIsOnAllowedDayButTimeIsNotWithinTheTimeRange()
    {
        var schedule = Schedule
                       .On(new YearDay(4, 18), new YearDay(9, 7))
                       .At(TimeRange.From(10, 13).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 4, 11, 15, 0)),
            Is.False,
            "Should not be in range when date is on an allowed day but time is not within the range"
        );
    }
Ejemplo n.º 10
0
    public void ShouldBeInRange_WhenDateIsOnAllowedDayOfTheMonth()
    {
        var schedule = Schedule
                       .On(new MonthDay(12))
                       .At(TimeRange.From(22, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 12, 22, 30, 0)),
            Is.True,
            "Should be in range when date is on an allowed day of the month"
        );
    }
Ejemplo n.º 11
0
    public void ShouldNotBeInRange_WhenDateIsOnAllowedDayOfTheMonthButNotInAnAllowedTimeRange()
    {
        var schedule = Schedule
                       .On(new MonthDay(12))
                       .At(TimeRange.From(22, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 12, 23, 30, 0)),
            Is.False,
            "Should not be in range when date is on an allowed day of the month but not in an allowed time range"
        );
    }
Ejemplo n.º 12
0
    public void ShouldNotBeInRange_WhenDateIsNotOnAllowedDayAndTimeIsNotWithinTheTimeRange()
    {
        var schedule = Schedule
                       .On(DayOfWeek.Monday)
                       .At(TimeRange.From(10, 13).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 5, 11, 15, 0)),
            Is.False,
            "Should not be in range when date is not on an allowed day and time is not within the range"
        );
    }
Ejemplo n.º 13
0
    public void ShouldBeInSchedule_WhenDateTimeIsInAnyOfTheOptionDaysOfTheWeek()
    {
        var schedule = new AggregateSchedule
                       (
            Schedule.On(DayOfWeek.Monday, DayOfWeek.Wednesday)
            .At
            (
                TimeRange.From(10, 0).For(2).Hours(),
                TimeRange.From(17, 0).For(2).Hours()
            )
                       );
        var result = schedule.IsInSchedule(new DateTime(2020, 10, 21, 18, 0, 0));

        Assert.That(result, Is.True, "Should be in schedule");
    }
    public void ShouldGetAllowedDateTimeRanges()
    {
        var schedule = Schedule
                       .First(DayOfWeek.Monday)
                       .OfEveryMonth()
                       .AndTheThird(DayOfWeek.Wednesday)
                       .OfEveryMonth()
                       .AndTheLast(DayOfWeek.Saturday)
                       .OfEveryMonth()
                       .At(TimeRange.From(21, 0).ForOneHour());
        var ranges = schedule.DateTimeRanges
                     (
            DateRange.Between
            (
                new DateTime(2021, 9, 24),
                new DateTime(2021, 10, 21)
            )
                     );

        Assert.That
        (
            ranges,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 9, 25, 21, 0, 0),
                new DateTime(2021, 9, 25, 22, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 4, 21, 0, 0),
                new DateTime(2021, 10, 4, 22, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 20, 21, 0, 0),
                new DateTime(2021, 10, 20, 22, 0, 0)
            )
        }
            ),
            "Should get allowed date time ranges"
        );
    }
Ejemplo n.º 15
0
    public void ShouldGetAllowedDateTimeRanges()
    {
        var schedule = Schedule
                       .On(DayOfWeek.Monday, DayOfWeek.Friday)
                       .At(TimeRange.From(10, 13).ForOneHour());
        var allowedTimes = schedule.DateTimeRanges
                           (
            DateRange.Between
            (
                new DateTime(2021, 10, 1),
                new DateTime(2021, 10, 11)
            )
                           );

        Assert.That
        (
            allowedTimes,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 1, 10, 13, 0),
                new DateTime(2021, 10, 1, 11, 13, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 4, 10, 13, 0),
                new DateTime(2021, 10, 4, 11, 13, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 8, 10, 13, 0),
                new DateTime(2021, 10, 8, 11, 13, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 11, 10, 13, 0),
                new DateTime(2021, 10, 11, 11, 13, 0)
            )
        }
            )
        );
    }
    public void ShouldBeInRangeOnThirdTuesday_WhenThirdTuesdayIsAllowed()
    {
        var schedule = Schedule
                       .Third(DayOfWeek.Tuesday).OfEveryMonth()
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 19, 21, 15, 0)),
            Is.True,
            "Should be in range on third Tuesday when third Tuesday is allowed"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 9, 21, 21, 15, 0)),
            Is.True,
            "Should be in range on third Tuesday when third Tuesday is allowed"
        );
    }
    public void ShouldNotBeInRange_WhenDateIsOnAllowedFirstDayOfWeekButTimeIsNotInTimeRange()
    {
        var schedule = Schedule
                       .First(DayOfWeek.Wednesday).OfEveryMonth()
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 6, 22, 05, 0)),
            Is.False,
            "Should not be in range when date is on allowed first day of week but time is not within range"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 9, 1, 20, 15, 0)),
            Is.False,
            "Should not be in range when date is on allowed first day of week but time is not within range"
        );
    }
    public void ShouldBeInRangeOnLastSaturday_WhenLastSaturdayIsAllowed()
    {
        var schedule = Schedule
                       .Last(DayOfWeek.Saturday).OfEveryMonth()
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 30, 21, 15, 0)),
            Is.True,
            "Should be in range on last Saturday when last Saturday is allowed"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 9, 25, 21, 15, 0)),
            Is.True,
            "Should be in range on last Saturday when last Saturday is allowed"
        );
    }
    public void ShouldNotBeInRange_WhenDateIsNotOnAllowedFirstDayOfWeek()
    {
        var schedule = Schedule
                       .First(DayOfWeek.Wednesday).OfEveryMonth()
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 5, 21, 15, 0)),
            Is.False,
            "Should not be in range when date is not on allowed first day of week"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTimeOffset(new DateTime(2021, 9, 2, 21, 15, 0))),
            Is.False,
            "Should not be in range when date is not on allowed first day of week"
        );
    }
Ejemplo n.º 20
0
    public void ShouldBeInRangeOnLastDayOfTheMonth()
    {
        var schedule = Schedule
                       .On(MonthDay.LastDay)
                       .At(TimeRange.From(22, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 9, 30, 22, 30, 0)),
            Is.True,
            "Should be in range on last day of the month when last day of the month is allowed"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 31, 22, 30, 0)),
            Is.True,
            "Should be in range on last day of the month when last day of the month is allowed"
        );
    }
Ejemplo n.º 21
0
    public void ShouldGetAllowedDateTimeRanges()
    {
        var schedule = Schedule
                       .First(DayOfWeek.Monday).Of(Months.January)
                       .AndTheThird(DayOfWeek.Wednesday).Of(Months.June)
                       .AndTheLast(DayOfWeek.Saturday).Of(Months.October)
                       .At(TimeRange.From(21, 0).ForOneHour());
        var ranges = schedule.DateTimeRanges
                     (
            DateRange.Between
            (
                new DateTime(2021, 5, 1),
                new DateTime(2022, 2, 1)
            )
                     );

        Assert.That
        (
            ranges,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 6, 16, 21, 0, 0),
                new DateTime(2021, 6, 16, 22, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 30, 21, 0, 0),
                new DateTime(2021, 10, 30, 22, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2022, 1, 3, 21, 0, 0),
                new DateTime(2022, 1, 3, 22, 0, 0)
            )
        }
            ),
            "Should get allowed date time ranges"
        );
    }
Ejemplo n.º 22
0
    public void ShouldNotBeInRangeOnFirstWednesday_WhenFirstWednesdayIsAllowed()
    {
        var schedule = Schedule
                       .Third(DayOfWeek.Wednesday)
                       .Of(Months.January, Months.June)
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 5, 19, 21, 15, 0)),
            Is.False,
            "Should be in range on third Wednesday when third Wednesday is allowed but month is not allowed"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 10, 20, 21, 15, 0)),
            Is.False,
            "Should not be in range on third Wednesday when third Wednesday is allowed but month is not allowed"
        );
    }
Ejemplo n.º 23
0
    public void ShouldBeInRangeOnThirdWednesday_WhenThirdWednesdayIsAllowedAndMonthIsAllowed()
    {
        var schedule = Schedule
                       .Third(DayOfWeek.Wednesday)
                       .Of(Months.January, Months.June)
                       .At(TimeRange.From(21, 0).ForOneHour());

        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 1, 20, 21, 15, 0)),
            Is.True,
            "Should be in range on third Wednesday when third Wednesday is allowed"
        );
        Assert.That
        (
            schedule.IsInSchedule(new DateTime(2021, 6, 16, 21, 15, 0)),
            Is.True,
            "Should be in range on third Wednesday when third Wednesday is allowed"
        );
    }
Ejemplo n.º 24
0
    public void ShouldGetAllowedDates()
    {
        var schedule = Schedule
                       .Every(3).Months().Starting(new DateTime(2021, 10, 5))
                       .At(TimeRange.From(19, 35).ForOneHour());
        var allowedDateTimeRanges = schedule.DateTimeRanges
                                    (
            DateRange.Between
            (
                new DateTime(2021, 10, 1),
                new DateTime(2022, 4, 6)
            )
                                    );

        Assert.That
        (
            allowedDateTimeRanges,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 5, 19, 35, 0),
                new DateTime(2021, 10, 5, 20, 35, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2022, 1, 5, 19, 35, 0),
                new DateTime(2022, 1, 5, 20, 35, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2022, 4, 5, 19, 35, 0),
                new DateTime(2022, 4, 5, 20, 35, 0)
            )
        }
            )
        );
    }
Ejemplo n.º 25
0
    public void ShouldGetDateTimeRanges()
    {
        var schedule = Schedule
                       .On(new MonthDay(1), new MonthDay(12), new MonthDay(15))
                       .At(TimeRange.From(22, 0).ForOneHour());
        var ranges = schedule.DateTimeRanges
                     (
            DateRange.Between
            (
                new DateTime(2021, 10, 2),
                new DateTime(2021, 10, 20)
            )
                     );

        Assert.That
        (
            ranges,
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 12, 22, 0, 0),
                new DateTime(2021, 10, 12, 23, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 15, 22, 0, 0),
                new DateTime(2021, 10, 15, 23, 0, 0)
            )
        }
            ),
            "Should be in range when date is on an allowed day of the month"
        );
    }
Ejemplo n.º 26
0
    public void ShouldDeserializeSchedule()
    {
        var schedule = new AggregateSchedule
                       (
            Schedule.On(DayOfWeek.Monday)
            .At(TimeRange.From(10, 0).ForOneHour()),
            Schedule.On(new MonthDay(15))
            .At(TimeRange.From(11, 0).ForOneHour()),
            Schedule.First(DayOfWeek.Monday).OfEveryMonth()
            .At(TimeRange.From(12, 0).ForOneHour()),
            Schedule.On(new YearDay(10, 13))
            .At(TimeRange.From(13, 0).ForOneHour()),
            Schedule.First(DayOfWeek.Tuesday).Of(Months.October)
            .At(TimeRange.From(14, 0).ForOneHour()),
            Schedule.Every(2).Weeks().Starting(new DateTime(2021, 10, 12))
            .At(TimeRange.From(15, 0).ForOneHour())
                       );
        var serialized   = schedule.Serialize();
        var deserialized = AggregateSchedule.Deserialize(serialized);

        Assert.That
        (
            deserialized.DateTimeRanges
            (
                DateRange.Between(new DateTime(2021, 10, 1), new DateTime(2021, 10, 31))
            ),
            Is.EqualTo
            (
                new[]
        {
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 4, 10, 0, 0),
                new DateTime(2021, 10, 4, 11, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 4, 12, 0, 0),
                new DateTime(2021, 10, 4, 13, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 5, 14, 0, 0),
                new DateTime(2021, 10, 5, 15, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 11, 10, 0, 0),
                new DateTime(2021, 10, 11, 11, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 12, 15, 0, 0),
                new DateTime(2021, 10, 12, 16, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 13, 13, 0, 0),
                new DateTime(2021, 10, 13, 14, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 15, 11, 0, 0),
                new DateTime(2021, 10, 15, 12, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 18, 10, 0, 0),
                new DateTime(2021, 10, 18, 11, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 25, 10, 0, 0),
                new DateTime(2021, 10, 25, 11, 0, 0)
            ),
            DateTimeRange.Between
            (
                new DateTime(2021, 10, 26, 15, 0, 0),
                new DateTime(2021, 10, 26, 16, 0, 0)
            )
        }
            )
        );
    }
Ejemplo n.º 27
0
        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());
        }