本文整理匯總了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");
}