Exemplo 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> BuySeat(Guid flightId, string userId, string seatId)
        {
            var result = await flightsClient.BuySeatAsync(flightId, seatId, userId).ConfigureAwait(true);

            return(Ok(result));
        }