Example #1
0
 public void When_confirming_an_order_that_is_late()
 {
     offer.Stub(x => x.IsNotSatisfiedBy(timeOrderWasPlaced, timePizzaDelivered)).Return(true);
     var order = new OrderForDelivery(id, customerId, restaurantId, menuItemIds, timeOrderWasPlaced, offer);
     
     using (DomainEvents.Register<DeliveryGuaranteeFailed>(setTestFlag))
     {
         order.ConfirmReceipt(timePizzaDelivered);
     }
 }
        public void If_an_order_is_not_delivered_within_the_agreed_upon_timeframe()
        {
            var offer = new ThirtyMinuteDeliveryGuaranteeOffer();
            
            // took longer than 30 minutes - failing the delivery guarantee
            var timeOrderWasReceived = timeOrderWasPlaced.AddMinutes(31);

            var order = new OrderForDelivery(
                orderId, customerId, restaurantId, itemIds, timeOrderWasPlaced, offer
            );

            repo.Stub(r => r.FindBy(orderId)).Return(order);
            var service = new ConfirmDeliveryOfOrder(repo, bus);
            service.Confirm(timeOrderWasReceived, orderId);
        }