Example #1
0
        public void GetTotalPriceTest_Buy_3_Diff_Book_Discount_10Percentage_TotalPrice_270()
        {
            //arrange
            List <Book> Books = new List <Book>
            {
                new Book {
                    Name = HarryPortalBooksName.Series1st, Unit = 1
                },
                new Book {
                    Name = HarryPortalBooksName.Series2nd, Unit = 1
                },
                new Book {
                    Name = HarryPortalBooksName.Series3rd, Unit = 1
                },
                new Book {
                    Name = HarryPortalBooksName.Series4th, Unit = 0
                },
                new Book {
                    Name = HarryPortalBooksName.Series5th, Unit = 0
                }
            };
            var     target   = new PortalShoppingCart(unitOfPrice);
            decimal expected = 270.0M;

            //act
            decimal actual = target.FindTheLowerTotalPrice(Books);

            //assert
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void GetTotalPriceTest_Buy_1st_4Qty_2nd_4Qty_3rd_4Qty_4th_2Qty_5th_2Qty_TotalPrice_1280()
        {
            //arrange
            List <Book> Books = new List <Book>
            {
                new Book {
                    Name = HarryPortalBooksName.Series1st, Unit = 4
                },
                new Book {
                    Name = HarryPortalBooksName.Series2nd, Unit = 4
                },
                new Book {
                    Name = HarryPortalBooksName.Series3rd, Unit = 4
                },
                new Book {
                    Name = HarryPortalBooksName.Series4th, Unit = 2
                },
                new Book {
                    Name = HarryPortalBooksName.Series5th, Unit = 2
                }
            };
            var     target   = new PortalShoppingCart(unitOfPrice);
            decimal expected = 1280.0M;

            //act
            decimal actual = target.FindTheLowerTotalPrice(Books);

            //assert
            Assert.AreEqual(expected, actual);
        }