コード例 #1
0
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController();

            // Act
            ViewResult result = controller.About() as ViewResult;

            // Assert
            Assert.AreEqual("Your application description page.", result.ViewBag.Message);
        }
コード例 #2
0
        public void Index()
        {
            // Arrange
            List<Media> theMedia = PopulateMedia();
            var mockRepo = new MockSubtitleRepository(theMedia);
            HomeController controller = new HomeController(mockRepo);

            // Act
            ViewResult result = controller.Index() as ViewResult;

            // Assert
            var result1 = result.Model as List<Media>;
            Assert.IsTrue(result1[1].Name == "The Notebook");
            Assert.IsTrue(result1[0].Name == "The Matrix");
            Assert.IsTrue(result1[2].Name == "Catch me if you can");
        }