public void HandlerValid() { var command = new OwnerCreateCommand(); command.Name = new ValueObjects.Name(firstName: "Diego", lastName: "Magalhaes"); command.Document = new ValueObjects.Document("42413399054", Entities.Enums.EDocumentType.CPF); var handle = new OwnerCreateHandler(new OwnerRepositoryTest()); var result = (CommandResult)handle.Handle(command); Assert.AreEqual(true, result.Ok); }
public void HandlerFail() { var command = new OwnerCreateCommand(); command.Name = new ValueObjects.Name(firstName: "", lastName: ""); command.Document = new ValueObjects.Document("00000000", Entities.Enums.EDocumentType.CPF); var handle = new OwnerCreateHandler(new OwnerRepositoryTest()); var result = (CommandResult)handle.Handle(command); Assert.AreEqual(false, result.Ok); }
public CommandResult CreateOwner( [FromBody] OwnerCreateCommand command, [FromServices] OwnerCreateHandler handler) { return((CommandResult)handler.Handle(command)); }