public static void SimulateForm(this FakeHttpApplication self, NameValueCollection formData, int responseStatusCode = 200)
 {
     self.SimulateRequest(req =>
     {
         req.SetHttpMethod("POST");
         req.Unvalidated.Form.Clear();
         req.Unvalidated.Form.Add(formData);
     }, () => new FakeHttpResponse()
     {
         StatusCode = responseStatusCode
     });
 }
        public static void SimulateRequest(this FakeHttpApplication self, Action <FakeHttpRequest> customizeRequest,
                                           Func <HttpResponseBase> responseFactory = null)
        {
            Func <HttpResponseBase> createResponse = responseFactory ?? (() => new FakeHttpResponse());

            self.Reset();
            customizeRequest(self.Request);
            var eventHandler = new ClassicRequestEventHandler(self);

            eventHandler.OnBeginRequest();
            self.Response = createResponse();
            eventHandler.OnLogRequest();
        }
 public static void SimulateRequest(this FakeHttpApplication self, string httpMethod = "GET", string httpUrl = "https://www.example.org/", int httpStatusCode = 200, int sleepDurationMilliseconds = 0)
 {
     self.SimulateRequest(req =>
     {
         req.SetRawUrl(httpUrl);
         req.SetHttpMethod(httpMethod);
     },
                          () =>
     {
         if (sleepDurationMilliseconds > 0)
         {
             Thread.Sleep(sleepDurationMilliseconds);
         }
         return(new FakeHttpResponse()
         {
             StatusCode = httpStatusCode
         });
     });
 }
Esempio n. 4
0
 public TestContext(FakeHttpApplication fakeHttpApplication)
 {
     App = fakeHttpApplication;
 }
Esempio n. 5
0
 public FakeHttpRequest(FakeHttpApplication httpApplication)
 {
     _httpApplication = httpApplication ?? throw new ArgumentNullException(nameof(httpApplication));
 }
Esempio n. 6
0
 public FakeHttpContext(FakeHttpApplication fakeHttpApplication)
 {
     _fakeHttpApplication = fakeHttpApplication ?? throw new ArgumentNullException(nameof(fakeHttpApplication));
     Items = new Hashtable();
 }
Esempio n. 7
0
 public FakeHttpServerUtility(FakeHttpApplication httpApplication)
 {
     _httpApplication = httpApplication ?? throw new ArgumentNullException(nameof(httpApplication));
 }