public void Execute_WhenSendingTheCreative_ShouldSetCreativeIdHeader() { DroneActions.EditSettings<EmailingSettings>(x => { x.WritingEmailsToDiskPath = IntergrationHelpers.AssemblyDirectory; x.MailingDomain = "example.com"; }); var creativePackage = new CreativePackage { TextBody = "test body", Subject = "test subject", To = "test@test", CreativeId = "creative/1", FromName = "david", FromAddressDomainPrefix = "sales" }; DroneActions.ExecuteCommand<SendCreativePackageCommand>(x => { x.Package = creativePackage; }); Email.AssertEmailSent(x => x.To.Any(address => address.Address == "test@test")); Email.AssertEmailSent(x => x.Body == "test body"); Email.AssertEmailSent(x => x.Subject == "test subject"); Email.AssertEmailSent(x => x.TestHeaders["Speedy-Creative-Id"] == "creative/1"); }
public void Execute_WhenGivenFromInformation_ShouldSendTheEmailWithThatFromAddress() { DroneActions.EditSettings<EmailingSettings>(x => { x.WritingEmailsToDiskPath = IntergrationHelpers.AssemblyDirectory; x.MailingDomain = "example.com"; }); var creativePackage = new CreativePackage { HtmlBody = "test body", Subject = "test subject", To = "test@test", CreativeId = "creative/1", FromName = "david", FromAddressDomainPrefix = "sales" }; DroneActions.ExecuteCommand<SendCreativePackageCommand>(x => { x.Package = creativePackage; }); Email.AssertEmailSent(x => x.From.Address == "*****@*****.**" && x.From.DisplayName == "david"); }
public void Inspect_WhenAnPackageWasSent_ShouldRemoveItFromTheStore() { DroneActions.EditSettings<DroneSettings>(x => x.StoreHostname = DefaultHostUrl); var package = new CreativePackage { To = "*****@*****.**", Group = "$default$" }; DroneActions.Store(package); FireEvent<RemoveSentPackages, AggregatedMailSent>(x => x.MailEvents = new List<MailSent> { new MailSent { Recipient = "*****@*****.**" } }); var result = DroneActions.FindAll<CreativePackage>(); result.Should().BeEmpty(); }
public void Execute_WhenNotAllCreativePackagesAreSentAndNoSendingJobsAreRunning_ShouldResumeSending() { DroneActions.EditSettings<DroneSettings>(x => { x.StoreHostname = DefaultHostUrl; x.BaseUrl = "htto://drone.com"; }); DroneActions.EditSettings<ApiCallsSettings>(x => x.ApiBaseUri = DefaultBaseUrl); DroneActions.EditSettings<EmailingSettings>(x => { x.WritingEmailsToDiskPath = IntergrationHelpers.AssemblyDirectory; x.MailingDomain = "example.com"; }); Api.ListenToApiCall<ServiceEndpoints.Creative.FetchFragment>(); var creativePackage = new CreativePackage { Group = "$default$", HtmlBody = "body", Subject = "subject", To = "*****@*****.**", FromAddressDomainPrefix = "david", FromName = "sales", Interval = 10, CreativeId = "creative/1" }; DroneActions.Store(creativePackage); var task = new FetchCreativeFragmentsTask(); DroneActions.StartScheduledTask(task); Email.AssertEmailsSentTo(new[] { "*****@*****.**" }); }
public void Execute_WhenThereAreCreativePackagesInTheStoreThatWereAlreadyProcessed_ShouldFetchFragment() { DroneActions.EditSettings<DroneSettings>(x => { x.StoreHostname = DefaultHostUrl; x.BaseUrl = "htto://drone.com"; }); DroneActions.EditSettings<ApiCallsSettings>(x => x.ApiBaseUri = DefaultBaseUrl); DroneActions.EditSettings<EmailingSettings>(x => { x.WritingEmailsToDiskPath = IntergrationHelpers.AssemblyDirectory; x.MailingDomain = "example.com"; }); Api.ListenToApiCall<ServiceEndpoints.Creative.FetchFragment>(); var creativePackage = new CreativePackage { Group = "$default$", HtmlBody = "body", Subject = "subject", To = "*****@*****.**", FromAddressDomainPrefix = "david", FromName = "sales", Interval = 10, Processed = true, CreativeId = "creative/1" }; DroneActions.Store(creativePackage); var task = new FetchCreativeFragmentsTask(); DroneActions.StartScheduledTask(task); Api.AssertApiCalled<ServiceEndpoints.Creative.FetchFragment>(); }