Ejemplo n.º 1
0
 public void fails_to_parse_if_content_type_is_null()
 {
     var formData = new FormDataParser();
     var request = new SimpleRequestStream();
     request.ContentType = null;
     Verify.That(() => formData.ParseFormAndFiles(request) == false);
 }
Ejemplo n.º 2
0
 public void parse_sample()
 {
     FormData = new FormDataParser();
     var request = new SimpleRequestStream();
     request.ContentType = FormDataParser.ContentTypeFormUrlEncoded;
     var data = Encoding.UTF8.GetBytes(SampleInput);
     request.Data.Write(data, 0, data.Length);
     request.Data.Position = 0;
     FormData.ParseFormAndFiles(request);
 }
Ejemplo n.º 3
0
        public void whats_going_on()
        {
            var body =
            @"-----------------------------7db18c1726147c
            Content-Disposition: form-data; name=""product""

            RawFeasibility
            -----------------------------7db18c1726147c
            Content-Disposition: form-data; name=""environment""

            beta
            -----------------------------7db18c1726147c--";
                var formData = new FormDataParser();
                var request = new SimpleRequestStream(body);
                request.ContentType = "multipart/form-data; boundary=---------------------------7db18c1726147c";
                Verify.That(() => formData.ParseFormAndFiles(request));
                Verify.That(() => formData.Fields["environment"] == "beta");
                Verify.That(() => formData.Fields["product"] == "RawFeasibility");
        }
Ejemplo n.º 4
0
 public void parse_sample()
 {
     FormData = new FormDataParser();
     var request = new SimpleRequestStream(MultiPartFormDataSample.CreateSampleStream());
     request.ContentType = FormDataParser.ContentTypeMultipartFormData + "; boundary=" + MultiPartFormDataSample.Boundry;
     Verify.That(() => FormData.ParseFormAndFiles(request));
 }