Esempio n. 1
0
        public void Can_remove_address_assigned_as_billing_address()
        {
            var customer = new TestCustomer();
            var address  = new Address {
                Id = 1
            };

            customer.AddAddresses(address);
            customer.BillingAddress = address;

            customer.BillingAddress.ShouldBeTheSameAs(customer.Addresses.First());

            customer.RemoveAddress(address);
            customer.Addresses.Count.ShouldEqual(0);
            customer.BillingAddress.ShouldBeNull();
        }
Esempio n. 2
0
        public void Can_remove_address_assigned_as_billing_address()
        {
            var _customerRepo = new Mock <IRepository <Customer> >();
            var _customerCustomerRoleMappingRepo = new Mock <IRepository <CustomerCustomerRoleMapping> >();
            var _customerPasswordRepo            = new Mock <IRepository <CustomerPassword> >();
            var _genericAttributeRepo            = new Mock <IRepository <GenericAttribute> >();
            var _shoppingCartRepo        = new Mock <IRepository <ShoppingCartItem> >();
            var _genericAttributeService = new Mock <IGenericAttributeService>();
            var _eventPublisher          = new Mock <IEventPublisher>();
            var _customerRoleRepo        = new Mock <IRepository <CustomerRole> >();

            var _customerService = new CustomerService(new CustomerSettings(),
                                                       new TestCacheManager(),
                                                       null,
                                                       null,
                                                       _eventPublisher.Object,
                                                       _genericAttributeService.Object,
                                                       _customerRepo.Object,
                                                       _customerCustomerRoleMappingRepo.Object,
                                                       _customerPasswordRepo.Object,
                                                       _customerRoleRepo.Object,
                                                       _genericAttributeRepo.Object,
                                                       _shoppingCartRepo.Object,
                                                       new TestCacheManager(),
                                                       null);

            var customer = new TestCustomer();
            var address  = new Address {
                Id = 1
            };

            customer.AddAddresses(address);
            customer.BillingAddress = address;

            customer.BillingAddress.ShouldBeTheSameAs(customer.Addresses.First());

            _customerService.RemoveCustomerAddress(customer, address);
            customer.Addresses.Count.ShouldEqual(0);
            customer.BillingAddress.ShouldBeNull();
        }