Exemplo n.º 1
0
        public void CanEditBlog()
        {
            var mockedBlogRepo    = new Mock <IBlogPostRepository>();
            var mockedProjectRepo = new Mock <IPortfolioProjectRepository>();
            var blogPost          = new BlogPost
            {
                Id        = 1,
                Date      = new DateTime(2012, 1, 1),
                RouteName = "sample-post",
                Text      = "This is a sample",
                Title     = "Sample Post"
            };

            mockedBlogRepo.Setup(m => m.GetBlogPost(1)).Returns(blogPost);

            var target = new AdminController(mockedBlogRepo.Object, mockedProjectRepo.Object);

            var result = (AdminBlogFull)target.AddOrEditBlogPost(1).ViewData.Model;

            Assert.AreEqual(result.Title, "Sample Post");
        }