U:调整所有代码格式

This commit is contained in:
jimmy committed 2025-12-30 09:17:25 +08:00
1 parent d133bacf55
commit 155b67e831
342 files changed
+9431 -9868

No files matched your search

@@ -13,6 +13,8 @@ public sealed class StaticTokenProvider : IAccessTokenProvider
_token = token;
}
public Task<string?> GetTokenAsync(CancellationToken cancellationToken = default) => Task.FromResult(_token);
}
public Task<string?> GetTokenAsync(CancellationToken cancellationToken = default)
{
return Task.FromResult(_token);
}
}
@@ -18,15 +18,21 @@ public sealed class TestHttpMessageHandler : HttpMessageHandler
_handler = handler;
}
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
Interlocked.Increment(ref _calls);
return await _handler(request);
}
public static HttpResponseMessage Json(HttpStatusCode code, string json)
=> new(code) { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };
{
return new HttpResponseMessage(code)
{ Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") };
}
public static HttpResponseMessage Text(HttpStatusCode code, string text)
=> new(code) { Content = new StringContent(text) };
}
{
return new HttpResponseMessage(code) { Content = new StringContent(text) };
}
}
@@ -18,8 +18,12 @@ public sealed class TestJsonSerializer : IHttpContentSerializer
public string ContentType => "application/json";
public Task SerializeAsync<T>(Stream stream, T? value, CancellationToken cancellationToken = default)
=> JsonSerializer.SerializeAsync(stream, value, _options, cancellationToken);
{
return JsonSerializer.SerializeAsync(stream, value, _options, cancellationToken);
}
public Task<T?> DeserializeAsync<T>(Stream stream, CancellationToken cancellationToken = default)
=> JsonSerializer.DeserializeAsync<T>(stream, _options, cancellationToken).AsTask();
}
{
return JsonSerializer.DeserializeAsync<T>(stream, _options, cancellationToken).AsTask();
}
}