public void ItPrintsABasicReceiptMultipleItemsOfDifferentTypes()
        {
            var receipt = new Receipt
            {
                ItemPrices = new List <ItemPrice>
                {
                    new ItemPrice {
                        Name = "Apple", Price = 5
                    },
                    new ItemPrice {
                        Name = "Banana", Price = 3
                    }
                },
                ScannedItems = new List <ScannedItem>
                {
                    new ScannedItem()
                    {
                        Name = "Apple"
                    },
                    new ScannedItem()
                    {
                        Name = "Banana"
                    },
                    new ScannedItem()
                    {
                        Name = "Apple"
                    }
                }
            };
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("Apple x2\t$10.00\r\nBanana x1\t$3.00", receiptPrinter.PrintItems().Trim());
        }
        public void ItPrintsABasicReceiptMultipleItems()
        {
            var receipt = new Receipt
            {
                ItemPrices = new List <ItemPrice>
                {
                    new ItemPrice {
                        Name = "Apple", Price = 1
                    }
                },
                ScannedItems = new List <ScannedItem>
                {
                    new ScannedItem()
                    {
                        Name = "Apple"
                    },
                    new ScannedItem()
                    {
                        Name = "Apple"
                    }
                }
            };
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("Apple x2\t$2.00", receiptPrinter.PrintItems().Trim());
        }
        public void ItPrintsDiscountedPricesAwkwardDecimals()
        {
            var receipt = new Receipt
            {
                ItemPrices = new List <ItemPrice>
                {
                    new ItemPrice {
                        Name = "Apple", Price = 0.3M, Promotion = new BuyOneGetOnePercentOff(10)
                    },
                },
                ScannedItems = new List <ScannedItem>
                {
                    new ScannedItem()
                    {
                        Name = "Apple"
                    },
                    new ScannedItem()
                    {
                        Name = "Apple"
                    }
                }
            };
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("Apple x2\t$0.57", receiptPrinter.PrintItems().Trim());
        }
        public void ItPrintsDiscountedPrices()
        {
            var receipt = new Receipt
            {
                ItemPrices = new List <ItemPrice>
                {
                    new ItemPrice {
                        Name = "Apple", Price = 5, Promotion = new BuyOneGetOneFree()
                    },
                },
                ScannedItems = new List <ScannedItem>
                {
                    new ScannedItem()
                    {
                        Name = "Apple"
                    },
                    new ScannedItem()
                    {
                        Name = "Apple"
                    }
                }
            };
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("Apple x2\t$5.00", receiptPrinter.PrintItems().Trim());
        }
        public void ItPrintsAnEmptyReceiptItems()
        {
            var receipt        = new Receipt();
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("No items found", receiptPrinter.PrintItems().Trim());
        }
 public void ItPrintsABasicReceiptItemWithDecimals()
 {
     var receipt = new Receipt
     {
         ItemPrices = new List<ItemPrice>
         {
             new ItemPrice { Name = "Apple", Price = 0.75M}
         },
         ScannedItems = new List<ScannedItem>
         {
             new ScannedItem() { Name="Apple" }
         }
     };
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("Apple x1\t$0.75", receiptPrinter.PrintItems().Trim());
 }
        public void ItPrintsABasicReceiptItemWithDecimals()
        {
            var receipt = new Receipt
            {
                ItemPrices = new List <ItemPrice>
                {
                    new ItemPrice {
                        Name = "Apple", Price = 0.75M
                    }
                },
                ScannedItems = new List <ScannedItem>
                {
                    new ScannedItem()
                    {
                        Name = "Apple"
                    }
                }
            };
            var receiptPrinter = new ReceiptPrinter(receipt);

            Assert.AreEqual("Apple x1\t$0.75", receiptPrinter.PrintItems().Trim());
        }
 public void ItPrintsABasicReceiptMultipleItemsOfDifferentTypes()
 {
     var receipt = new Receipt
     {
         ItemPrices = new List<ItemPrice>
         {
             new ItemPrice { Name = "Apple", Price = 5},
             new ItemPrice { Name = "Banana", Price = 3}
         },
         ScannedItems = new List<ScannedItem>
         {
             new ScannedItem() { Name="Apple" },
             new ScannedItem() { Name="Banana" },
             new ScannedItem() { Name="Apple" }
         }
     };
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("Apple x2\t$10.00\r\nBanana x1\t$3.00", receiptPrinter.PrintItems().Trim());
 }
 public void ItPrintsABasicReceiptMultipleItems()
 {
     var receipt = new Receipt
     {
         ItemPrices = new List<ItemPrice>
         {
             new ItemPrice { Name = "Apple", Price = 1}
         },
         ScannedItems = new List<ScannedItem>
         {
             new ScannedItem() { Name="Apple" },
             new ScannedItem() { Name="Apple" }
         }
     };
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("Apple x2\t$2.00", receiptPrinter.PrintItems().Trim());
 }
 public void ItPrintsDiscountedPricesAwkwardDecimals()
 {
     var receipt = new Receipt
     {
         ItemPrices = new List<ItemPrice>
         {
             new ItemPrice { Name = "Apple", Price = 0.3M, Promotion = new BuyOneGetOnePercentOff(10)},
         },
         ScannedItems = new List<ScannedItem>
         {
             new ScannedItem() { Name="Apple" },
             new ScannedItem() { Name="Apple" }
         }
     };
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("Apple x2\t$0.57", receiptPrinter.PrintItems().Trim());
 }
 public void ItPrintsDiscountedPrices()
 {
     var receipt = new Receipt
     {
         ItemPrices = new List<ItemPrice>
         {
             new ItemPrice { Name = "Apple", Price = 5, Promotion = new BuyOneGetOneFree()},
         },
         ScannedItems = new List<ScannedItem>
         {
             new ScannedItem() { Name="Apple" },
             new ScannedItem() { Name="Apple" }
         }
     };
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("Apple x2\t$5.00", receiptPrinter.PrintItems().Trim());
 }
 public void ItPrintsAnEmptyReceiptItems()
 {
     var receipt = new Receipt();
     var receiptPrinter = new ReceiptPrinter(receipt);
     Assert.AreEqual("No items found", receiptPrinter.PrintItems().Trim());
 }