コード例 #1
0
        public void GetReceipt()
        {
            GivenBooks();
            var bookStore = new BookStore(_books);
            var buyBook   = bookStore.BuyBook("Dustin", "b");

            Assert.AreEqual("Customer : Dustin, Book Name : b", buyBook);
        }
コード例 #2
0
        public void GetPriceWithoutD()
        {
            GivenBooks();
            var bookStore = new BookStore(_books);
            var buyList   = new List <KeyValuePair <string, int> >()
            {
                new KeyValuePair <string, int>("a", 3),
                new KeyValuePair <string, int>("b", 2),
                new KeyValuePair <string, int>("c", 3),
            };
            var totalPrice = bookStore.GetPrice(buyList);

            Assert.AreEqual(100 * 1 * 0.9 + 150 * 2 * 0.7 + 300 * 3 * 0.8, totalPrice);
        }