Ejemplo n.º 1
0
        public void CostOfTwoBooksWithSameTitleNames_ShouldDiscount_zeroPercent()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Sorcerer's stone"] = 2;

            double expected  = 16.00;
            var    BookStore = new BookStore();
            double actual    = BookStore.BookCost(bookOrder);

            //Console.WriteLine("actual: " + actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void CostOfOneBookReturnsDollar8()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Sorcerer's stone"] = 1;

            double expected  = 8;
            var    BookStore = new BookStore();
            double actual    = BookStore.BookCost(bookOrder);

            //Console.WriteLine("actual: " + actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void CostOfThreeBooksWithThreeDifferentTitleNames_ShouldDiscount_TenPercent()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Harry Potter and the Prisoner of Azkaban"] = 1;
            bookOrder["Harry Potter and the Goblet of fire"]      = 1;
            bookOrder["Harry Potter and the Order of Phoenix"]    = 1;

            double    expected = 21.6;
            BookStore store    = new BookStore();
            double    actual   = store.BookCost(bookOrder);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void CostOfTwoBooksWithDifferentTitleNames_ShouldDiscount_FivePercent()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Sorcerer's stone"]   = 1;
            bookOrder["Chamber Of Secrets"] = 1;

            double expected  = 15.20;
            var    BookStore = new BookStore();
            double actual    = BookStore.BookCost(bookOrder);

            //Console.WriteLine("actual: " + actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void CostOfFiveBooksWithFiveDifferentTitleNames_ShouldDiscount_TwentyFivePercent()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Harry Potter and the Prisoner of Azkaban"] = 1;
            bookOrder["Harry Potter and the Goblet of fire"]      = 1;
            bookOrder["Harry Potter and the Order of Phoenix"]    = 1;
            bookOrder["Harry Potter and the Half-Blood Prince"]   = 1;
            bookOrder["Harry Potter and the Deathly Hallows"]     = 1;

            double    expected = 30;
            BookStore store    = new BookStore();
            double    actual   = store.BookCost(bookOrder);

            Console.WriteLine("actual: " + actual);
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 6
0
        public void BasketOfBooksWithAllFiveTitlesAndDifferentOrderQuantities_ShouldReturnProperDiscounts()
        {
            Dictionary <string, int> bookOrder = new Dictionary <string, int>();

            bookOrder["Sorcerer's stone"]     = 2;
            bookOrder["Chamber of secrest"]   = 2;
            bookOrder["Prisoner  of Azkaban"] = 2;
            bookOrder["Goblet of fire"]       = 1;
            bookOrder["Order of the Phoenix"] = 1;


            double expected  = 51.60;
            var    BookStore = new BookStore();
            double actual    = BookStore.BookCost(bookOrder);

            //Console.WriteLine("actual: " + actual);
            Assert.AreEqual(expected, actual);
        }