예제 #1
0
        public async Task <IActionResult> Delete([FromBody] TravelPackageReservationDeleteCommand flightDeleteCmd)
        {
            var result = await _mediator.Send(flightDeleteCmd);

            if (result)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
예제 #2
0
        public async Task Deveria_excluir_reserva_de_pacote_com_sucesso()
        {
            int expected = 1;

            TravelPackageReservation reservation = TravelPackageReservationBuilder.Start()
                                                   .WithInputDate(DateTime.Now.AddDays(11))
                                                   .Build();

            _fakeRepository.Setup(x => x.GetById(It.IsAny <int>())).ReturnsAsync(reservation);

            var cmd = new TravelPackageReservationDeleteCommand()
            {
                TravelPackageId = 1
            };

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

            result.Should().BeTrue();
            _fakeRepository.Verify(x => x.GetById(cmd.TravelPackageId), Times.Once);
            _fakeRepository.Verify(x => x.DeleteById(cmd.TravelPackageId), Times.Once);
        }