コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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));
        }
コード例 #4
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());
        }
コード例 #5
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));
            }
        }
コード例 #6
0
 public void ThenTheEventForConfirmingTheOrderIsNotEmitted()
 {
     Assert.False(MessageLogHelper.GetEvents <OrderConfirmed>(orderId).ToList().Any());
 }