public HubSubscriptionController(ILoggingService loggingService)
        {
            _hubConfiguration = new HubConfiguration()
            {
                HubMaximumSubscriptions = 10,
                HubUsername             = Config.HubUsername,
                HubPassword             = Config.HubPassword,
                HubRoot = new Uri(Config.HubRootUrl)
            };

            _loggingService                 = loggingService;
            _hubSubscriptionListener        = MvcApplication.Container.GetService <IHubSubscriptionListener>();
            _subscriptionPersistenceService = MvcApplication.Container.GetService <IHubSubscriptionPersistenceService>();
            _subscriptionService            = MvcApplication.Container.GetService <IHubSubscriptionService>();
        }
        public void MyTestInitialize()
        {
            _mocks                          = new MockRepository();
            _loggingService                 = _mocks.Stub <ILoggingService>();
            _subscriptionListener           = _mocks.StrictMock <IHubSubscriptionListener>();
            _subscriptionService            = _mocks.StrictMock <IHubSubscriptionService>();
            _subscriptionPersistenceService = _mocks.StrictMock <IHubSubscriptionPersistenceService>();

            MvcApplication.LoggingService = _loggingService;

            MvcApplication.Container = new WindsorContainer();
            MvcApplication.Container.Kernel.AddComponentInstance <ILoggingService>(_loggingService);
            MvcApplication.Container.Kernel.AddComponentInstance <IHubSubscriptionListener>(_subscriptionListener);
            MvcApplication.Container.Kernel.AddComponentInstance <IHubSubscriptionService>(_subscriptionService);
            MvcApplication.Container.Kernel.AddComponentInstance <IHubSubscriptionPersistenceService>(_subscriptionPersistenceService);

            var routes = new RouteCollection();

            MvcApplication.RegisterRoutes(routes);

            _request = _mocks.Stub <HttpRequestBase>();
            SetupResult.For(_request.ApplicationPath).Return("/");
            SetupResult.For(_request.Url).Return(new Uri("http://localhost/a", UriKind.Absolute));
            SetupResult.For(_request.ServerVariables).Return(new System.Collections.Specialized.NameValueCollection());
            SetupResult.For(_request.Params).Return(new System.Collections.Specialized.NameValueCollection());

            _response = _mocks.Stub <HttpResponseBase>();
            SetupResult.For(_response.ApplyAppPathModifier("/post1")).Return("http://localhost/post1");

            var context = _mocks.Stub <HttpContextBase>();
            var session = _mocks.Stub <HttpSessionStateBase>();

            SetupResult.For(context.Request).Return(_request);
            SetupResult.For(context.Response).Return(_response);
            SetupResult.For(context.Session).Return(session);

            _controller = new HubSubscriptionController(_loggingService);
            _controller.ControllerContext = new ControllerContext(context, new RouteData(), _controller);
            _controller.Url = new UrlHelper(new RequestContext(context, new RouteData()), routes);
        }
        public void MyTestInitialize()
        {
            _mocks = new MockRepository();
            _loggingService = _mocks.Stub<ILoggingService>();
            _subscriptionListener = _mocks.StrictMock<IHubSubscriptionListener>();
            _subscriptionService = _mocks.StrictMock<IHubSubscriptionService>();
            _subscriptionPersistenceService = _mocks.StrictMock<IHubSubscriptionPersistenceService>();

            MvcApplication.LoggingService = _loggingService;

            MvcApplication.Container = new WindsorContainer();
            MvcApplication.Container.Kernel.AddComponentInstance<ILoggingService>(_loggingService);
            MvcApplication.Container.Kernel.AddComponentInstance<IHubSubscriptionListener>(_subscriptionListener);
            MvcApplication.Container.Kernel.AddComponentInstance<IHubSubscriptionService>(_subscriptionService);
            MvcApplication.Container.Kernel.AddComponentInstance<IHubSubscriptionPersistenceService>(_subscriptionPersistenceService);

            var routes = new RouteCollection();
            MvcApplication.RegisterRoutes(routes);

            _request = _mocks.Stub<HttpRequestBase>();
            SetupResult.For(_request.ApplicationPath).Return("/");
            SetupResult.For(_request.Url).Return(new Uri("http://localhost/a", UriKind.Absolute));
            SetupResult.For(_request.ServerVariables).Return(new System.Collections.Specialized.NameValueCollection());
            SetupResult.For(_request.Params).Return(new System.Collections.Specialized.NameValueCollection());

            _response = _mocks.Stub<HttpResponseBase>();
            SetupResult.For(_response.ApplyAppPathModifier("/post1")).Return("http://localhost/post1");

            var context = _mocks.Stub<HttpContextBase>();
            var session = _mocks.Stub<HttpSessionStateBase>();
            SetupResult.For(context.Request).Return(_request);
            SetupResult.For(context.Response).Return(_response);
            SetupResult.For(context.Session).Return(session);

            _controller = new HubSubscriptionController(_loggingService);
            _controller.ControllerContext = new ControllerContext(context, new RouteData(), _controller);
            _controller.Url = new UrlHelper(new RequestContext(context, new RouteData()), routes);
        }