mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-12 13:14:30 +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)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
InvocationCount++;
|
InvocationCount++;
|
||||||
return await next(message, cancellationToken);
|
return await next(message, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -227,12 +227,17 @@ public class AsyncExtensionsTests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task WithRetry_Should_Respect_ShouldRetry_Predicate()
|
public async Task WithRetry_Should_Respect_ShouldRetry_Predicate()
|
||||||
{
|
{
|
||||||
|
static Task<int> ThrowShouldNotRetry(string parameterName)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Should not retry", nameof(parameterName));
|
||||||
|
}
|
||||||
|
|
||||||
// Arrange
|
// Arrange
|
||||||
var attemptCount = 0;
|
var attemptCount = 0;
|
||||||
Func<Task<int>> taskFactory = () =>
|
Func<Task<int>> taskFactory = () =>
|
||||||
{
|
{
|
||||||
attemptCount++;
|
attemptCount++;
|
||||||
throw new ArgumentException("Should not retry");
|
return ThrowShouldNotRetry(nameof(taskFactory));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user