public void AddTax_DoesNotAddTax_To_Books()
        {
            var taxDecorator = new TaxDecoratorService();

            var purchaseItem = new PurchaseItem("book", 12.49m);

            var withoutTax = taxDecorator.AddTax(purchaseItem);

            Assert.Equal(12.49m, withoutTax.GetPrice());
        }
        public void AddTax_DoesAddTax_To_CD()
        {
            var taxDecorator = new TaxDecoratorService();

            var purchaseItem = new PurchaseItem("music CD", 14.99m);

            var withoutTax = taxDecorator.AddTax(purchaseItem);

            Assert.Equal(16.49m, withoutTax.GetPrice());
        }
        public void AddTax_DoesAddDuty_AndTax_To_ImportedPerfume()
        {
            var taxDecorator = new TaxDecoratorService();

            // just import tax
            var purchaseItem = new PurchaseItem("imported bottle of perfume", 27.99m);

            var withoutTax = taxDecorator.AddTax(purchaseItem);

            Assert.Equal(32.19m, withoutTax.GetPrice());
        }
        public void AddTax_DoesAddDuty_To_ImportedItems()
        {
            var taxDecorator = new TaxDecoratorService();

            // just import tax
            var purchaseItem = new PurchaseItem("imported box of chocolates", 10.00m);

            var withoutTax = taxDecorator.AddTax(purchaseItem);

            Assert.Equal(10.50m, withoutTax.GetPrice());
        }
        public Receipt CreateReceipt(IList <string> textItems)
        {
            var receipt = new Receipt();

            // each item will be on a new line so can call deserialisation service
            foreach (var textItem in textItems)
            {
                var(quantity, purchaseItem) = _deserialisationService.CreatePurchaseItem(item: textItem);

                for (int i = 0; i < quantity; i++)
                {
                    var itemWithTax = _taxDecoratorService.AddTax(purchaseItem);
                    receipt.AddPurchaseItem(itemWithTax);
                }
            }

            return(receipt);
        }