コード例 #1
0
        public void StoryBankSortTest()
        {
            // Arrange
            var repo           = new FakeStoriesRepository();
            var homeController = new HomeController(repo);

            repo.AddInitialStories();
            // Act
            homeController.StoryBoard();
            // Assert
            Assert.Equal("King of Grapes", repo.Stories[repo.Stories.Count - 1].Title);
        }
コード例 #2
0
        public void RetrieveStoryTest()
        {
            // Arrange
            var   repo           = new FakeStoriesRepository();
            var   homeController = new HomeController(repo);
            Story sortedStory    = new Story();

            repo.AddInitialStories();
            // Act
            sortedStory = repo.Retrieve(repo.Stories[0].Title);
            // Assert
            Assert.Equal("King of Apples", sortedStory.Title);
        }
コード例 #3
0
        public void AddCommentTest()
        {
            // Arrange
            var    repo           = new FakeStoriesRepository();
            var    homeController = new HomeController(repo);
            string com            = "Great story.";
            string title          = "King of Grapes";

            repo.AddInitialStories();
            Story   tstory = repo.Retrieve(title);
            Comment tcom   = new Comment();

            tcom.Text = com;
            // Act
            homeController.Comment(com, title);
            // Assert
            Assert.Equal(1, repo.Retrieve(title).Subjects.Count);
            Assert.Equal(tcom.Text, tstory.Subjects[0].Text);
        }