Пример #1
0
        public void TestWhenShouldJobBeRunPMtoAM()
        {
            var task = new ScheduledTask();

            task.ScheduleType = (int)ScheduleTypes.Weekly;
            task.Sunday       = true;
            task.Monday       = true;
            task.Tuesday      = true;
            task.Wednesday    = true;
            task.Thursday     = true;
            task.Friday       = true;
            task.Saturday     = true;
            task.Time         = "6:15 AM";

            var testingDateTime = new DateTime(2013, 7, 21, 19, 59, 59, DateTimeKind.Local);

            var dateTime = task.WhenShouldJobBeRun(testingDateTime);

            dateTime.HasValue.Should().BeTrue();
            dateTime.Value.Hour.Should().Be(6);
            dateTime.Value.Minute.Should().Be(15);
            dateTime.Value.Second.Should().Be(0);
            dateTime.Value.Day.Should().Be(21);
            dateTime.Value.Month.Should().Be(7);
            dateTime.Value.Year.Should().Be(2013);
        }