Пример #1
0
        public void Contains_EmptyRegister_False()
        {
            ReaderRegister register = new ReaderRegister();
            bool           actual   = register.Contains("name");

            Assert.IsFalse(actual);
        }
Пример #2
0
        public void Contains_RegisterDoesNotContainReaderWithCertainName_False()
        {
            ReaderRegister register = new ReaderRegister();

            register.Add(new Reader("name"));
            bool actual = register.Contains("n");

            Assert.IsFalse(actual);
        }
Пример #3
0
        public void Contains_RegisterContainsReaderWithCertainName_True()
        {
            ReaderRegister register = new ReaderRegister();

            register.Add(new Reader("name"));
            bool actual = register.Contains("name");

            Assert.IsTrue(actual);
        }
Пример #4
0
        public void TakeBook_NewReaderTakesBook_SuccessfullTrueAddbookToTakenBookRegisterAndAddsNewReaderToReaderRegister()
        {
            BookRegister libraryRegister = new BookRegister();
            Book         book1           = new Book("name", "author", "category", "language", "1999", "123");

            libraryRegister.Add(book1);
            ReaderRegister    readerRegister = new ReaderRegister();
            TakenBookRegister takenRegister  = new TakenBookRegister();
            bool successful;

            TaskUtils.TakeBook(libraryRegister, takenRegister, readerRegister, "123", "Name", Convert.ToDateTime("2021-05-16"), out successful, 3);
            bool containsTakenRegister  = takenRegister.Contains("123");
            bool containsReaderRegister = readerRegister.Contains("Name");

            Assert.IsTrue(successful);
            Assert.IsTrue(containsTakenRegister);
            Assert.IsTrue(containsReaderRegister);
        }
Пример #5
0
        public void DeleteBook_DeletesBookFromBookRegisterAndTakenBookREgister_BookRegisterAndTakenBookRegisterDoesNotContainBook()
        {
            BookRegister libraryRegister = new BookRegister();
            Book         book1           = new Book("name", "author", "category", "language", "1999", "123");

            libraryRegister.Add(book1);
            ReaderRegister    readerRegister = new ReaderRegister();
            TakenBookRegister takenRegister  = new TakenBookRegister();
            bool successful;

            TaskUtils.TakeBook(libraryRegister, takenRegister, readerRegister, "123", "Name", Convert.ToDateTime("2022-05-16"), out successful, 3);
            TaskUtils.DeleteBook(takenRegister, libraryRegister, readerRegister, "123");
            bool containsBookRegister      = takenRegister.Contains("123");
            bool containsTakenBookRegister = readerRegister.Contains("123");

            Assert.IsFalse(containsBookRegister);
            Assert.IsFalse(containsTakenBookRegister);
        }