本文整理汇总了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'.");
}
示例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);
}
示例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");
}