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;
            }
        }
示例#2
0
        public void ReturnExpetedProductTypeWhenProductIdPassed(int productId, string expectedProductType)
        {
            var actualProductType = productTypeCollection.GetProductType(productId);

            actualProductType.Should().Be(expectedProductType);
        }