Ejemplo n.º 1
0
            private static void VerifyStatusCode(string uri, string responseFormat, string etag, Type contextType, int statusCode)
            {
                var            ifNoneMatch = new KeyValuePair <string, string>("If-None-Match", etag);
                TestWebRequest request     = GetTestWebRequestInstance(responseFormat, uri, contextType, new KeyValuePair <string, string>[] { ifNoneMatch }, "GET");

                Assert.IsTrue(request.ResponseStatusCode == statusCode, "Since the etag should match, the status code should be 312");
                VerifyEmptyStream(request.GetResponseStream());
                request.Dispose();
            }
Ejemplo n.º 2
0
 public void ProcessGetTest()
 {
     foreach (WebServerLocation location in new WebServerLocation[] { WebServerLocation.InProcess, WebServerLocation.InProcessWcf })
     {
         using (TestWebRequest request = TestWebRequest.CreateForLocation(location))
         {
             request.DataServiceType  = typeof(CustomDataContext);
             request.RequestUriString = "/$metadata";
             request.SendRequest();
             Stream     resultStream = request.GetResponseStream();
             TextReader reader       = new StreamReader(resultStream);
             string     resultText   = reader.ReadToEnd();
             Assert.IsTrue(resultText.Length > 0);
             Assert.IsTrue(resultText.Contains("Customers"));
             request.Dispose();
         }
     }
 }