예제 #1
0
        public void Generates_Packing_Slip()
        {
            var packingSlipGenerator = new MockPackingSlipGenerator();

            Payment payment = new Payment();
            payment.ProductBeingPurchased = new Product();
            payment.ProductBeingPurchased.IsPhysical = true;

            OrderProcessor processor = new OrderProcessor(packingSlipGenerator);
            PaymentResult result = processor.Process(payment);
            Assert.IsTrue(result.GeneratePackingSlip);
        }
예제 #2
0
        public void should_activate_membership()
        {
            var payment = new Payment() { ProductBeingPurchased = new Membership() };
            var processor = new OrderProcessor();

            var result = processor.Process(payment);

            Assert.IsTrue(((Membership)payment.ProductBeingPurchased).IsActivated);
        }
예제 #3
0
        public void should_upgrade_membership()
        {
            var payment = new Payment() { ProductBeingPurchased = new UpgradeMembership() };
            var processor = new OrderProcessor();

            var result = processor.Process(payment);

            Assert.IsTrue(((UpgradeMembership)payment.ProductBeingPurchased).IsUpgraded);
        }
예제 #4
0
        public void Creates_A_Duplicate_PackingSlip_For_The_RoyaltyDepartment()
        {
            var packingSlipGenerator = new MockPackingSlipGenerator();

            var payment = new Payment() { ProductBeingPurchased = new Book() };
            var processor = new OrderProcessor(packingSlipGenerator);

            var result = processor.Process(payment);

            Assert.AreEqual(2, packingSlipGenerator.PackingSlipCount);
        }