public async void Test_FlightController_PutAsync_ShouldBeOk()
        {
            var updateCommand = FlightReservationUpdateCommandBuilder.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_voo_com_sucesso()
        {
            int expected = 1;
            List <FlightReservation> reservations = new List <FlightReservation>()
            {
                FlightReservationBuilder.Start().WithId(1).Build(),
                FlightReservationBuilder.Start().WithId(2).Build()
            };

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

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

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

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