public void ShouldKnowToRenderTheBookPostContentAsMarkdown()
 {
     var id = 12;
     var repository = new Mock<Repository>();
     var book = new Book { Id = 1 };
     var markdown = new Markdown();
     var savedBookPost = new BookPost { Id = id, Title = "test title", Content = "Hello\n=====\nWorld", Type = BookPost.BookPostType.Reviews };
     book.Posts.Add(savedBookPost);
     repository.Setup(repo => repo.Get<Book>(book.Id)).Returns(book);
     var controller = new BookPostsController(repository.Object);
     var result = controller.Details(id, book.Id);
     repository.Verify(it => it.Get<Book>(book.Id), Times.Once());
     var transformedContent = markdown.Transform(savedBookPost.Content);
     Assert.AreEqual(transformedContent, result.ViewBag.transformedContent);
     Assert.AreEqual(id, ((BookPostInformation)result.Model).Model.Id);
 }
 public void ShouldKnowHowToDisplayABookPost()
 {
     var id = 12;
     var repository = new Mock<Repository>();
     var book = new Book { Id = 1 };
     var savedBookPost = new BookPost { Id = id, Title = "test title", Content = "some content", Type = BookPost.BookPostType.Reviews};
     book.Posts.Add(savedBookPost);
     repository.Setup(repo => repo.Get<Book>(book.Id)).Returns(book);
     var controller = new BookPostsController(repository.Object);
     var result = controller.Details(id, book.Id);
     repository.Verify(it => it.Get<Book>(book.Id), Times.Once());
     Assert.AreEqual(book.Id, ((BookPostInformation)result.Model).BookId);
     Assert.AreEqual(id, ((BookPostInformation)result.Model).Model.Id);
     Assert.AreEqual(book, ((BookPostInformation)result.Model).Book);
 }