Exemple #1
0
        public void TestAddCommentGetUserStoryByPost()
        {
            // Arrange
            var repo = new FakeRepository();
            var sourcesController = new SourcesController(repo);

            // Act
            CommentViewModel cvm = new CommentViewModel
            {
                Name = "newCommentUser",
                StoryPost = "Fake StoryPost1",
                CommentText = "newCommentText"
            };
            sourcesController.AddComment(cvm);

            // Assert
            /* Assert that the newest comment is correctly associated
             * with the first story post in the fake repository and
             * should be the first item in the comment list.
             */

            Assert.Equal("Fake StoryPost1", repo.UserStories[0].StoryPost);
            Assert.Equal("newCommentUser", repo.UserStories[0].Comments[0].Name);
        }