Ejemplo n.º 1
0
        public FakeHttpContext(
            IPrincipal principal,
            IFormParamsProvider formParams,
            IQueryStringParamsProvider queryStringParams,
            ICookieProvider cookies,
            IServerVariablesParamsProvider serverVariablesParams,
            IHeadersParamsProvider headersParams,
            SessionStateItemCollection sessionItems,
            HttpServerUtilityBase server,
            FakeHttpRequest request,
            IHttpContextBehavior contextBehavior)
        {
            User = principal;
            _sessionItems = sessionItems ?? new SessionStateItemCollection();
            _request = request ?? new FakeHttpRequest(formParams, queryStringParams, cookies, serverVariablesParams, headersParams);
            _request.SetIsAuthenticated(User.Identity != null ? User.Identity.IsAuthenticated : false);
            _server = server ?? new Mock<HttpServerUtilityBase>().Object;

            var httpResponse = new Mock<HttpResponseBase>();
            httpResponse.Setup(x => x.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(s => s);
            _response = httpResponse.Object;

            _behavior = contextBehavior;

            _items = new Hashtable();
        }
Ejemplo n.º 2
0
 public FakeHttpContext(
     IPrincipal principal,
     IFormParamsProvider formParams,
     IQueryStringParamsProvider queryStringParams,
     HttpCookieCollection cookies,
     SessionStateItemCollection sessionItems,
     HttpServerUtilityBase server,
     FakeHttpRequest request,
     IHttpContextBehavior contextBehavior)
 {
     User = principal;
     _formParams = formParams ?? new EmptyFormsParamProvider();
     _queryStringParams = queryStringParams ?? new EmptyQueryStringParamProvider();
     _cookies = cookies ?? new HttpCookieCollection();
     _sessionItems = sessionItems ?? new SessionStateItemCollection();
     _request = request ?? new FakeHttpRequest();
     _request.SetIsAuthenticated(User.Identity != null ? User.Identity.IsAuthenticated : false);
     _server = server ?? new Mock<HttpServerUtilityBase>().Object;
     var httpResponse = new Mock<HttpResponseBase>();
     httpResponse.Setup(x => x.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(s => s);
     this._response = httpResponse.Object;
     this._behavior = contextBehavior;
 }
Ejemplo n.º 3
0
 public FakeHttpContext(FakeHttpRequest request)
     : this()
 {
     this._request = request;
 }