Esempio n. 1
0
 /// <summary>Creates a batch request from an in-memory request representation.</summary>
 /// <param name="request">The request to parse into a batch.</param>
 /// <returns>The newly created batch request.</returns>
 public static BatchWebRequest FromRequest(InMemoryWebRequest request)
 {
     BatchWebRequest batch = new BatchWebRequest();
     Assert.AreEqual("/$batch", request.RequestUriString, "The request is not a batch request, it does not target the /$batch uri/");
     batch.ParseBatchContent(request.GetRequestStream(), request.RequestContentType, false, false);
     return batch;
 }
Esempio n. 2
0
        /// <summary>Creates a batch request from an in-memory request representation.</summary>
        /// <param name="request">The request to parse into a batch.</param>
        /// <returns>The newly created batch request.</returns>
        public static BatchWebRequest FromRequest(InMemoryWebRequest request)
        {
            BatchWebRequest batch = new BatchWebRequest();

            Assert.AreEqual("/$batch", request.RequestUriString, "The request is not a batch request, it does not target the /$batch uri/");
            batch.ParseBatchContent(request.GetRequestStream(), request.RequestContentType, false, false);
            return(batch);
        }
Esempio n. 3
0
 /// <summary>Creates a batch response from an in-memory response representation.</summary>
 /// <param name="response">The in-memory request from which to read the response.</param>
 /// <returns>The newly created batch response.</returns>
 public static BatchWebRequest FromResponse(InMemoryWebRequest response)
 {
     BatchWebRequest batch = new BatchWebRequest();
     if (response.ResponseStatusCode != 200 && response.ResponseStatusCode != 202)
     {
         Assert.Fail("The batch response must be 200 or 202, otherwise its content will not be a batch response.");
     }
     batch.ParseBatchContent(response.GetResponseStream(), response.ResponseContentType, true, false);
     return batch;
 }
Esempio n. 4
0
        /// <summary>Creates a batch response from an in-memory response representation.</summary>
        /// <param name="response">The in-memory request from which to read the response.</param>
        /// <returns>The newly created batch response.</returns>
        public static BatchWebRequest FromResponse(InMemoryWebRequest response)
        {
            BatchWebRequest batch = new BatchWebRequest();

            if (response.ResponseStatusCode != 200 && response.ResponseStatusCode != 202)
            {
                Assert.Fail("The batch response must be 200 or 202, otherwise its content will not be a batch response.");
            }
            batch.ParseBatchContent(response.GetResponseStream(), response.ResponseContentType, true, false);
            return(batch);
        }