示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public CommandResult CreatePet([FromBody] PetCreateCommand command
                                , [FromServices] PetCreateHandler handler)
 {
     return((CommandResult)handler.Handle(command));
 }