Exemplo n.º 1
0
        public void NotGenerateShippingSlipWhenOrderHasNotPhysicalProducts()
        {
            var businessRules = new List <IBusinessRule> {
                _shippingSlip
            };
            var purchaseOrderService = new PurchaseOrderService(businessRules);

            purchaseOrderService.Process(_orderWithDigitalProducts);

            _shippingSlipServiceMock.Verify(s => s.GenerateShippingSlip(OrderId, CustomerId, It.IsAny <IEnumerable <Product> >()), Times.Never);
        }
Exemplo n.º 2
0
        public void NotActivateMembershipWhenProcessProductsOrder()
        {
            var businessRules = new List <IBusinessRule> {
                _activateMembership
            };
            var purchaseOrderService = new PurchaseOrderService(businessRules);

            purchaseOrderService.Process(_orderWithPhysicalProducts);

            _customerServiceMock.Verify(c => c.ActivateMembership(CustomerId, It.IsAny <Membership>()), Times.Never);
        }
Exemplo n.º 3
0
        public void ActivateMembershipWhenProcessMembershipOrder()
        {
            var businessRules = new List <IBusinessRule> {
                _activateMembership
            };
            var purchaseOrderService = new PurchaseOrderService(businessRules);

            purchaseOrderService.Process(_orderWithMembership);

            _customerServiceMock.Verify(c => c.ActivateMembership(CustomerId, It.IsAny <Membership>()));
        }
Exemplo n.º 4
0
        public void GenerateShippingSlipForPhysicalProducts()
        {
            var businessRules = new List <IBusinessRule> {
                _shippingSlip
            };
            var purchaseOrderService = new PurchaseOrderService(businessRules);

            purchaseOrderService.Process(_orderWithPhysicalProducts);

            Expression <Func <IEnumerable <Product>, bool> > collectionContainsPhysicalProductPredicate =
                ps => ps.First().Title == TheGirlOnTheTrainTitle &&
                ps.Count() == 1;

            _shippingSlipServiceMock.Verify(s => s.GenerateShippingSlip(OrderId, CustomerId, It.Is(collectionContainsPhysicalProductPredicate)), Times.Once);
        }