public async void Test_CarController_PutAsync_ShouldBeOk()
        {
            var updateCommand = CarReservationUpdateCommandBuilder.Start().WithId(1).Build();

            _fakeMediator.Setup(mdtr => mdtr.Send(updateCommand, It.IsAny <CancellationToken>()))
            .ReturnsAsync(true);

            var callback = await _controller.Update(updateCommand);

            var response = callback.Should().BeOfType <OkResult>().Subject;
        }
Пример #2
0
        public async Task Deveria_atualizar_reserva_de_carro_com_sucesso()
        {
            int expected = 1;
            List <CarReservation> reservations = new List <CarReservation>()
            {
                CarReservationBuilder.Start().Build(),
                                  CarReservationBuilder.Start().Build()
            };

            _fakeRepository.Setup(x => x.GetAll()).ReturnsAsync(reservations);

            var cmd = CarReservationUpdateCommandBuilder.Start().Build();

            var result = await _handler.Handle(cmd, It.IsAny <CancellationToken>());

            result.Should().BeTrue();
            _fakeRepository.Verify(x => x.Update(It.IsAny <CarReservation>()), Times.Once);
        }