示例#1
0
        public void Throw_Exception_If_Scheduled_EndAt_Is_In_The_Past()
        {
            var message = new ScheduleJobMessage
            {
                SubscriptionName = "foo",
                JobUid           = "unique id 1234",
                Schedule         = new JobSchedule
                {
                    EndAt   = DateTime.Now.AddMinutes(-1),
                    StartAt = DateTime.Now.AddMinutes(1),
                }
            };

            var result = scheduledJobBuilder.BuildTrigger(message.JobUid, message.SubscriptionName, message.Schedule);

            result.Error.Should().Contain("EndAt cannot be a date in the past");
        }
        public void StartAt_On_Trigger_Should_Match_Whats_In_The_Message_Schedule()
        {
            var startAt = DateTime.Now.AddMinutes(3);

            defaultMessage.Schedule = new JobSchedule
            {
                StartAt = startAt,
            };

            var trigger = scheduledJobBuilder
                          .BuildTrigger(defaultMessage.JobUid, defaultMessage.SubscriptionName, defaultMessage.Schedule)
                          .Value;

            trigger.StartTimeUtc.Should().Be(startAt.ToUniversalTime());
        }