예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FakeHttpContext"/> class.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        /// <param name="session">The session.</param>
        public FakeHttpContext(FakeHttpRequest request, FakeHttpResponse response, FakeHttpSessionState session)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            if (response == null)
            {
                throw new ArgumentNullException(nameof(response));
            }

            if (session == null)
            {
                throw new ArgumentNullException(nameof(session));
            }

            this.request = request;
            this.response = response;
            this.session = session;

            this.request.Context = this;
            this.response.Context = this;

            this.applicationState = new FakeHttpApplicationState();
            this.currentNotification = RequestNotification.BeginRequest;
            this.errors = new List<Exception>();
            this.handlerStack = new Stack<IHttpHandler>();
            this.items = new Hashtable();
            this.pageInstrumentation = new PageInstrumentationService();
            this.server = new FakeHttpServerUtility(this);
            this.timestampUtc = DateTime.UtcNow;

            this.ThreadAbortOnTimeout = true;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FakeHttpContext"/> class.
 /// </summary>
 /// <param name="request">The request.</param>
 public FakeHttpContext(FakeHttpRequest request)
     : this(request, new FakeHttpResponse(), new FakeHttpSessionState())
 {
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FakeHttpContext"/> class.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <param name="response">The response.</param>
 public FakeHttpContext(FakeHttpRequest request, FakeHttpResponse response)
     : this(request, response, new FakeHttpSessionState())
 {
 }