public void HandlerFail() { var command = new PetCreateCommand(); command.Name = new ValueObjects.Name(firstName: "", lastName: ""); command.Breed = ""; var handle = new PetCreateHandler(new PetsRepositoryTest()); var result = (CommandResult)handle.Handle(command); Assert.AreEqual(false, result.Ok); }
public void HandlerValid() { var command = new PetCreateCommand(); command.Name = new ValueObjects.Name(firstName: "Mufasa", lastName: "Magalhaes"); command.Breed = "Husky"; var handle = new PetCreateHandler(new PetsRepositoryTest()); var result = (CommandResult)handle.Handle(command); Assert.AreEqual(true, result.Ok); }
public CommandResult CreatePet([FromBody] PetCreateCommand command , [FromServices] PetCreateHandler handler) { return((CommandResult)handler.Handle(command)); }