public async Task PutNaoDeveEditarSalarioBadRequest() { var model = new EditSalarioCommandView(); var salarioCommand = new EditSalarioCommand(); _notificationMock.Setup(x => x.HasNotifications()).Returns(true); _mapperMock.Setup(x => x.Map <EditSalarioCommand>(model)).Returns(salarioCommand); _mediatorMock.Setup(x => x.Send(salarioCommand, default)).ReturnsAsync(false); var viewResult = (await _controller.PutAsync(model)) as ObjectResult; viewResult.StatusCode.Should().Be(400); viewResult.Should().BeOfType <ObjectResult>(); }
public async Task DeveValidarSalarioAntesDeEditarESalvar() { var command = new EditSalarioCommand(); var resultado = await _mediator.Send(command); resultado.Should().BeFalse(); _notifications.HasNotifications().Should().BeTrue(); _notifications.GetNotifications().Should().HaveCount(3); var resultadoBusca = await _salarioRepository.GetAllAsync(); resultadoBusca.FirstOrDefault().Should().BeNull(); }
public async Task DeveEditarUmSalario() { var salario = new Salario(12345.88M, 9875.00M); await _fixture.CriarAsync(salario); var command = new EditSalarioCommand { Id = salario.Id, Pagamento = 3178.62M, Adiantamento = 2819.75M }; var resultado = await _mediator.Send(command); var resultadoBusca = await _salarioRepository.GetByIdAsync(command.Id); resultado.Should().BeTrue(); resultadoBusca.Should().NotBeNull(); resultadoBusca.Pagamento.Should().Be(command.Pagamento); resultadoBusca.Adiantamento.Should().Be(command.Adiantamento); resultadoBusca.Status.Should().BeTrue(); }
public async Task PutDeveEditarSalarioOkResult() { var model = new EditSalarioCommandView { Id = new Guid("10AFDB5E-D7D1-4773-B040-F7B6F610484F"), Adiantamento = decimal.One, Pagamento = decimal.One }; var salarioCommand = new EditSalarioCommand { Id = new Guid("10AFDB5E-D7D1-4773-B040-F7B6F610484F"), Adiantamento = decimal.One, Pagamento = decimal.One }; _notificationMock.Setup(x => x.HasNotifications()).Returns(false); _mapperMock.Setup(x => x.Map <EditSalarioCommand>(model)).Returns(salarioCommand); _mediatorMock.Setup(x => x.Send(salarioCommand, default)).ReturnsAsync(true); var viewResult = (await _controller.PutAsync(model)) as ObjectResult; viewResult.StatusCode.Should().Be(200); viewResult.Should().BeOfType <ObjectResult>(); }