コード例 #1
0
ファイル: ETagTests.cs プロジェクト: marismore/odata.net
            public void GetNullPrimitiveValueWithAnyValueForETag()
            {
                using (CustomDataContext.CreateChangeScope())
                {
                    Type contextType = typeof(CustomDataContext);

                    var ifMatchHeader = new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("If-Match", "*") };

                    // Set the name property to null
                    UnitTestsUtil.SendRequestAndVerifyXPath(null, "/Customers(1)/Name/$value", null, contextType, UnitTestsUtil.JsonLightMimeType, "DELETE", ifMatchHeader, false);

                    // Both should work fine since the etag is of Customers(1)
                    UnitTestsUtil.SendRequestAndVerifyXPath(null, "/Customers(1)/Name", null, contextType, UnitTestsUtil.JsonLightMimeType, "GET", ifMatchHeader, true);
                    VerifyStatusCode("/Customers(1)/Name", UnitTestsUtil.JsonLightMimeType, "*", contextType, (int)HttpStatusCode.NotModified);

                    // This should return 404
                    UnitTestsUtil.VerifyInvalidRequest(null, "/Customers(1)/Name/$value", contextType, null, "GET", (int)HttpStatusCode.NotFound, ifMatchHeader);
                    VerifyStatusCode("/Customers(1)/Name/$value", UnitTestsUtil.MimeTextPlain, "*", contextType, (int)HttpStatusCode.NotModified);
                }
            }
コード例 #2
0
ファイル: ETagTests.cs プロジェクト: marismore/odata.net
 private static void VerifyInvalidRequest(Type contextType, string contentFormat, string uri, int errorCode, KeyValuePair <string, string>[] headerValues, string httpMethodName, string requestPayload)
 {
     UnitTestsUtil.VerifyInvalidRequest(requestPayload, uri, contextType, contentFormat, httpMethodName, errorCode, headerValues);
 }