Beispiel #1
0
        public void Should_return_now_for_null_scheduling()
        {
            Scheduling?sut = null;

            var actual = Scheduling.CalculateScheduleTime(sut, clock, "Europe/Berlin");

            Assert.Equal(now, actual);
        }
Beispiel #2
0
        public void Should_return_now_for_undefined_scheduling()
        {
            var sut = new Scheduling();

            var actual = Scheduling.CalculateScheduleTime(sut, clock, "Europe/Berlin");

            Assert.Equal(now, actual);
        }
Beispiel #3
0
        public void Should_return_weekday_utc_datetime()
        {
            var time = new LocalTime(15, 13, 12);

            var sut = new Scheduling
            {
                Type        = SchedulingType.UTC,
                Time        = time,
                NextWeekDay = IsoDayOfWeek.Friday
            };

            var actual = Scheduling.CalculateScheduleTime(sut, clock, "Europe/Berlin");

            // Global time is UTC time.
            var expected = Instant.FromUtc(2010, 2, 12, 15, 13, 12);

            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public void Should_return_concrete_user_datetime()
        {
            var time = new LocalTime(15, 13, 12);

            var sut = new Scheduling
            {
                Type = SchedulingType.UserTime,
                Time = time,
                Date = new LocalDate(2010, 2, 14)
            };

            var actual = Scheduling.CalculateScheduleTime(sut, clock, "Europe/Berlin");

            // Berlin is UTC+1 in winter.
            var expected = Instant.FromUtc(2010, 2, 14, 14, 13, 12);

            Assert.Equal(expected, actual);
        }
Beispiel #5
0
        public void Should_return_weekday_user_datetime_if_day_is_the_same_day()
        {
            var time = new LocalTime(15, 13, 12);

            var sut = new Scheduling
            {
                Type        = SchedulingType.UserTime,
                Time        = time,
                NextWeekDay = IsoDayOfWeek.Wednesday
            };

            var actual = Scheduling.CalculateScheduleTime(sut, clock, "Europe/Berlin");

            // Berlin is UTC+1 in winter.
            var expected = Instant.FromUtc(2010, 2, 10, 14, 13, 12);

            Assert.Equal(expected, actual);
        }