tests(org): forward CancellationToken to ReceiveEstimateSignatureAsync
xUnit1051 in two cases that call EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync through Assert.ThrowsAsync lambdas. The lambda body runs on a different stack frame, so capturing TestContext.Current.CancellationToken in a local variable before the lambda is required — otherwise xUnit1051 still flags the call (the implicit 'default' from the parameter default lives in the lambda's scope, not the test's). The 2 xUnit1013 warnings on BaseTestContext.GitClone remain — unrelated, about visibility vs [Fact] attribute on a helper method, structural cleanup for another commit.
This commit is contained in:
parent
e35786a205
commit
d05ac52829
1 changed files with 7 additions and 2 deletions
|
|
@ -91,9 +91,13 @@ public class EstimateSignatureFileHelperTests : IDisposable
|
||||||
public async Task ReceiveEstimateSignatureAsync_rejects_null_payload()
|
public async Task ReceiveEstimateSignatureAsync_rejects_null_payload()
|
||||||
{
|
{
|
||||||
var user = MakeUser("bob");
|
var user = MakeUser("bob");
|
||||||
|
// Capture TestContext.Current.CancellationToken outside the
|
||||||
|
// lambda so xUnit1051 sees a real CancellationToken argument
|
||||||
|
// (the lambda body runs on a different stack frame).
|
||||||
|
var ct = TestContext.Current.CancellationToken;
|
||||||
await Assert.ThrowsAsync<ArgumentNullException>(() =>
|
await Assert.ThrowsAsync<ArgumentNullException>(() =>
|
||||||
EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync(
|
EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync(
|
||||||
user, 1L, SignatureType.Pro, payload: null!));
|
user, 1L, SignatureType.Pro, payload: null!, token: ct));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -101,9 +105,10 @@ public class EstimateSignatureFileHelperTests : IDisposable
|
||||||
{
|
{
|
||||||
var user = MakeUser("bob");
|
var user = MakeUser("bob");
|
||||||
var payload = new SignaturePadPayload { Strokes = new[] { 1, 100, 100 } };
|
var payload = new SignaturePadPayload { Strokes = new[] { 1, 100, 100 } };
|
||||||
|
var ct = TestContext.Current.CancellationToken;
|
||||||
await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
|
await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
|
||||||
EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync(
|
EstimateSignatureFileHelper.ReceiveEstimateSignatureAsync(
|
||||||
user, 0L, SignatureType.Pro, payload));
|
user, 0L, SignatureType.Pro, payload, token: ct));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- helpers ----------------------------------------------------
|
// --- helpers ----------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue