public void should_show_topic_with_reply_list() { var topic = _app.NewTopic().WithAuthor(_author).WithReply("reply content 1").Create(); var newReply = new Reply { CreatedAtUtc = DateTime.Today.AddDays(1), Content = "reply content 2", TopicId = topic.Id, CreatedBy = _author.Id }; _app.GetService <IRepository <Reply> >().Save(newReply); _app.Reset(); // Act var topicController = _app.CreateController <TopicController>(); var result = topicController.Index(topic.Id) as ViewResult; // Assert result.ShouldNotBeNull(); var viewModel = result.ViewData.Model; var topicShown = viewModel as TopicViewModel; topicShown.ShouldNotBeNull(); topicShown.Id.ShouldEqual(topic.Id); topicShown.Replies.ShouldNotBeNull(); topicShown.Replies.Count.ShouldEqual(2); topicShown.Replies[0].Content.ShouldEqual("reply content 1"); topicShown.Replies[0].TopicId.ShouldEqual(topic.Id); topicShown.Replies[1].Content.ShouldEqual("reply content 2"); topicShown.Replies[1].TopicId.ShouldEqual(topic.Id); }
public AccountRelatedPageSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _antiForgeryTokens = _app.GetAntiForgeryTokens(); _userRepo = _app.GetService <IRepository <User> >(); _userManager = _app.GetService <UserManager <User> >(); }
public TopicControllerSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _app.DeleteAll <Topic>(); _app.DeleteAll <WeChatAccount>(); _author = _app.CreateUser(); }
public CommonControllerSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _fileRepo = _app.GetService <IRepository <FileRecord> >(); _fs = _app.GetService <IFileSystem>(); _tagBuilder = _app.GetService <ITagBuilder>(); _app.DeleteAll <FileRecord>(); }
public ReplyControllerSpecs(TestDiscussionWebApp app) { _app = app.Reset(); }
public ReplyPageSpecs(TestDiscussionWebApp app) { _app = app.Reset(); }
public UserRelatedPageSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _app.DeleteAll <User>(); }
public AccountRelatedPageSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _antiForgeryTokens = _app.GetAntiForgeryTokens(); }
public AccountControllerSpecs(TestDiscussionWebApp app) { _app = app.Reset(); _userRepo = _app.GetService <IRepository <User> >(); }
public CommonRelatedApiSpecs(TestDiscussionWebApp app) { _app = app.Reset(); }
public ExternalSigninManagerSpecs(TestDiscussionWebApp app) { _app = app.Reset(); app.DeleteAll <User>(); }
public TopicRelatedPagesSpecs(TestDiscussionWebApp app) { _app = app.Reset(); }