public void ThenAllTheConferencesAreCreated()
        {
            var failureCollector = new ConcurrentBag <string>();

            Parallel.ForEach(slugs, s =>
            {
                var mConf = ConferenceHelper.FindConference(s);
                if (mConf == null)
                {
                    failureCollector.Add(string.Format("Conference with slug '{0}' not found in management repository.", s));
                    return;
                }
                var success = MessageLogHelper.CollectEvents <AvailableSeatsChanged>(mConf.Id, seatsInfo.Rows.Count);
                if (!success)
                {
                    failureCollector.Add(string.Format("Some seats were not found in Conference '{0}'", mConf.Name));
                }
            });

            if (failureCollector.Count > 0)
            {
                var sb = new StringBuilder();
                failureCollector.ToList().ForEach(s => sb.AppendLine(s));
                Assert.True(failureCollector.Count == 0, sb.ToString()); // raise error with all the failures
            }
        }
Пример #2
0
 public void ThenTheEventsForCreatingTheSeatTypeAreEmitted()
 {
     foreach (var seat in seats)
     {
         Assert.True(MessageLogHelper.CollectEvents <SeatCreated>(seat.Id, 1));
     }
 }
Пример #3
0
        public void ThenTheEventForCalculatingTheTotalIsEmitted(decimal total)
        {
            var orderTotalsCalculated = MessageLogHelper.GetEvents <OrderTotalsCalculated>(orderId).SingleOrDefault();

            Assert.NotNull(orderTotalsCalculated);
            Assert.Equal(total, orderTotalsCalculated.Total);
            Assert.False(orderTotalsCalculated.IsFreeOfCharge);
        }
Пример #4
0
        public void ThenTheEventForCompletingTheOrderReservationIsEmitted()
        {
            var orderReservationCompleted = MessageLogHelper.GetEvents <OrderReservationCompleted>(orderId).SingleOrDefault();

            Assert.NotNull(orderReservationCompleted);
            Assert.Equal(registerToConference.Seats.Count, orderReservationCompleted.Seats.Count());
            Assert.True(orderReservationCompleted.ReservationExpiration > DateTime.Now);
        }
Пример #5
0
        public void ThenTheEventForOrderPlacedIsEmitted()
        {
            Assert.True(MessageLogHelper.CollectEvents <OrderPlaced>(orderId, 1));

            var orderPlaced = MessageLogHelper.GetEvents <OrderPlaced>(orderId).Single();

            Assert.True(orderPlaced.Seats.All(
                            os => registerToConference.Seats.Count(cs => cs.SeatType == os.SeatType && cs.Quantity == os.Quantity) == 1));
        }
Пример #6
0
        public void TestReadingErrorlogFromFile()
        {
            var list       = new MessageLogHelper().GetMessagelogFromFile(LOGFILE);
            var repository = new Repository();

            repository.Fill(list);
            var result = repository.GetErrorLog(DateTime.MinValue);

            Assert.Equal(4, result.Count);
        }
Пример #7
0
        public void ThenTheEventForReservingTheSelectedSeatsIsEmitted()
        {
            registerToConference = registerToConference ?? ScenarioContext.Current.Get <RegisterToConference>();

            // Wait and Check for SeatsReserved event was emitted
            Assert.True(MessageLogHelper.CollectEvents <SeatsReserved>(registerToConference.ConferenceId, 1));
            var seatsReserved = MessageLogHelper.GetEvents <SeatsReserved>(registerToConference.ConferenceId).SingleOrDefault();

            Assert.NotNull(seatsReserved);
            Assert.Equal(registerToConference.Seats.Count, seatsReserved.AvailableSeatsChanged.Count());
        }
Пример #8
0
        public void ThenTheseOrderItemsShouldNotBeReserved(Table table)
        {
            var orderReservationCompleted = MessageLogHelper.GetEvents <OrderReservationCompleted>(orderId).SingleOrDefault();

            Assert.NotNull(orderReservationCompleted);

            var conferenceInfo = ScenarioContext.Current.Get <ConferenceInfo>();

            foreach (var row in table.Rows)
            {
                var seat = conferenceInfo.Seats.FirstOrDefault(s => s.Description == row["seat type"]);
                Assert.NotNull(seat);
                Assert.False(orderReservationCompleted.Seats.Any(s => s.SeatType == seat.Id));
            }
        }
Пример #9
0
 public void ThenTheEventForPublishingTheConferenceIsEmitted()
 {
     Assert.True(MessageLogHelper.CollectEvents <ConferencePublished>(conference.Id, 1));
 }
 public void ThenSomeEventsForPartiallyCompletingTheOrderAreEmitted(int eventCount)
 {
     Assert.True(MessageLogHelper.CollectEvents <OrderPartiallyReserved>(orderIds, eventCount), "Timeout for Collecting OrderPartiallyReserved Events");
 }
 public void ThenOnlySomeEventsForCompletingTheOrderReservationAreEmitted(int eventCount)
 {
     Assert.True(MessageLogHelper.CollectEvents <OrderReservationCompleted>(orderIds, eventCount), "Timeout for Collecting OrderReservationCompleted Events");
 }
Пример #12
0
 public void ThenTheEventForConfirmingTheOrderIsNotEmitted()
 {
     Assert.False(MessageLogHelper.GetEvents <OrderConfirmed>(orderId).ToList().Any());
 }
Пример #13
0
 public void ThenTheEventForConfirmingTheOrderIsEmitted()
 {
     Assert.True(MessageLogHelper.CollectEvents <OrderConfirmed>(orderId, 1));
 }
Пример #14
0
 public void ThenTheEventForConfirmingThePaymentIsEmitted()
 {
     Assert.True(MessageLogHelper.CollectEvents <PaymentCompleted>(paymentId, 1));
 }