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; }
public void TestInitialize() { controller = CreateCommentControllerAs("*****@*****.**"); DbInitializer.Initialize(); }