public void DisableEmailing_disables_emailing() { Customer customer = CreateCustomer("Cars"); Response response = Invoke(x => x.DisableEmailing(customer.Id)); response.ShouldBeOk(); using (var db = new CustomerDatabase()) { db.ShouldContainCustomer(customer.Id) .WithEmailCampaign(EmailCampaign.None); } }
public void Promote_promotes_customer() { Customer customer = CreateCustomer(); var emailGateway = new FakeEmailGateway(); Response response = Invoke(x => x.Promote(customer.Id), emailGateway); response.ShouldBeOk(); using (var db = new CustomerDatabase()) { db.ShouldContainCustomer(customer.Id) .WithStatus(CustomerStatus.Preferred); emailGateway.ShouldContainNumberOfPromotionNotificationsSent(1); } }
public void Create_can_create_a_customer_without_secondary_email() { var model = new CreateCustomerModel { Industry = "Cars", Name = "Johnson and Co", PrimaryEmail = "*****@*****.**" }; Response response = Invoke(x => x.Create(model)); response.ShouldBeOk(); using (var db = new CustomerDatabase()) { db.ShouldContainCustomer("Johnson and Co") .WithNoSecondaryEmail(); } }
public void Update_updates_a_customer_if_no_validation_errors() { Customer customer = CreateCustomer("Cars"); var model = new UpdateCustomerModel { Id = customer.Id, Industry = "Other" }; Response response = Invoke(x => x.Update(model)); response.ShouldBeOk(); using (var db = new CustomerDatabase()) { db.ShouldContainCustomer(model.Id) .WithIndustry("Other") .WithEmailCampaign(EmailCampaign.Generic); } }
public void Create_creates_a_customer_if_no_validation_errors() { var model = new CreateCustomerModel { Industry = "Cars", Name = "Johnson and Co", PrimaryEmail = "*****@*****.**", SecondaryEmail = "*****@*****.**" }; Response response = Invoke(x => x.Create(model)); response.ShouldBeOk(); using (var db = new CustomerDatabase()) { db.ShouldContainCustomer("Johnson and Co") .WithPrimaryEmail("*****@*****.**") .WithSecondaryEmail("*****@*****.**") .WithIndustry("Cars") .WithEmailCampaign(EmailCampaign.LatestCarModels) .WithStatus(CustomerStatus.Regular); } }