Esempio n. 1
0
        public void RecentActionUsesConventionToChooseView()
        {
            var controller = new BlogController(mockedPostService.Object);

            var result = controller.Recent() as ViewResult;

            Assert.IsNotNull(result);
        }
Esempio n. 2
0
        public void BlogControllerPassesCorrectViewData()
        {
            var posts = new List <Post>()
            {
                new Post(),
                new Post()
            };

            mockedPostService.Setup(r => r.ListRecentPosts(It.IsAny <int>())).Returns(posts);

            BlogController controller = new BlogController(mockedPostService.Object);
            var            result     = controller.Recent() as ViewResult;

            var model = result.ViewData.Model as List <Post>;

            Assert.IsNotNull(model);
        }