コード例 #1
0
        CommentController CreateCommentControllerAs(string userName)
        {

            var mock = new Mock<ControllerContext>();
            mock.SetupGet(p => p.HttpContext.User.Identity.Name).Returns(userName);
            mock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true);

            var controller = new CommentController(DbInitializer.CreatePlaylistManager())
            {
                ControllerContext = mock.Object
            };
            return controller;
        }
コード例 #2
0
 public void TestInitialize()
 {
     controller = CreateCommentControllerAs("*****@*****.**");
     DbInitializer.Initialize();
 }