public async Task EditSalarioCommand()
        {
            var commandBuilder = new EditSalarioCommandBuilder()
                                 .ComId(new Guid("32cd6820-0da5-4c5f-94d1-e73b01f05de2"))
                                 .ComPagamento(decimal.One)
                                 .ComAdiantamento(decimal.One)
                                 .Instanciar();

            commandBuilder.IsValid();

            _mocker.GetMock <IMediator>().Setup(x => x.Publish(It.IsAny <DomainNotification>(), default)).Returns(Task.CompletedTask);
            _mocker.GetMock <ISalarioRepository>().Setup(x => x.UpdateAsync(It.IsAny <Salario>(), default))
            .Returns(Task.CompletedTask)
            .Callback <Salario, CancellationToken>((objeto, token) =>
            {
                objeto.Id.Should().NotBeEmpty();
                objeto.Id.Should().Be(commandBuilder.Id);
                objeto.Pagamento.Should().Be(commandBuilder.Pagamento);
                objeto.Adiantamento.Should().Be(commandBuilder.Adiantamento);
                objeto.Status.Should().BeTrue();
            });

            var resultado = await _commandHandler.Handle(commandBuilder, default);

            resultado.Should().BeTrue();
            _mocker.Verify <IMediator>(x => x.Publish(It.IsAny <DomainNotification>(), default), Times.Never);
            _mocker.Verify <ISalarioRepository>(x => x.UpdateAsync(It.IsAny <Salario>(), default), Times.Once);
        }
        public void DeveValidarId()
        {
            var command = new EditSalarioCommandBuilder()
                          .ComAdiantamento(decimal.One)
                          .ComPagamento(decimal.One)
                          .Instanciar();

            command.IsValid();

            command.ValidationResult.IsValid.Should().BeFalse();
            command.ValidationResult.Errors[0].ErrorMessage.Should().Be("Id salário inválido");
        }
        public void DeveValidarAdiantamento(decimal valor)
        {
            var command = new EditSalarioCommandBuilder()
                          .ComId(Guid.NewGuid())
                          .ComAdiantamento(valor)
                          .ComPagamento(decimal.One)
                          .Instanciar();

            command.IsValid();

            command.ValidationResult.IsValid.Should().BeFalse();
            command.ValidationResult.Errors[0].ErrorMessage.Should().Be("O valor Adiantamento deve ser maior que zero");
        }
        public async Task EditSalarioCommandValidar()
        {
            var commandBuilder = new EditSalarioCommandBuilder().Instanciar();

            commandBuilder.IsValid();

            _mocker.GetMock <IMediator>().Setup(x => x.Publish(It.IsAny <DomainNotification>(), default))
            .Returns(Task.CompletedTask)
            .Callback <DomainNotification, CancellationToken>((notification, token) =>
            {
                notification.Should().NotBeNull();
                commandBuilder.ValidationResult.Errors
                .FirstOrDefault(x => x.PropertyName == notification.Key && x.ErrorMessage == notification.Value)
                .Should().NotBeNull();
                token.IsCancellationRequested.Should().BeFalse();
            });

            var resultado = await _commandHandler.Handle(commandBuilder, default);

            resultado.Should().BeFalse();
            _mocker.Verify <IMediator>(x => x.Publish(It.IsAny <DomainNotification>(), default), Times.Exactly(3));
            _mocker.Verify <ISalarioRepository>(x => x.UpdateAsync(It.IsAny <Salario>(), default), Times.Never);
        }