示例#1
0
        public void ShouldAddBookGivenBook()
        {
            Member member = MemberHelpers.CreateWithDefaultConstructor();
            Book   book   = BookHelpers.GetDefaultTestBook();

            member.AddBookRead(book);

            Assert.Contains(book, member.BooksRead);
        }
示例#2
0
        public void ShouldReturnTrueIfBooksReadContainsBookAndAnotherBook()
        {
            UserBooksUpdateModel updateModel = GetUserBooksUpdateModelWithBookInBooksRead();

            updateModel.BooksRead.Add(BookHelpers.GetDefaultTestBookWithSpecifiedTitle("C# for dummies"));

            bool hasReadBook = updateModel.HasReadBook(Book);

            Assert.True(hasReadBook);
        }
示例#3
0
        public void ShouldDoNothingGivenBookNotInBooksRead()
        {
            Member member = MemberHelpers.CreateWithDefaultConstructor();
            Book   book   = BookHelpers.GetDefaultTestBook();

            member.RemoveBookRead(book);

            // if we get this far, no error was thrown
            Assert.Empty(member.BooksRead);
        }
示例#4
0
        public void ShouldDoNothingGivenDuplicateBook()
        {
            Member member = MemberHelpers.CreateWithDefaultConstructor();
            Book   book   = BookHelpers.GetDefaultTestBook();

            member.AddBookRead(book);
            member.AddBookRead(book);

            // if we get to this point no error was thrown.
            Assert.Contains(book, member.BooksRead);
            Assert.Single(member.BooksRead !);
        }