mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-24 19:13:02 +08:00
master has failed to build since #4840 (NUnit 5) and #4759 (batch lifecycle and continuation tests) both landed: - #4759 calls `Assert.ThrowsAsync`/`Assert.CatchAsync` without `await`, which was the blocking NUnit 4 form. - Under NUnit 5 those methods return a `Task`. This PR adds the missing `await`, the same form as the rest of the migrated tests: - `NodeManagerLifecycleTests.Batch.cs`: six calls (`CS4014`, `NUnit2059`). - `ProductionDatasetClientTests.cs`: one call (`CS4014`). - `HistoryReadContinuationDispatchTests.FaultedRequestKeepsAssignedClientSuppliedContinuationPoint`: this test is synchronous, so it compiled. It discarded the returned `Task`, which means the assertion was never checked. It is now `async Task ...Async` and awaits it. No assertion changes. Tests (net10.0): - `UA.slnx` builds. - `NodeManagerLifecycleTests`: 317/317. - `ProductionDatasetClientTests`: 5/5. - `HistoryReadContinuationDispatchTests`: 6/6. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2997cb8a2c
commit
ac24123dde
@@ -102,7 +102,7 @@ namespace Opc.Ua.PlasticsRubber.Datasets.Tests
|
||||
using var source = new MemoryStream([1]);
|
||||
Task upload = client.UploadAsync(Options(), source).AsTask();
|
||||
await peer.CommitStarted.Task.WaitAsync(TimeSpan.FromSeconds(10)).ConfigureAwait(false);
|
||||
Assert.CatchAsync<OperationCanceledException>(async () => await upload.ConfigureAwait(false));
|
||||
await Assert.CatchAsync<OperationCanceledException>(async () => await upload.ConfigureAwait(false));
|
||||
Assert.That(peer.CommitCalls, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
|
||||
@@ -154,14 +154,14 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
/// node manager restored, saved again and assigned to a result before it failed.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void FaultedRequestKeepsAssignedClientSuppliedContinuationPoint()
|
||||
public async Task FaultedRequestKeepsAssignedClientSuppliedContinuationPointAsync()
|
||||
{
|
||||
using var harness = new HistoryHarness(maxHistory: 10);
|
||||
var continued = new TrackingPoint();
|
||||
harness.Points.SaveHistory(continued);
|
||||
harness.RestoreSaveAssignThenThrow();
|
||||
|
||||
Assert.ThrowsAsync<OperationCanceledException>(
|
||||
await Assert.ThrowsAsync<OperationCanceledException>(
|
||||
async () => await harness.ReadAsync(1, ToByteString(continued.Id)).ConfigureAwait(false));
|
||||
|
||||
Assert.That(continued.Disposed, Is.False);
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
m_server.CurrentInstance.NamespaceUris.GetIndexOrAppend(kModelNamespaceUri));
|
||||
m_server.CurrentInstance.TypeTree.AddSubtype(unrelated, Ua.ObjectTypeIds.BaseObjectType);
|
||||
int decisions = 0;
|
||||
Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
await prepared.CommitAsync(_ =>
|
||||
{
|
||||
decisions++;
|
||||
@@ -693,7 +693,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
CreateOptions(kSecondModelNamespaceUri, kSecondRegistrationValue), null);
|
||||
int decisions = 0;
|
||||
|
||||
Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
{
|
||||
await prepared.CommitAsync(_ =>
|
||||
{
|
||||
@@ -748,7 +748,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
CreateOptions(kSecondModelNamespaceUri, kSecondRegistrationValue), null);
|
||||
int decisions = 0;
|
||||
|
||||
Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
{
|
||||
await prepared.CommitAsync(_ =>
|
||||
{
|
||||
@@ -787,7 +787,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
CreateOptions(kSecondModelNamespaceUri, 404)))
|
||||
], null);
|
||||
|
||||
Assert.ThrowsAsync<IOException>(async () =>
|
||||
await Assert.ThrowsAsync<IOException>(async () =>
|
||||
{
|
||||
await prepared.CommitAsync(_ => throw new IOException("Confirmed decision noncommit."));
|
||||
});
|
||||
@@ -822,7 +822,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
first, CreateOptions(kModelNamespaceUri, 505));
|
||||
int decisions = 0;
|
||||
|
||||
Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
|
||||
{
|
||||
await prepared.CommitAsync(_ =>
|
||||
{
|
||||
@@ -854,7 +854,7 @@ namespace Opc.Ua.Server.Tests.NodeManager
|
||||
cancellation.Cancel();
|
||||
int decisions = 0;
|
||||
|
||||
Assert.CatchAsync<OperationCanceledException>(async () =>
|
||||
await Assert.CatchAsync<OperationCanceledException>(async () =>
|
||||
{
|
||||
await prepared.CommitAsync(_ =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user