public void EmailStatusUpdate_EmailIsComplained_ReplyFailed() { const EmailStatus emailStatus = EmailStatus.Complained; var emailData = new EmailData { ToAddress = "toaddress" }; var requestMessage = new ScheduleEmailForSendingLater(DateTime.Now.AddMinutes(5), emailData, new SmsMetaData(), Guid.NewGuid(), "username"); var data = new ScheduledEmailData { ScheduleMessageId = requestMessage.CorrelationId, OriginalMessageData = new OriginalEmailMessageData(requestMessage) }; var emailStatusUpdate = new EmailStatusUpdate { Status = emailStatus }; Test.Initialize(); Test.Saga<EmailScheduler>() .WithExternalDependencies(a => { a.Data = data; }) .WhenReceivesMessageFrom("address") .ExpectPublish<ScheduledEmailFailed>(m => m.CoordinatorId == requestMessage.CorrelationId && m.EmailStatus == emailStatus && m.ScheduledSmsId == data.ScheduleMessageId && m.ToAddress == emailData.ToAddress && m.Username == requestMessage.Username) .ExpectSendLocal<ScheduleStatusChanged>(s => s.Status == MessageStatus.Failed && s.ScheduleId == data.ScheduleMessageId) .When(s => s.Handle(emailStatusUpdate)) .AssertSagaCompletionIs(true); }
public ScheduleEmailForSendingLater(DateTime sendMessageAtUtc, EmailData emailData, SmsMetaData metaData, Guid coorelationId, string username) { ScheduleMessageId = Guid.NewGuid(); EmailData = emailData; SendMessageAtUtc = sendMessageAtUtc; CorrelationId = coorelationId; Username = username; Tags = metaData.Tags; Topic = metaData.Topic; }
public CoordinatorCreatedWithEmailAndSms() { ConfirmationEmailAddresses = new List<string>(); EmailData = new EmailData(); }
public void EmailStatusUpdate_EmailIsDelivered_SetsTimeoutForFurtherInformation_TimeoutExpires_PublishSuccess() { const EmailStatus emailStatus = EmailStatus.Delivered; var emailData = new EmailData { ToAddress = "toaddress" }; var requestMessage = new ScheduleEmailForSendingLater(DateTime.Now.AddMinutes(5), emailData, new SmsMetaData(), Guid.NewGuid(), "username"); var data = new ScheduledEmailData { ScheduleMessageId = requestMessage.CorrelationId, OriginalMessageData = new OriginalEmailMessageData(requestMessage) }; var emailStatusUpdate = new EmailStatusUpdate { Status = emailStatus }; Test.Initialize(); Test.Saga<EmailScheduler>() .WithExternalDependencies(a => { a.Data = data; }) .WhenReceivesMessageFrom("address") .ExpectTimeoutToBeSetIn<ScheduleEmailDeliveredTimeout>((message, timespan) => timespan.Ticks == new TimeSpan(1, 0, 0, 0).Ticks) .When(s => s.Handle(emailStatusUpdate)) .ExpectPublish<ScheduledEmailSent>(m => m.CoordinatorId == requestMessage.CorrelationId && m.EmailStatus == emailStatus && m.ScheduledSmsId == data.ScheduleMessageId && m.ToAddress == emailData.ToAddress && m.Username == requestMessage.Username) .ExpectSendLocal<ScheduleStatusChanged>(s => s.Status == MessageStatus.Sent && s.ScheduleId == data.ScheduleMessageId) .WhenSagaTimesOut() .AssertSagaCompletionIs(true); }
public EmailScheduleCreated() { Tags = new List<string>(); EmailData = new EmailData(); }
public CoordinatorTrackingData(List<MessageSendingStatus> listOfSendingStatusForTesting) { MetaData = new SmsMetaData(); EmailData = new EmailData(); testMessageSendingStatus = listOfSendingStatusForTesting; }
public CoordinatorTrackingData() { MetaData = new SmsMetaData(); EmailData = new EmailData(); }