public async void Should_handle_now_properly() { await QuartzEndpoint.ScheduleSend(InputQueueAddress, DateTime.UtcNow + TimeSpan.FromSeconds(20), new Done { Name = "Joe" }); await QuartzEndpoint.ScheduleRecurringSend(InputQueueAddress, new MySchedule(), new Interval { Name = "Joe" }); await _done; Assert.AreEqual(8, _count, "Expected to see 8 interval messages"); }
public async void Should_contain_additional_headers_that_provide_time_domain_context() { var scheduleId = Guid.NewGuid().ToString(); await QuartzEndpoint.ScheduleSend(InputQueueAddress, DateTime.UtcNow + TimeSpan.FromSeconds(10), new Done { Name = "Joe" }); var scheduledRecurringMessage = await QuartzEndpoint.ScheduleRecurringSend(InputQueueAddress, new MySchedule(), new Interval { Name = "Joe" }); await _done; Assert.Greater(_count, 0, "Expected to see at least one interval"); Assert.IsNotNull(_lastInterval.Headers.Get <DateTimeOffset>(MessageHeaders.Quartz.Scheduled, null)); Assert.IsNotNull(_lastInterval.Headers.Get <DateTimeOffset>(MessageHeaders.Quartz.Sent, null)); //Assert.IsNotNull(_lastInterval.Headers.Get<DateTimeOffset>("NextFireTimeUtc", null)); Assert.IsNotNull(_lastInterval.Headers.Get <DateTimeOffset>(MessageHeaders.Quartz.PreviousSent, null)); }
public async Task Should_cancel_recurring_schedule() { var scheduleId = Guid.NewGuid().ToString(); await QuartzEndpoint.ScheduleSend(InputQueueAddress, DateTime.UtcNow + TimeSpan.FromSeconds(10), new Done { Name = "Joe" }); var scheduledRecurringMessage = await QuartzEndpoint.ScheduleRecurringSend(InputQueueAddress, new MyCancelableSchedule(scheduleId), new Interval { Name = "Joe" }); await _done; var countBeforeCancel = _count; Assert.AreEqual(8, _count, "Expected to see 8 interval messages"); await Bus.CancelScheduledRecurringMessage(scheduledRecurringMessage); await QuartzEndpoint.ScheduleSend(InputQueueAddress, DateTime.UtcNow + TimeSpan.FromSeconds(10), new DoneAgain { Name = "Joe" }); await _doneAgain; Assert.AreEqual(countBeforeCancel, _count, "Expected to see the count matches."); }