public void Setup()
        {
            NameValueCollection serverVariables = new NameValueCollection();

            // Setup Mock
            this._mockhttpContext = HttpContextHelper.RegisterMockHttpContext();
            this._mockRequest     = Mock.Get(this._mockhttpContext.Object.Request);
            this._mockRequest.Setup(x => x.ServerVariables).Returns(serverVariables);
            this._mockHostController   = MockComponentProvider.CreateNew <IHostController>();
            this._mockPortalController = MockComponentProvider.CreateNew <IPortalController>();
            PortalController.SetTestableInstance(this._mockPortalController.Object);

            // System under test
            this._userRequestIPAddressController = new UserRequestIPAddressController();
        }
Exemple #2
0
        public void Setup()
        {
            NameValueCollection serverVariables = new NameValueCollection();

            // Setup Mock
            this.mockhttpContext = HttpContextHelper.RegisterMockHttpContext();
            this.mockRequest     = Mock.Get(this.mockhttpContext.Object.Request);
            this.mockRequest.Setup(x => x.ServerVariables).Returns(serverVariables);
            this.mockHostController = new Mock <IHostController>();
            this.mockHostController.As <IHostSettingsService>();
            this.mockPortalController = MockComponentProvider.CreateNew <IPortalController>();
            PortalController.SetTestableInstance(this.mockPortalController.Object);

            // System under test
            this.userRequestIPAddressController = new UserRequestIPAddressController();

            var serviceCollection = new ServiceCollection();

            serviceCollection.AddTransient <INavigationManager>(container => Mock.Of <INavigationManager>());
            serviceCollection.AddTransient <IApplicationStatusInfo>(container => Mock.Of <IApplicationStatusInfo>());
            serviceCollection.AddTransient <IHostSettingsService>(container => (IHostSettingsService)this.mockHostController.Object);
            Globals.DependencyProvider = serviceCollection.BuildServiceProvider();
        }