public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await selectJourneysScenario.Execute();

            var bookingId = selectJourneysScenario.BookingId;
        }
Esempio n. 2
0
        public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await HostedService.StartAsync(CancellationToken.None);

            await selectJourneysScenario.Execute();

            await HostedService.StopAsync(CancellationToken.None);

            var bookingId = selectJourneysScenario.BookingId;
        }
        public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await selectJourneysScenario.Execute();

            var bookingId = selectJourneysScenario.BookingId;

            //Assert
            var query   = new BookingIdQuery(bookingId.Value);
            var booking = await QueryProcessor.ProcessAsync(query, CancellationToken.None);

            booking.Journeys.Should().NotBeEmpty();
        }
        public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await HostedService.StartAsync(CancellationToken.None);

            await selectJourneysScenario.Execute();

            await HostedService.StopAsync(CancellationToken.None);

            var bookingId = selectJourneysScenario.BookingId;

            JourneySelectedConsumer.Origin.Should().Be("MEL");
            JourneySelectedConsumer.Destination.Should().Be("SYD");
        }
        public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await selectJourneysScenario.Execute();

            var bookingId = selectJourneysScenario.BookingId;

            //Assert
            var bookings = await _bookingReadModel.FindAsync(rm => rm.Id == bookingId, CancellationToken.None);

            var booking = bookings.First();

            booking.Journeys.Should().NotBeEmpty();
        }
        public async Task AfterSelectedJourneysShouldAddJourneysToReadModel()
        {
            //Arrange
            var selectJourneysScenario = new SelectJourneysScenario(CommandBus);

            //Act
            await selectJourneysScenario.Execute();

            var bookingId = selectJourneysScenario.BookingId;

            //Assert
            using (var context = _contextProvider.CreateContext())
            {
                var booking = await context.Bookings
                              .Include(x => x.Journeys)
                              .Include(x => x.Passengers)
                              .SingleAsync(x => x.Id == bookingId.Value, CancellationToken.None);

                booking.Journeys.Should().NotBeEmpty();
            }
        }