示例#1
0
        private static HomeController GetHomeControllerInstance()
        {
            var postRepository = MockObjectFactory.CreatePostRepository();
            var userRepository = MockObjectFactory.CreateUserRepository();
            var categoryRepository = MockObjectFactory.CreateCategoryRepository();
            var tagRepository = MockObjectFactory.CreateTagRepository();
            var settingsRepository = MockObjectFactory.CreateSettingsRepository();
            var cacheService = MockObjectFactory.CreateCacheService();
            var postController = new HomeController(postRepository, userRepository, categoryRepository, tagRepository, settingsRepository, cacheService);

            return postController;
        }
        private static HomeController GetHomeControllerInstance(HttpContextBase httpContext)
        {
            var postRepository = MockObjectFactory.CreatePostRepository();
            var userRepository = MockObjectFactory.CreateUserRepository();
            var categoryRepository = MockObjectFactory.CreateCategoryRepository();
            var tagRepository = MockObjectFactory.CreateTagRepository();
            var settingsRepository = MockObjectFactory.CreateSettingsRepository();
            var cacheService = MockObjectFactory.CreateCacheService();
            var postController = new HomeController(postRepository, userRepository, categoryRepository, tagRepository, settingsRepository, cacheService)
                                 {
                                    Url = new UrlHelper(httpContext.Request.RequestContext, RouteTable.Routes)
                                 };

            return postController;
        }