public Object Post([FromBody] CreateCustomerCommand command) { var result = (CreateCustomerCommandResult)_handler.handle(command); if (_handler.Invalid) { return(BadRequest(_handler.Notifications)); } return(result); }
public void ShouldRegisterCustomerWhenCommandIsValid() { var command = new CreateCustomerCommand(); command.FirtName = "Elcio"; command.LastName = "Rodrigo"; command.Document = "12132132132"; command.Email = "*****@*****.**"; command.Phone = "16982174838"; Assert.AreEqual(true, command.Valid()); var handler = new CustomerHandler(new MockCustomerRepository(), new MockEmailService()); var result = handler.handle(command); Assert.AreNotEqual(null, result); Assert.AreEqual(true, handler.IsValid); }