当前位置: 首页>>代码示例>>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;未经允许,请勿转载。