public void Count_GetCount_CountShouldBeEqualToAddedBookCount() { TakenBookRegister register = new TakenBookRegister(); Book book1 = new Book("name", "author", "category", "language", "1999", "123"); Book book2 = new Book("n", "a", "c", "l", "1999", "789"); Reader reader1 = new Reader("Name"); Reader reader2 = new Reader("N"); register.Add(new TakenBook(book1, Convert.ToDateTime("2021-05-12"), reader1)); register.Add(new TakenBook(book2, Convert.ToDateTime("2021-05-12"), reader2)); register.Count().Should().Be(2); }
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); }
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); }
public void Contains_RegisterDoesNotContainBookWithCertainIsbn_False() { 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)); bool actual = register.Contains("1"); Assert.IsFalse(actual); }
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); }
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); }
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); }
public void TakeBook_TakenBookRegisterContainsBookWithCertainIsbn_SuccessfullFalse() { BookRegister libraryRegister = new BookRegister(); Book book = new Book("name", "author", "category", "language", "1999", "123"); libraryRegister.Add(book); ReaderRegister readerRegister = new ReaderRegister(); Reader reader = new Reader("Name"); readerRegister.Add(reader); TakenBookRegister takenRegister = new TakenBookRegister(); takenRegister.Add(new TakenBook(book, Convert.ToDateTime("2021-05-12"), reader)); bool successful; TaskUtils.TakeBook(libraryRegister, takenRegister, readerRegister, "123", "John", Convert.ToDateTime("2021-05-16"), out successful, 3); Assert.IsFalse(successful); }