예제 #1
0
        public void Get_IndexMoreOrEqualCount_ReturnNull()
        {
            TakenBookRegister register = new TakenBookRegister();
            Book   book   = new Book("name", "author", "category", "language", "1999", "123");
            Reader reader = new Reader("Name");

            register.Add(new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader));
            register.Get(1).Should().Be(null);
        }
예제 #2
0
        public void Get_RegisterDoesNotContainBookWithCertainIsbn_ReturnNull()
        {
            TakenBookRegister register = new TakenBookRegister();
            Book   book   = new Book("name", "author", "category", "language", "1999", "123");
            Reader reader = new Reader("Name");

            register.Add(new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader));
            register.Get("1").Should().Be(null);
        }
예제 #3
0
        public void Get_IndexMoreOrEqualZeroAndLessThanCount_ExpectedIsEqualActual()
        {
            TakenBookRegister register = new TakenBookRegister();
            Book      book             = new Book("name", "author", "category", "language", "1999", "123");
            Reader    reader           = new Reader("Name");
            TakenBook expected         = new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader);

            register.Add(expected);
            TakenBook actual = register.Get(0);

            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void Add_AddBookToRegister_AddedBookShouldBeEqualToGiven()
        {
            TakenBookRegister register = new TakenBookRegister();
            Book      book             = new Book("name", "author", "category", "language", "1999", "123");
            Reader    reader           = new Reader("Name");
            TakenBook expected         = new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader);

            register.Add(expected);
            TakenBook actual = register.Get(0);

            Assert.AreEqual(expected, actual);
        }
예제 #5
0
        public void Get_RegisterContainsBookWithCertainIsbn_ExpectedIsEqualActual()
        {
            TakenBookRegister register = new TakenBookRegister();
            Book      book             = new Book("name", "author", "category", "language", "1999", "123");
            Reader    reader           = new Reader("Name");
            TakenBook expected         = new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader);

            register.Add(expected);
            TakenBook actual = register.Get("123");

            Assert.AreEqual(expected, actual);
        }
예제 #6
0
        public void ReturnBook_ReturnDateIsNotLate_LateReturnIsFalseAndReaderMinusBookCountAndRemoveBookFfromTakenBookRegister()
        {
            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);
            bool lateReturn;

            TaskUtils.ReturnBook(takenRegister, readerRegister, "123", out lateReturn);
            readerRegister.Get("Name").BookCount.Should().Be(0);
            Assert.IsFalse(lateReturn);
            takenRegister.Get("123").Should().Be(null);
        }
예제 #7
0
        public void Get_IndexIsZeroAndEmptyRegister_ReturnNull()
        {
            TakenBookRegister register = new TakenBookRegister();

            register.Get(0).Should().Be(null);
        }
예제 #8
0
        public void Get_IsbnAndEmptyRegister_ReturnNull()
        {
            TakenBookRegister register = new TakenBookRegister();

            register.Get("123").Should().Be(null);
        }