Пример #1
0
        public void FilterBooks_FilterByOnlyByName_ActualShoulBeEqualExpected()
        {
            BookRegister register = new BookRegister();
            Book         book1    = new Book("name", "author", "category", "language", "1999", "123");
            Book         expected = new Book("n", "a", "c", "l", "1999", "789");

            register.Add(book1);
            register.Add(expected);
            TakenBookRegister takenBooks = new TakenBookRegister();
            BookRegister      filtered   = register.FilterBooks("", "", "", "", "n", "", takenBooks);
            Book actual = filtered.Get("789");

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void FilterBooks_FilterByOnlyByAvailabiltyTaken_ActualShoulBeEqualExpected()
        {
            ReaderRegister readerRegister = new ReaderRegister();
            BookRegister   register       = new BookRegister();
            Book           book1          = new Book("name", "author", "category", "language", "1999", "123");
            Book           expected       = new Book("n", "a", "c", "l", "1999", "789");

            register.Add(book1);
            register.Add(expected);
            TakenBookRegister takenBooks = new TakenBookRegister();
            bool successful;

            TaskUtils.TakeBook(register, takenBooks, readerRegister, "789", "reader", Convert.ToDateTime("2021-05-12"), out successful, 3);
            BookRegister filtered = register.FilterBooks("", "", "", "", "", "false", takenBooks);
            Book         actual   = filtered.Get("789");

            Assert.AreEqual(expected, actual);
        }