Esempio n. 1
0
        public void LoseThrowsExceptionIfBookIsNotOnLoan()
        {
            var book = new Book("author", "title", "call number", 1);

            book.State = BookState.AVAILABLE;

            var ex = Assert.Throws<InvalidOperationException>(() => book.Lose());

            Assert.Equal("Book must be on loan to be marked as lost", ex.Message);
        }
        public void WhenBookIsOnLoanAndLostThenShouldBeLost()
        {
            var book = new Book("author", "title", "call number", 1);
            var member = new Member("first", "last", "phone", "email", 1);

            var loan = new Loan(book, member, DateTime.Today, DateTime.Today.AddDays(7));

            book.Borrow(loan);

            book.Lose();

            Assert.Equal(BookState.LOST, book.State);
        }
Esempio n. 3
0
        public void LoseSetsBookStateToLost()
        {
            var book = new Book("author", "title", "call number", 1);

            book.State = BookState.ON_LOAN;

            book.Lose();

            Assert.Equal(BookState.LOST, book.State);
        }
        public void WhenBookIsLostAndDisposedShouldBeDisposed()
        {
            var book = new Book("author", "title", "call number", 1);
            var member = new Member("first", "last", "phone", "email", 1);

            var loan = new Loan(book, member, DateTime.Today, DateTime.Today.AddDays(7));

            book.Borrow(loan);

            book.Lose();

            book.Dispose();

            Assert.Equal(BookState.DISPOSED, book.State);
        }