Exemple #1
0
        public void GetCheckedOutCopies_ReturnListOfCopies()
        {
            Patron newPatron = new Patron("Joe");

            newPatron.Save();

            Book newBook = new Book("Gone With the Wind");

            newBook.Save();

            Copy newCopy = new Copy(newBook.GetId());

            newCopy.Save();


            DateTime dueDate = new DateTime(2017, 6, 1);

            newPatron.Checkout(newCopy.GetId(), newPatron.GetId(), dueDate);

            DateTime    currentDate    = new DateTime(2017, 7, 1);
            List <Copy> expectedResult = new List <Copy> {
                newCopy
            };
            List <Copy> actualResult = newPatron.GetCheckedOutCopies(currentDate);



            Assert.Equal(expectedResult, actualResult);
        }
Exemple #2
0
        public void GetCheckedOutCopies_OnlyReturnsCheckedoutBook()
        {
            DateTime dueDate = new DateTime(2017, 6, 1);

            Patron newPatron = new Patron("Joe");

            newPatron.Save();

            Book newBook = new Book("Gone With the Wind");

            newBook.Save();

            Copy copy1 = new Copy(newBook.GetId());

            copy1.Save();
            newPatron.Checkout(copy1.GetId(), newPatron.GetId(), dueDate);

            Copy copy2 = new Copy(newBook.GetId());

            copy2.Save();
            Checkout newCheckout = newPatron.Checkout(copy2.GetId(), newPatron.GetId(), dueDate);

            newCheckout.CheckIn();


            DateTime    currentDate    = new DateTime(2017, 7, 1);
            List <Copy> expectedResult = new List <Copy> {
                copy1
            };
            List <Copy> actualResult = newPatron.GetCheckedOutCopies(currentDate);

            Assert.Equal(expectedResult, actualResult);
        }