Esempio n. 1
0
        public async Task Test_Booking()
        {
            var flightId = Guid.NewGuid();
            var seatId   = "5A";

            await AssertFlightState(flightId, seatId, SeatState.Free);

            var actual = await flightsClient.HoldSeatAsync(flightId, seatId, "luke");

            actual.IsSuccess.Should().BeTrue();
            await AssertFlightState(flightId, seatId, SeatState.TemporarilyHeld);

            actual = await flightsClient.BuySeatAsync(flightId, seatId, "dart");

            actual.IsSuccess.Should().BeFalse();

            actual = await flightsClient.BuySeatAsync(flightId, seatId, "luke");

            actual.IsSuccess.Should().BeTrue();
            await AssertFlightState(flightId, seatId, SeatState.Busy);
        }
        public async Task <IActionResult> HoldSeat(Guid flightId, string userId, string seatId)
        {
            var result = await flightsClient.HoldSeatAsync(flightId, seatId, userId).ConfigureAwait(true);

            return(Ok(result));
        }