diff --git a/S7.Net.UnitTest/S7NetTestsAsync.cs b/S7.Net.UnitTest/S7NetTestsAsync.cs index 5ebbf4a..f94ddb8 100644 --- a/S7.Net.UnitTest/S7NetTestsAsync.cs +++ b/S7.Net.UnitTest/S7NetTestsAsync.cs @@ -935,15 +935,15 @@ namespace S7.Net.UnitTest { await plc.WriteBytesAsync(DataType.DataBlock, db, 0, data, cancellationToken); } - catch(TaskCanceledException) + catch(OperationCanceledException) { // everything is good, that is the exception we expect - Console.WriteLine("Task was cancelled as expected."); + Console.WriteLine("Operation was cancelled as expected."); return; } catch(Exception e) { - Assert.Fail($"Wrong exception type received. Expected {typeof(TaskCanceledException)}, received {e.GetType()}."); + Assert.Fail($"Wrong exception type received. Expected {typeof(OperationCanceledException)}, received {e.GetType()}."); } // Depending on how tests run, this can also just succeed without getting cancelled at all. Do nothing in this case.