當前位置: 首頁>>代碼示例>>C#>>正文


C# StringContent.GetODataMessageReaderAsync方法代碼示例

本文整理匯總了C#中System.Net.Http.StringContent.GetODataMessageReaderAsync方法的典型用法代碼示例。如果您正苦於以下問題:C# StringContent.GetODataMessageReaderAsync方法的具體用法?C# StringContent.GetODataMessageReaderAsync怎麽用?C# StringContent.GetODataMessageReaderAsync使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Net.Http.StringContent的用法示例。


在下文中一共展示了StringContent.GetODataMessageReaderAsync方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ReadChangeSetOperationRequest_InvalidState_Throws

 public void ReadChangeSetOperationRequest_InvalidState_Throws()
 {
     var httpContent = new StringContent(String.Empty, Encoding.UTF8, "multipart/mixed");
     httpContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("boundary", Guid.NewGuid().ToString()));
     var reader = httpContent.GetODataMessageReaderAsync(new ODataMessageReaderSettings()).Result;
     Assert.Throws<InvalidOperationException>(
         () => ODataBatchReaderExtensions.ReadChangeSetOperationRequestAsync(reader.CreateODataBatchReader(), Guid.NewGuid(), Guid.NewGuid(), false),
         "The current batch reader state 'Initial' is invalid. The expected state is 'Operation'.");
 }
開發者ID:brianly,項目名稱:aspnetwebstack,代碼行數:9,代碼來源:ODataBatchReaderExtensionsTest.cs

示例2: GetODataMessageReaderAsync_ReturnsMessageReader

        public void GetODataMessageReaderAsync_ReturnsMessageReader()
        {
            StringContent content = new StringContent("foo", Encoding.UTF8, "multipart/mixed");

            Assert.NotNull(content.GetODataMessageReaderAsync(new ODataMessageReaderSettings(), CancellationToken.None).Result);
        }
開發者ID:KevMoore,項目名稱:aspnetwebstack,代碼行數:6,代碼來源:ODataHttpContentExtensionsTest.cs

示例3: ExecuteOperation_Throws_IfRequestIsNull

        public void ExecuteOperation_Throws_IfRequestIsNull()
        {
            var httpContent = new StringContent(String.Empty, Encoding.UTF8, "multipart/mixed");
            httpContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("boundary", Guid.NewGuid().ToString()));
            var reader = httpContent.GetODataMessageReaderAsync(new ODataMessageReaderSettings()).Result;
            UnbufferedODataBatchHandler batchHandler = new UnbufferedODataBatchHandler(new HttpServer());

            Assert.ThrowsArgumentNull(
                () => batchHandler.ExecuteOperationAsync(reader.CreateODataBatchReader(), Guid.NewGuid(), null, CancellationToken.None).Wait(),
                "originalRequest");
        }
開發者ID:balajivasudevan,項目名稱:aspnetwebstack,代碼行數:11,代碼來源:UnbufferedODataBatchHandlerTest.cs


注:本文中的System.Net.Http.StringContent.GetODataMessageReaderAsync方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。