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 } }
public void ThenTheEventsForCreatingTheSeatTypeAreEmitted() { foreach (var seat in seats) { Assert.True(MessageLogHelper.CollectEvents <SeatCreated>(seat.Id, 1)); } }
public void ThenTheEventForCalculatingTheTotalIsEmitted(decimal total) { var orderTotalsCalculated = MessageLogHelper.GetEvents <OrderTotalsCalculated>(orderId).SingleOrDefault(); Assert.NotNull(orderTotalsCalculated); Assert.Equal(total, orderTotalsCalculated.Total); Assert.False(orderTotalsCalculated.IsFreeOfCharge); }
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); }
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)); }
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); }
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()); }
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)); } }
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"); }
public void ThenTheEventForConfirmingTheOrderIsNotEmitted() { Assert.False(MessageLogHelper.GetEvents <OrderConfirmed>(orderId).ToList().Any()); }
public void ThenTheEventForConfirmingTheOrderIsEmitted() { Assert.True(MessageLogHelper.CollectEvents <OrderConfirmed>(orderId, 1)); }
public void ThenTheEventForConfirmingThePaymentIsEmitted() { Assert.True(MessageLogHelper.CollectEvents <PaymentCompleted>(paymentId, 1)); }