Ejemplo n.º 1
0
        /// <summary>
        /// Contains common code block for both Purchase test methods. 
        /// </summary>
        /// <param name="cLevel">The customer level. </param>
        private void CommonPurchaseTest(CustomerLevel cLevel)
        {
            var customer = new Customer(cLevel);
            var randBook = mockBookOrderingSystem.Object.ViewAvailableBooks()[0];

            mockBookOrderingSystem.Object.OrderBookCopy(
                customer, randBook);
        }
Ejemplo n.º 2
0
        public void OrderBookTest()
        {
            var customer = new Customer(CustomerLevel.GOLD);
            var randBook = mockBookOrderingSystem.Object.ViewAvailableBooks()[0];

            //book ordered
            mockBookOrderingSystem.Object.OrderBookCopy(
                customer, randBook);

            //-1 since a book copy was purchased
            Assert.AreEqual(bookCopiesData[randBook] - 1, mockBookOrderingSystem.Object.ViewBookCopiesByBook(randBook).Count,
                "Count should be less than " + bookCopiesData[randBook] + " since a copy was ordered. ");

            //book returned
            Assert.IsTrue(mockBookOrderingSystem.Object.ReturnBookCopy(
                customer, randBook), "The book should've been returned. ");

            //since the book was returned, the count should be normal
            Assert.AreEqual(bookCopiesData[randBook], mockBookOrderingSystem.Object.ViewBookCopiesByBook(randBook).Count,
                "Count should be " + bookCopiesData[randBook] + ". ");
        }