本文整理汇总了C#中RestClient.PatchAsync方法的典型用法代码示例。如果您正苦于以下问题:C# RestClient.PatchAsync方法的具体用法?C# RestClient.PatchAsync怎么用?C# RestClient.PatchAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestClient
的用法示例。
在下文中一共展示了RestClient.PatchAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_patch_xml
public async Task Should_patch_xml()
{
using (var server = TestServer.Create<Startup>())
{
var restClient = new RestClient(server.HttpClient);
var obj = await restClient.PatchAsync<object>("/api/foos/{0}".FormatUri(1), new Foo(), MediaTypes.ApplicationXml, null);
obj.ShouldBeNull();
}
}
示例2: Should_patch_form_url_encoded_content
public async Task Should_patch_form_url_encoded_content()
{
using (var server = TestServer.Create<Startup>())
{
var restClient = new RestClient(server.HttpClient);
var values = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("SomeInt", "1") };
var content = new FormUrlEncodedContent(values);
var obj = await restClient.PatchAsync<object>("/api/foos/{0}".FormatUri(1), content, MediaTypes.FormUrlEncoded, null);
obj.ShouldBeNull();
}
}
示例3: Should_patch_json_with_parameters
public async Task Should_patch_json_with_parameters()
{
using (var server = TestServer.Create<Startup>())
{
var restClient = new RestClient(server.HttpClient);
var parameters = new Dictionary<string, string> { { "param1", "value1" }, { "param2", "value2" } };
var obj = await restClient.PatchAsync<object>("/api/foos", new Foo(), MediaTypes.ApplicationJson, null, parameters);
obj.ShouldBeNull();
}
}