Exemplo n.º 1
0
 public void CalculatePrice_OneBook()
 {
     Book b = new Book { Title = "Book 1" };
     PriceCalculator pc = new PriceCalculator();
     var result = pc.CalculatePrice(new List<Book> { b }, pricePerBook);
     Assert.AreEqual(pricePerBook,result);
 }
Exemplo n.º 2
0
        public void CalculatePrice_ZeroBooks()
        {
            PriceCalculator pc = new PriceCalculator();
            var result = pc.CalculatePrice(new List<Book> { }, pricePerBook);
            Assert.AreEqual(0, result);

        }
Exemplo n.º 3
0
 public void CalculatePrice_FiveDifferentBook()
 {
     List<Book> books = new List<Book>();
     for (int i = 0; i < 5; i++)
         books.Add(new Book { Title = "Book " + i.ToString() });
     PriceCalculator pc = new PriceCalculator();
     var result = pc.CalculatePrice(books, pricePerBook);
     Assert.AreEqual(5 * pricePerBook * 0.75, result);
 }
Exemplo n.º 4
0
 public void CalculatePrice_TwoSameBook()
 {
     List<Book> books = new List<Book>();
     for (int i = 0; i < 2; i++)
         books.Add(new Book { Title = "Book 1" });
     PriceCalculator pc = new PriceCalculator();
     var result = pc.CalculatePrice(books, pricePerBook);
     Assert.AreEqual(2 * pricePerBook, result);
 }
Exemplo n.º 5
0
        public void CalculatePrice_MixedBooks()
        {
            List<Book> books = new List<Book>();
            books.Add(new Book { Title = "Book 1" });
            books.Add(new Book { Title = "Book 1" });

            books.Add(new Book { Title = "Book 2" });
            books.Add(new Book { Title = "Book 2" });

            books.Add(new Book { Title = "Book 3" });
            books.Add(new Book { Title = "Book 3" });

            books.Add(new Book { Title = "Book 4" });
            books.Add(new Book { Title = "Book 5" });

            PriceCalculator pc = new PriceCalculator();
            var result = pc.CalculatePrice(books, pricePerBook);
            Assert.AreEqual(51.60, result);

        }