Esempio n. 1
0
        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> >();
 }
Esempio n. 3
0
 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();
 }
Esempio n. 6
0
 public ReplyPageSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
 }
Esempio n. 7
0
 public UserRelatedPageSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
     _app.DeleteAll <User>();
 }
Esempio n. 8
0
 public AccountRelatedPageSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
     _antiForgeryTokens = _app.GetAntiForgeryTokens();
 }
 public AccountControllerSpecs(TestDiscussionWebApp app)
 {
     _app      = app.Reset();
     _userRepo = _app.GetService <IRepository <User> >();
 }
Esempio n. 10
0
 public CommonRelatedApiSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
 }
Esempio n. 11
0
 public ExternalSigninManagerSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
     app.DeleteAll <User>();
 }
Esempio n. 12
0
 public TopicRelatedPagesSpecs(TestDiscussionWebApp app)
 {
     _app = app.Reset();
 }