public async Task <IActionResult> Post([FromBody] RoomBookingDTO roomBookingDto, CancellationToken ct)
        {
            var addBooking = new BookGuestRoomOnAccount(
                Guid.NewGuid(),
                roomBookingDto.DateOfFirstNight,
                Enum.Parse <RoomType>(roomBookingDto.RoomType),
                Convert.ToDouble(roomBookingDto.Amount),
                roomBookingDto.NumberOfNights,
                roomBookingDto.NumberOfGuests,
                roomBookingDto.AccountId
                );

            await _commandProcessor.SendAsync(addBooking, false, ct);

            var booking = await _queryProcessor.ExecuteAsync(new GetBookingById(addBooking.BookingId), ct);

            return(Ok(RoomBookingDTO.FromQueryResult(booking)));
        }
        public async Task When_adding_a_room_booking_on_account()
        {
            using (var uow = new BookingContext(_options))
            {
                //arrange
                var booking = new BookGuestRoomOnAccount()
                {
                    BookingId        = Guid.NewGuid(),
                    AccountId        = Guid.NewGuid().ToString(),
                    DateOfFirstNight = DateTime.UtcNow,
                    NumberOfNights   = 1,
                    NumberOfGuests   = 1,
                    Type             = RoomType.King,
                    Price            = 120
                };

                var commandProcessor = new FakeCommandProcessor();
                var handler          = new BookGuestRoomOnAccountHandlerAsync(_options, commandProcessor);

                //act
                await handler.HandleAsync(booking);

                //assert
                var roomBookingRepositoryAsync = new RoomBookingRepositoryAsync(new EFUnitOfWork(uow));
                var savedBooking = await roomBookingRepositoryAsync.GetAsync(booking.BookingId);

                Assert.That(savedBooking.RoomBookingId, Is.EqualTo(booking.BookingId));
                Assert.That(savedBooking.DateOfFirstNight, Is.EqualTo(booking.DateOfFirstNight));
                Assert.That(savedBooking.NumberOfNights, Is.EqualTo(booking.NumberOfNights));
                Assert.That(savedBooking.NumberOfGuests, Is.EqualTo(booking.NumberOfGuests));
                Assert.That(savedBooking.RoomType, Is.EqualTo(booking.Type));
                Assert.That(savedBooking.Price, Is.EqualTo(booking.Price));
                Assert.That(savedBooking.AccountId, Is.EqualTo(booking.AccountId));

                Assert.That(commandProcessor.AllSent);
                Assert.That(commandProcessor.RaiseRoomBookingEvent);
            }
        }