mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
fix(core-tests): 修复 AsyncKeyLockManagerTests 的 MA0004 warning
- 修复 Task.Run 内 await using 的异步释放上下文捕获 warning - 保持 AsyncKeyLockManager 并发测试语义与可读性不变
This commit is contained in:
parent
650618b5ab
commit
e19e60ea1a
@ -176,6 +176,6 @@ public sealed class TrackingPipelineBehavior<TRequest, TResponse> : IPipelineBeh
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
InvocationCount++;
|
||||
return await next(message, cancellationToken);
|
||||
return await next(message, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,12 +227,17 @@ public class AsyncExtensionsTests
|
||||
[Test]
|
||||
public async Task WithRetry_Should_Respect_ShouldRetry_Predicate()
|
||||
{
|
||||
static Task<int> ThrowShouldNotRetry(string parameterName)
|
||||
{
|
||||
throw new ArgumentException("Should not retry", nameof(parameterName));
|
||||
}
|
||||
|
||||
// Arrange
|
||||
var attemptCount = 0;
|
||||
Func<Task<int>> taskFactory = () =>
|
||||
{
|
||||
attemptCount++;
|
||||
throw new ArgumentException("Should not retry");
|
||||
return ThrowShouldNotRetry(nameof(taskFactory));
|
||||
};
|
||||
|
||||
// Act & Assert
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user