Beispiel #1
0
        private static void Main(string[] pArguments)
        {
            taxAssessor       = new TaxRateAssesor(new Percentage(10), new Percentage(5));
            _roundingStrategy = new RoundUpToNearestOneTwentiethRoundingRule();
            initializeInventory();

            var mainMenu = new Dictionary <string, string>()
            {
                { "P", "Products" }, { "N", "New Shopping Cart" }
            };

            presentMenu("Main Menu", mainMenu, "X", processCommand);
            Console.WriteLine();
            Console.WriteLine("Thank you, come again...");
        }
        public void Setup()
        {
            var id = 0;

            _products = new List <Product>()
            {
                createProduct(id++, "book", 12.49m, pType: ProductCategoryEnum.Books),
                createProduct(id++, "music CD", 14.99m),
                createProduct(id++, "chocolate bar", 0.85m, pType: ProductCategoryEnum.Food),
                createProduct(id++, "imported box of chocolates", 10m, true, ProductCategoryEnum.Food),
                createProduct(id++, "imported bottle of perfume", 47.50m, true),
                createProduct(id++, "imported bottle of perfume", 27.99m, true),
                createProduct(id++, "bottle of perfume", 18.99m),
                createProduct(id++, "packet of headache pills", 9.75m, pType: ProductCategoryEnum.Medical),
                createProduct(id++, "box of imported chocolates", 11.25m, true, ProductCategoryEnum.Food)
            };
            _taxAssessor      = new TaxRateAssesor(new Percentage(10), new Percentage(5));
            _roundingStrategy = new RoundUpToNearestOneTwentiethRoundingRule();
        }
Beispiel #3
0
 public void Setup()
 {
     _baseSalesTax   = new Percentage(10);
     _importTariff   = new Percentage(5);
     _taxRateAssesor = new TaxRateAssesor(_baseSalesTax, _importTariff);
 }
Beispiel #4
0
 public ShoppingCart(IEnumerable <Product> pItems, IProvideTaxRateForProduct taxAssessor, IRoundingStrategy roundingStrategy)
 {
     _items            = pItems.ToList();
     _taxAssessor      = taxAssessor;
     _roundingStrategy = roundingStrategy;
 }
Beispiel #5
0
 // TODO: inject these with IoC
 public ShoppingCart(IProvideTaxRateForProduct taxAssessor, IRoundingStrategy roundingStrategy)
 {
     _items            = new List <Product>();
     _taxAssessor      = taxAssessor;
     _roundingStrategy = roundingStrategy;
 }