diff --git a/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs b/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs index dec13f3e..46d61c8a 100644 --- a/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs +++ b/test/UnitTest/Bootstrap.Admin/HttpClientExtensions.cs @@ -6,10 +6,13 @@ using System.Threading.Tasks; namespace Bootstrap.Admin { + /// + /// HttpClient 扩展操作类 + /// public static class HttpClientExtensions { /// - /// + /// GetJson 异步方法 /// /// /// @@ -19,11 +22,11 @@ namespace Bootstrap.Admin { var resp = await client.GetAsync(requestUri); var json = await resp.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(json, new JsonSerializerOptions().Configure()); + return JsonSerializer.Deserialize(json, new JsonSerializerOptions().AddDefaultConverters()); } /// - /// + /// PostJson 异步方法 /// /// /// @@ -35,11 +38,11 @@ namespace Bootstrap.Admin { var resp = await client.PostAsJsonAsync(requestUri, t); var json = await resp.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(json, new JsonSerializerOptions().Configure()); + return JsonSerializer.Deserialize(json, new JsonSerializerOptions().AddDefaultConverters()); } /// - /// + /// PostJson 异步方法 /// /// /// @@ -49,7 +52,7 @@ namespace Bootstrap.Admin public static async Task PostAsJsonAsync(this HttpClient client, TValue t) => await PostAsJsonAsync(client, string.Empty, t); /// - /// + /// DeleteJson 异步方法 /// /// /// @@ -65,11 +68,11 @@ namespace Bootstrap.Admin var resp = await client.SendAsync(req); var json = await resp.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(json, new JsonSerializerOptions().Configure()); + return JsonSerializer.Deserialize(json, new JsonSerializerOptions().AddDefaultConverters()); } /// - /// + /// DeleteJson 异步方法 /// /// /// @@ -79,7 +82,7 @@ namespace Bootstrap.Admin public static async Task DeleteAsJsonAsync(this HttpClient client, TValue t) => await DeleteAsJsonAsync(client, string.Empty, t); /// - /// + /// PutJson 异步方法 /// /// /// @@ -91,11 +94,11 @@ namespace Bootstrap.Admin { var resp = await client.PutAsJsonAsync(requestUri, t); var json = await resp.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(json, new JsonSerializerOptions().Configure()); + return JsonSerializer.Deserialize(json, new JsonSerializerOptions().AddDefaultConverters()); } /// - /// + /// PutJson 异步方法 /// /// /// @@ -104,6 +107,14 @@ namespace Bootstrap.Admin /// public static async Task PutAsJsonAsync(this HttpClient client, TValue t) => await PutAsJsonAsync(client, string.Empty, t); + + /// + /// LoginAsync 异步方法 + /// + /// + /// + /// + /// public static async Task LoginAsync(this HttpClient client, string userName = "Admin", string password = "123789") { var r = await client.GetAsync("/Account/Login");