Пример #1
0
        public void Authors_AddBook_AddAuthorsToBooks()
        {
            Authors newAuthors = new Authors("James", 1);

            newAuthors.Save();
            Books newBook = new Books("Of mice and men", 1);

            newBook.Save();

            Books newBooks1 = new Books("Jerry", 1);

            newBooks1.Save();
            Books newBooks2 = new Books("Jerry", 2);

            newBooks2.Save();

            newAuthors.AddBooks(newBooks1);
            newAuthors.AddBooks(newBooks2);

            List <Books> testList    = newAuthors.GetAuthorsBooks();
            List <Books> controlList = new List <Books> {
                newBooks1, newBooks2
            };

            Assert.Equal(controlList, testList);
        }
Пример #2
0
        public void Patrons_AddCopies_AddsCopiesToPatron()
        {
            Patrons newPatron = new Patrons("Jenny", 1);

            newPatron.Save();

            Books newBooks = new Books("Of Mice and Men", 1);

            newBooks.Save();

            Copies newCopies1 = new Copies(1, DateTime.Now, 1);

            newCopies1.Save();
            Copies newCopies2 = new Copies(1, DateTime.Now, 1);

            newCopies2.Save();

            newCopies1.AddPatrons(newPatron);
            newCopies2.AddPatrons(newPatron);

            List <Patrons> testList    = newCopies1.GetPatronCopies();
            List <Patrons> controlList = new List <Patrons> {
                newPatron
            };

            Assert.Equal(controlList, testList);
        }
Пример #3
0
        public void Copies_AddBook_AddCopiesToPatrons()
        {
            Copies newCopies = new Copies(1, DateTime.Now, 1);

            newCopies.Save();
            Books newBook = new Books("Of mice and men", 1);

            newBook.Save();

            Patrons newPatrons1 = new Patrons("Jerry");

            newPatrons1.Save();
            Patrons newPatrons2 = new Patrons("Jerry");

            newPatrons2.Save();

            newCopies.AddPatrons(newPatrons1);
            newCopies.AddPatrons(newPatrons2);

            List <Patrons> testList    = newCopies.GetPatronCopies();
            List <Patrons> controlList = new List <Patrons> {
                newPatrons1, newPatrons2
            };

            Assert.Equal(controlList, testList);
        }
Пример #4
0
        public void Copies_AddBook_AddCopiesToPatrons()
        {
            Copies newCopies = new Copies(1);

            newCopies.Save();
            Books newBook = new Books("Of mice and men", "John Steinbeck", new DateTime(2017, 05, 06), 1);

            newBook.Save();

            Patrons newPatrons1 = new Patrons("Jerry", 1);

            newPatrons1.Save();
            Patrons newPatrons2 = new Patrons("Jerry", 2);

            newPatrons2.Save();

            // Console.WriteLine(newCopies.GetId());
            // Console.WriteLine(testCopies.GetId());

            newCopies.AddPatrons(newPatrons1);
            newCopies.AddPatrons(newPatrons2);


            List <Patrons> testList    = newCopies.GetPatronCopies();
            List <Patrons> controlList = new List <Patrons> {
                newPatrons1, newPatrons2
            };

            Assert.Equal(controlList, testList);
        }
Пример #5
0
        public void Copies_Delete_DeleteSingleCopy()
        {
            Patrons newPatrons = new Patrons("David", 1);

            newPatrons.Save();
            Books newBook = new Books("Of mice and men", 1);

            newBook.Save();
            Copies newCopies = new Copies(1, DateTime.Now, 1);

            newCopies.Save();

            newCopies.AddPatrons(newPatrons);

            newCopies.Delete();

            List <Copies> testCopies    = Copies.GetAll();
            List <Copies> controlCopies = new List <Copies> {
            };

            Assert.Equal(controlCopies, testCopies);
        }
Пример #6
0
        public void Copies_Search_SearchAllBooksForBook()
        {
            Books newBook = new Books("Of mice and men", 1);

            newBook.Save();

            Books testBook = new Books("Of another world", 1);

            testBook.Save();
            Books faceBook = new Books("Of dice", 1);

            faceBook.Save();
            Books anotherBook = new Books("A whole new world", 1);

            anotherBook.Save();

            List <Books> controlBooks = new List <Books> {
                newBook, testBook, faceBook
            };

            List <Books> searchBooks = Books.Search("of");

            Assert.Equal(controlBooks, searchBooks);
        }