Esempio n. 1
0
        public void ProcessShippingPlusDuplicateAndCommissionSlipWhenSlipGeneratorReturnedTrue()
        {
            _mockPaymentSlipGenerator.Setup(m => m.GenerateComissionSlip()).Returns(true);
            _mockPaymentSlipGenerator.Setup(m => m.GenerateShippingSlip()).Returns(true);
            _mockPaymentSlipGenerator.Setup(m => m.GenerateDuplicateSlip()).Returns(true);

            _bookProcessor.Process();

            _mockPaymentSlipGenerator.Verify(m => m.GenerateComissionSlip(), Times.Once);
            _mockPaymentSlipGenerator.Verify(m => m.GenerateShippingSlip(), Times.Once);
            _mockPaymentSlipGenerator.Verify(m => m.GenerateDuplicateSlip(), Times.Once);
        }
        public void Handle(int productId)
        {
            try
            {
                var productType = _productTypeCollection.GetProductType(productId);

                switch (productType)
                {
                case "PhysicalProduct":
                    _physicalProductProcessor.Process();
                    break;

                case "Book":
                    _bookProcessor.Process();
                    break;

                case "ActivateMembership":
                    _membershipProcessor.ActivateMembership();
                    break;

                case "UpgradeMembership":
                    _membershipProcessor.UpgradeMembership();
                    break;

                case "Video":
                    Console.WriteLine("Option not implemented");
                    break;

                default:
                    break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
        }