fix concurrent tests 2 - This should wait for cancellation to happen (#316)
* Fix test to be deterministic * This should wait for cancellation to happen * update csharpier
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"csharpier": {
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"commands": [
|
||||
"csharpier"
|
||||
],
|
||||
|
||||
@@ -36,7 +36,7 @@ public class AdditionalCancellationTests
|
||||
);
|
||||
|
||||
var task = serializeProcess.Serialize(testClass);
|
||||
cancellationSource.Cancel();
|
||||
await cancellationSource.CancelAsync();
|
||||
|
||||
var ex = await Assert.ThrowsAsync<OperationCanceledException>(async () => await task);
|
||||
await Verify(ex);
|
||||
@@ -64,7 +64,7 @@ public class AdditionalCancellationTests
|
||||
tasks.Add(serializeProcess.Serialize(i % 2 == 0 ? testClass1 : testClass2));
|
||||
}
|
||||
|
||||
cancellationSource.Cancel();
|
||||
await cancellationSource.CancelAsync();
|
||||
|
||||
while (tasks.Count != 0)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class AdditionalCancellationTests
|
||||
);
|
||||
|
||||
await serializeProcess.Serialize(testClass);
|
||||
cancellationSource.Cancel(); // Cancel after completion
|
||||
await cancellationSource.CancelAsync();
|
||||
|
||||
cancellationSource.IsCancellationRequested.Should().BeTrue();
|
||||
}
|
||||
|
||||
+2
-1
@@ -118,7 +118,8 @@ public class ProjectResourceExceptionalTests : IAsyncLifetime
|
||||
{
|
||||
ProjectUpdateRoleInput input = new(_secondUser.Account.id.NotNull(), "NonExistentProject", newRole);
|
||||
|
||||
var ex = await Assert.ThrowsAsync<AggregateException>(async () => _ = await _unauthedUser.Project.UpdateRole(input)
|
||||
var ex = await Assert.ThrowsAsync<AggregateException>(async () =>
|
||||
_ = await _unauthedUser.Project.UpdateRole(input)
|
||||
);
|
||||
ex.InnerExceptions.Single().Should().BeOfType<SpeckleGraphQLForbiddenException>();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ public class SpeckleHttpTests : MoqTest
|
||||
|
||||
var uri = new Uri("https://speckle.xyz");
|
||||
mockHttp.When(uri.AbsoluteUri).Respond(HttpStatusCode.Unauthorized);
|
||||
await Assert.ThrowsAsync<HttpRequestException>(async () => await speckleHttp.HttpPing(uri, mockHttp.ToHttpClient())
|
||||
await Assert.ThrowsAsync<HttpRequestException>(async () =>
|
||||
await speckleHttp.HttpPing(uri, mockHttp.ToHttpClient())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user