Ejemplo n.º 1
0
        public void Addressee_Service_Update_Sucessfully()
        {
            //Arrange
            var addressee    = ObjectMother.AddresseeValidWithIdWithAddress();
            var addresseeCmd = ObjectMother.AddresseeCommandToUpdate();
            var updated      = true;

            _mockAddresseeRepository.Setup(e => e.GetById(addresseeCmd.Id)).Returns(addressee);
            _mockAddresseeRepository.Setup(er => er.Update(addressee)).Returns(updated);

            //Action
            var updateAddressee = _addresseeService.Update(addresseeCmd);

            //Assert
            _mockAddresseeRepository.Verify(e => e.GetById(addresseeCmd.Id), Times.Once);
            _mockAddresseeRepository.Verify(er => er.Update(addressee), Times.Once);
            updateAddressee.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public IHttpActionResult Update(AddresseeUpdateCommand command)
        {
            var validador = command.Validate();

            if (!validador.IsValid)
            {
                return(HandleValidationFailure(validador.Errors));
            }

            return(HandleCallback(_service.Update(command)));
        }