From 15f94cd7bf2627eb1e0d0f51e5df17d344100558 Mon Sep 17 00:00:00 2001 From: Serge Camille Date: Mon, 7 Jun 2021 14:13:04 +0200 Subject: [PATCH] Fix Cancellation test. --- S7.Net.UnitTest/S7NetTestsAsync.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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.