예제 #1
0
        public void ShouldUpdateCustomerWhenCommandIsValid()
        {
            var ad = new AddAddressCommand("Rua dona mariinha", "96", "Casa 2", "Santo Antonio", "Viçosa", "MG", "Brasil"
                                           , "36570000", EAddressType.Shipping);
            var ad2 = new AddAddressCommand("Rua dona mariinha", "96", "Casa 2", "Santo Antonio", "Viçosa", "MG", "Brasil"
                                            , "36570000", EAddressType.Shipping);

            var address = new List <AddAddressCommand>();

            address.Add(ad);
            address.Add(ad2);

            var command = new UpdateCustomerCommand(Guid.NewGuid(), "Douglas", "Rocha", "09752725600", "*****@*****.**", "38914821", address);

            var handler = new CustomerHandlers(new FakeCustomerRepository(), new FakeEmailService());

            var result = handler.Handle(command);

            Console.WriteLine(result);

            Assert.AreNotEqual(false, result.Success);
            Assert.AreEqual(true, handler.IsValid);
        }
예제 #2
0
 public CustomerController(ICustomerRepository repository, CustomerHandlers handle)
 {
     _repository = repository;
     _handle     = handle;
 }