public void Get_RegisterDoesNotContainReaderWithCertainName_ReturnNull() { ReaderRegister register = new ReaderRegister(); register.Add(new Reader("name")); register.Get("n").Should().Be(null); }
public void Get_IndexMoreOrEqualCount_ReturnNull() { ReaderRegister register = new ReaderRegister(); register.Add(new Reader("name")); register.Get(1).Should().Be(null); }
public void Get_IndexLessThanZero_ReturnNull() { ReaderRegister register = new ReaderRegister(); register.Add(new Reader("name")); register.Get(-1).Should().Be(null); }
public void Get_RegisterContainsReaderWithCertainIsbn_ExpectedIsEqualActual() { ReaderRegister register = new ReaderRegister(); Reader expected = new Reader("name"); register.Add(expected); Reader actual = register.Get("name"); Assert.AreEqual(expected, actual); }
public void Get_IndexMoreOrEqualZeroAndLessThanCount_ExpectedIsEqualActual() { ReaderRegister register = new ReaderRegister(); Reader expected = new Reader("name"); register.Add(expected); Reader actual = register.Get(0); Assert.AreEqual(expected, actual); }
public void Add_AddReaderToRegister_AddedReaderShouldBeEqualToGiven() { Reader expected = new Reader("name"); ReaderRegister register = new ReaderRegister(); register.Add(expected); Reader actual = register.Get(0); Assert.AreEqual(expected, actual); }
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); }
public void TakeBook_ReaderHasAlreadyTakenOneBook_SuccessfullTrueAddbookToTakenBookRegisterAndAddPlusOneToReaderBookCount() { BookRegister libraryRegister = new BookRegister(); Book book1 = new Book("name", "author", "category", "language", "1999", "123"); Book book2 = new Book("n", "a", "c", "language", "1999", "123456"); libraryRegister.Add(book1); libraryRegister.Add(book2); 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); TaskUtils.TakeBook(libraryRegister, takenRegister, readerRegister, "123456", "Name", Convert.ToDateTime("2021-05-16"), out successful, 3); bool containsTakenRegister = takenRegister.Contains("123456"); Assert.IsTrue(successful); Assert.IsTrue(containsTakenRegister); readerRegister.Get("Name").BookCount.Should().Be(2); }
public void Get_NameAndEmptyRegister_ReturnNull() { ReaderRegister register = new ReaderRegister(); register.Get("name").Should().Be(null); }
public void Get_IndexIsZeroAndEmptyRegister_ReturnNull() { ReaderRegister register = new ReaderRegister(); register.Get(0).Should().Be(null); }