public async void Test_FlightController_PutAsync_ShouldBeOk()
        {
            var updateCommand = HotelReservationUpdateCommandBuilder.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;
        }
Exemple #2
0
        public async Task Deveria_atualizar_reserva_de_hotel_com_sucesso()
        {
            int expected = 1;
            List <HotelReservation> reservations = new List <HotelReservation>()
            {
                HotelReservationBuilder.Start().Build(),
                                    HotelReservationBuilder.Start().Build()
            };

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

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

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

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