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

            register.Add(book);
            register.Remove(remove);
            register.Count().Should().Be(1);
        }
Пример #2
0
        public void Remove_GivenBookIsbnEqualToOneInRegister_RemovesThatBookFromRegister()
        {
            BookRegister register = new BookRegister();
            Book         book1    = new Book("name", "author", "category", "language", "1999", "123");
            Book         remove   = new Book("n", "a", "c", "l", "1999", "123");

            register.Add(book1);
            register.Remove(remove);
            register.Count().Should().Be(0);
        }
Пример #3
0
        public void Remove_GivenBookIsEqualToOneInRegister_RemovesGivenBookFromRegister()
        {
            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);
            register.Remove(book1);
            Book actual = register.Get(0);

            register.Count().Should().Be(1);
            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void Remove_GivenBookIsbnNotEqualToOneInRegister_DoesNotRemove()
        {
            BookRegister register     = new BookRegister();
            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");
            TakenBook    takenBook    = new TakenBook(book1, Convert.ToDateTime("2021-05-12"), reader1);
            TakenBook    bookToRemove = new TakenBook(book2, Convert.ToDateTime("2021-05-12"), reader2);

            register.Add(takenBook);
            register.Remove(bookToRemove);
            register.Count().Should().Be(1);
        }