Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }