コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public CommandResult CreateOwner(
     [FromBody] OwnerCreateCommand command, [FromServices] OwnerCreateHandler handler)
 {
     return((CommandResult)handler.Handle(command));
 }