public void ShouldConvertReturnedAddressItemsToViewModel()
        {
            ICustomerRepository customerRepository = Substitute.For<ICustomerRepository>();
            Customer customer = new Customer();
            customerRepository.GetCustomer(Arg.Any<Guid>()).Returns(customer);

            IAddressItemRepository itemRepository = Substitute.For<IAddressItemRepository>();
            AddressItem[] items = new AddressItem[] { new AddressItem() };
            itemRepository.GetAddressItems(customer).Returns(items);

            IAddressItemMapper mapper = Substitute.For<IAddressItemMapper>();
            mapper.Convert(Arg.Any<AddressItem>()).Returns(new AddressItemData());

            AddressItemAdapter adapter = new AddressItemAdapter(customerRepository, itemRepository);
            adapter.AddressItemMapper = mapper;
            string customerId = Guid.Empty.ToString("N");
            IEnumerable<AddressItemData> models = adapter.GetAddressItems(customerId);

            Assert.AreEqual(1, models.Count(), "The wrong number of view models were returned.");
            customerRepository.Received(1).GetCustomer(Arg.Any<Guid>());
            itemRepository.Received(1).GetAddressItems(customer);
            mapper.Received(1).Convert(Arg.Any<AddressItem>());
        }
 public void Remove(AddressItem item)
 {
     entities.AddressItems.Remove(item);
     entities.SaveChanges();
 }
 public void Add(AddressItem item)
 {
     entities.AddressItems.Add(item);
     entities.SaveChanges();
 }