From 3740c875287d261cdce6bcbe651dce97061c5814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Mon, 12 Jan 2026 21:34:11 +0100 Subject: [PATCH] Updated to .NET 10 --- .gitea/workflows/branch-build.yml | 2 +- .gitea/workflows/release-build.yml | 2 +- CHANGELOG.md | 3 +- Directory.Build.props | 2 +- .../FritzCallMonitor.Demo.csproj | 2 +- test/Directory.Build.props | 4 ++ .../CallMonitorClientTest.cs | 33 +++++----- .../CallMonitorEventArgsTest.cs | 27 ++++---- .../FritzCallMonitor.Tests.csproj | 1 - .../ReconnectTcpClientTest.cs | 63 +++++++++---------- 10 files changed, 69 insertions(+), 70 deletions(-) diff --git a/.gitea/workflows/branch-build.yml b/.gitea/workflows/branch-build.yml index d89625f..c1358c4 100644 --- a/.gitea/workflows/branch-build.yml +++ b/.gitea/workflows/branch-build.yml @@ -26,7 +26,7 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.x + dotnet-version: 10.x cache: false - name: Restore dependencies diff --git a/.gitea/workflows/release-build.yml b/.gitea/workflows/release-build.yml index 66f48b2..188fce6 100644 --- a/.gitea/workflows/release-build.yml +++ b/.gitea/workflows/release-build.yml @@ -26,7 +26,7 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.x + dotnet-version: 10.x cache: false - name: Restore dependencies diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b5bf98..b926b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Migrated main repository from Gitlab to Gitea (CI/CD) - Updated to VS 2026 +- Updated to .NET 10 ## [v0.1.2] - 2025-11-08 diff --git a/Directory.Build.props b/Directory.Build.props index 843426f..6bde31a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 12.0 + 14.0 0024000004800000940000000602000000240000525341310004000001000100d9b40f5db1670c563c2e8be5dfd24ed66ad811b3ebba8a0ca0df9cbad3a115ca361b3de4b4d4ed990bf9874d2651e62565f56adb33af33819687021e263b02d6bf5b3cdacde4f09650cafe97467de4b9e4e9cc1d6c2d500a08759697bbe80940916c05533d172ca7e55e10434f9cc46fd189f26cefc100781a20e57f1bad65d5 diff --git a/src/FritzCallMonitor.Demo/FritzCallMonitor.Demo.csproj b/src/FritzCallMonitor.Demo/FritzCallMonitor.Demo.csproj index 555658f..259050a 100644 --- a/src/FritzCallMonitor.Demo/FritzCallMonitor.Demo.csproj +++ b/src/FritzCallMonitor.Demo/FritzCallMonitor.Demo.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net10.0 diff --git a/test/Directory.Build.props b/test/Directory.Build.props index b7872b8..049ab27 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,5 +1,7 @@ + net10.0 + false true true @@ -20,7 +22,9 @@ + + diff --git a/test/FritzCallMonitor.Tests/CallMonitorClientTest.cs b/test/FritzCallMonitor.Tests/CallMonitorClientTest.cs index c9f747b..be5670d 100644 --- a/test/FritzCallMonitor.Tests/CallMonitorClientTest.cs +++ b/test/FritzCallMonitor.Tests/CallMonitorClientTest.cs @@ -4,11 +4,9 @@ using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; -using AMWD.Net.Api.Fritz.CallMonitor; using AMWD.Net.Api.Fritz.CallMonitor.Utils; using AMWD.Net.Api.Fritz.CallMonitor.Wrappers; using Microsoft.Extensions.Logging; -using Moq; namespace FritzCallMonitor.Tests { @@ -21,11 +19,10 @@ namespace FritzCallMonitor.Tests private const string HOST = "localhost"; private const int PORT = 1012; - private readonly DateTime NOW = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local); + private readonly DateTime _now = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local); private string _dateOffset; - private Mock _tcpClientMock; private Mock _networkStreamMock; @@ -35,7 +32,7 @@ namespace FritzCallMonitor.Tests [TestInitialize] public void Initialize() { - var offset = TimeZoneInfo.Local.GetUtcOffset(NOW); + var offset = TimeZoneInfo.Local.GetUtcOffset(_now); _dateOffset = offset < TimeSpan.Zero ? "-" + offset.ToString("hh\\:mm") : "+" + offset.ToString("hh\\:mm"); @@ -44,7 +41,7 @@ namespace FritzCallMonitor.Tests _readAsyncResponses = new Queue<(int, byte[])>(); - _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;\r\n"))); + _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;\r\n"))); _readAsyncResponses.Enqueue((Timeout.Infinite, Array.Empty())); } @@ -83,7 +80,7 @@ namespace FritzCallMonitor.Tests // Arrange var loggerMock = new Mock(); var client = GetClient(); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act client.Logger = loggerMock.Object; @@ -107,7 +104,7 @@ namespace FritzCallMonitor.Tests { // Arrange var client = GetClient(); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act client.Dispose(); @@ -131,7 +128,7 @@ namespace FritzCallMonitor.Tests _tcpClientMock.Setup(m => m.GetStream()).Returns((NetworkStreamWrapper)null); // Act - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); client.Dispose(); // Assert @@ -156,7 +153,7 @@ namespace FritzCallMonitor.Tests }; // Act - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); client.Dispose(); // Assert @@ -185,7 +182,7 @@ namespace FritzCallMonitor.Tests { // Arrange _readAsyncResponses.Clear(); - _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{NOW:dd.MM.yy HH:mm:ss};RING;"))); + _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{_now:dd.MM.yy HH:mm:ss};RING;"))); _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes("2;012345678901;9876543;SIP0;\n"))); _readAsyncResponses.Enqueue((Timeout.Infinite, Array.Empty())); @@ -199,7 +196,7 @@ namespace FritzCallMonitor.Tests }; // Act - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); client.Dispose(); // Assert @@ -228,7 +225,7 @@ namespace FritzCallMonitor.Tests { // Arrange _readAsyncResponses.Clear(); - _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;\n{NOW:dd.MM.yy HH:mm:ss}"))); + _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;\n{_now:dd.MM.yy HH:mm:ss}"))); _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes(";RING;2;012345678901;9876543;SIP0;\r\n"))); _readAsyncResponses.Enqueue((Timeout.Infinite, Array.Empty())); @@ -240,7 +237,7 @@ namespace FritzCallMonitor.Tests }; // Act - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); client.Dispose(); // Assert @@ -260,7 +257,7 @@ namespace FritzCallMonitor.Tests { // Arrange _readAsyncResponses.Clear(); - _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{NOW:dd.MM.yy HH:mm:ss};TEST;2;012345678901;9876543;SIP0;\n{NOW:dd.MM.yy HH:mm:ss}"))); + _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes($"{_now:dd.MM.yy HH:mm:ss};TEST;2;012345678901;9876543;SIP0;\n{_now:dd.MM.yy HH:mm:ss}"))); _readAsyncResponses.Enqueue((0, Encoding.UTF8.GetBytes(";RING;2;012345678901;9876543;SIP0;\r\n"))); _readAsyncResponses.Enqueue((Timeout.Infinite, Array.Empty())); @@ -272,7 +269,7 @@ namespace FritzCallMonitor.Tests }; // Act - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); client.Dispose(); // Assert @@ -328,9 +325,9 @@ namespace FritzCallMonitor.Tests tcpClientField.SetValue(client, _tcpClientMock.Object); var onConnectedMethodInfo = client.GetType().GetMethod("OnConnected", BindingFlags.NonPublic | BindingFlags.Instance); - _tcpClientMock.SetupGet(c => c.OnConnected).Returns((Func)onConnectedMethodInfo.CreateDelegate(typeof(Func), client)); + _tcpClientMock.SetupGet(c => c.OnConnected).Returns(onConnectedMethodInfo.CreateDelegate>(client)); - _tcpClientMock.Object.OnConnected(_tcpClientMock.Object).Wait(); + _tcpClientMock.Object.OnConnected(_tcpClientMock.Object).Wait(TestContext.CancellationToken); return client; } } diff --git a/test/FritzCallMonitor.Tests/CallMonitorEventArgsTest.cs b/test/FritzCallMonitor.Tests/CallMonitorEventArgsTest.cs index 3714f76..fb65929 100644 --- a/test/FritzCallMonitor.Tests/CallMonitorEventArgsTest.cs +++ b/test/FritzCallMonitor.Tests/CallMonitorEventArgsTest.cs @@ -1,5 +1,4 @@ using System; -using AMWD.Net.Api.Fritz.CallMonitor; namespace FritzCallMonitor.Tests { @@ -8,12 +7,12 @@ namespace FritzCallMonitor.Tests { private string _dateOffset; - private readonly DateTime NOW = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local); + private readonly DateTime _now = new(2025, 8, 25, 20, 15, 30, DateTimeKind.Local); [TestInitialize] public void Initialize() { - var offset = TimeZoneInfo.Local.GetUtcOffset(NOW); + var offset = TimeZoneInfo.Local.GetUtcOffset(_now); _dateOffset = offset < TimeSpan.Zero ? "-" + offset.ToString("hh\\:mm") : "+" + offset.ToString("hh\\:mm"); @@ -23,7 +22,7 @@ namespace FritzCallMonitor.Tests public void ShouldParseRingEvent() { // Arrange - string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); @@ -39,7 +38,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldParseConnectEvent() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};CONNECT;1;3;012345678901;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};CONNECT;1;3;012345678901;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); @@ -55,7 +54,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldParseDisconnectEvent() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};DISCONNECT;2;42;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};DISCONNECT;2;42;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); @@ -71,7 +70,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldParseCallEvent() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};CALL;4;7;9876543;012345678901;SIP0;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};CALL;4;7;9876543;012345678901;SIP0;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); @@ -95,7 +94,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldReturnNullOnUnknownEventType() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};UNKNOWN;2;012345678901;9876543;SIP0;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};UNKNOWN;2;012345678901;9876543;SIP0;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNull(result); } @@ -103,7 +102,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldReturnNullOnInvalidConnectionId() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;abc;012345678901;9876543;SIP0;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};RING;abc;012345678901;9876543;SIP0;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNull(result); } @@ -111,7 +110,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldHandleInvalidLinePortInConnect() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};CONNECT;1;abc;012345678901;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};CONNECT;1;abc;012345678901;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); Assert.IsNull(result.LinePort); @@ -120,7 +119,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldHandleInvalidLinePortInCall() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};CALL;4;abc;9876543;012345678901;SIP0;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};CALL;4;abc;9876543;012345678901;SIP0;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); Assert.IsNull(result.LinePort); @@ -129,7 +128,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldHandleInvalidDurationInDisconnect() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};DISCONNECT;2;abc;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};DISCONNECT;2;abc;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); Assert.IsNull(result.Duration); @@ -138,7 +137,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldReturnNullOnTooFewColumns() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};RING;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNull(result); } @@ -146,7 +145,7 @@ namespace FritzCallMonitor.Tests [TestMethod] public void ShouldParseWithExtraColumns() { - string line = $"{NOW:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;EXTRA;COLUMN;"; + string line = $"{_now:dd.MM.yy HH:mm:ss};RING;2;012345678901;9876543;SIP0;EXTRA;COLUMN;"; var result = CallMonitorEventArgs.Parse(line); Assert.IsNotNull(result); Assert.AreEqual("012345678901", result.ExternalNumber); diff --git a/test/FritzCallMonitor.Tests/FritzCallMonitor.Tests.csproj b/test/FritzCallMonitor.Tests/FritzCallMonitor.Tests.csproj index e2e36c6..e9b4c0e 100644 --- a/test/FritzCallMonitor.Tests/FritzCallMonitor.Tests.csproj +++ b/test/FritzCallMonitor.Tests/FritzCallMonitor.Tests.csproj @@ -1,7 +1,6 @@  - net8.0 $(NoWarn);CA1873 diff --git a/test/FritzCallMonitor.Tests/ReconnectTcpClientTest.cs b/test/FritzCallMonitor.Tests/ReconnectTcpClientTest.cs index 9ec7044..6838e8b 100644 --- a/test/FritzCallMonitor.Tests/ReconnectTcpClientTest.cs +++ b/test/FritzCallMonitor.Tests/ReconnectTcpClientTest.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using AMWD.Net.Api.Fritz.CallMonitor.Utils; using AMWD.Net.Api.Fritz.CallMonitor.Wrappers; using Microsoft.Extensions.Logging; -using Moq; namespace FritzCallMonitor.Tests { @@ -80,8 +79,8 @@ namespace FritzCallMonitor.Tests { // Arrange var client = GetClient(); - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act client.Dispose(); @@ -105,8 +104,8 @@ namespace FritzCallMonitor.Tests { // Arrange using var client = GetClient(); - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act client.Dispose(); @@ -134,7 +133,7 @@ namespace FritzCallMonitor.Tests client.Dispose(); // Act & Assert - await Assert.ThrowsExactlyAsync(async () => await client.StartAsync(TestContext.CancellationTokenSource.Token)); + await Assert.ThrowsExactlyAsync(async () => await client.StartAsync(TestContext.CancellationToken)); VerifyNoOtherCalls(); } @@ -147,7 +146,7 @@ namespace FritzCallMonitor.Tests client.Dispose(); // Act & Assert - await Assert.ThrowsExactlyAsync(async () => await client.StopAsync(TestContext.CancellationTokenSource.Token)); + await Assert.ThrowsExactlyAsync(async () => await client.StopAsync(TestContext.CancellationToken)); VerifyNoOtherCalls(); } @@ -172,8 +171,8 @@ namespace FritzCallMonitor.Tests _tcpClientConnectTaskDelays.Enqueue(Timeout.Infinite); var client = GetClient(); - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act & Assert _tcpClientConnected = true; @@ -208,10 +207,10 @@ namespace FritzCallMonitor.Tests }; // Act - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); - await client.StopAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); + await client.StopAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Assert Assert.IsTrue(callbackCalled); @@ -236,10 +235,10 @@ namespace FritzCallMonitor.Tests var client = GetClient(); // Act & Assert - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); - await client.StopAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); + await client.StopAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); _socketMock.Verify(m => m.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true), Times.Once); @@ -261,7 +260,7 @@ namespace FritzCallMonitor.Tests var client = GetClient(); // Act & Assert - await client.StopAsync(TestContext.CancellationTokenSource.Token); + await client.StopAsync(TestContext.CancellationToken); VerifyNoOtherCalls(); } @@ -271,8 +270,8 @@ namespace FritzCallMonitor.Tests { // Arrange var client = GetClient(); - await client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + await client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); // Act var stream = client.GetStream(); @@ -317,10 +316,10 @@ namespace FritzCallMonitor.Tests using var client = GetClient(); // Act - var startTask = client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); - await client.StopAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + var startTask = client.StartAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); + await client.StopAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); await startTask; // Assert @@ -350,10 +349,10 @@ namespace FritzCallMonitor.Tests .ThrowsAsync(new SocketException()); // Act - var startTask = client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(1000, TestContext.CancellationTokenSource.Token); // Should try to connect two times. - await client.StopAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + var startTask = client.StartAsync(TestContext.CancellationToken); + await Task.Delay(1000, TestContext.CancellationToken); // Should try to connect two times. + await client.StopAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); await startTask; // Assert @@ -394,10 +393,10 @@ namespace FritzCallMonitor.Tests .ThrowsAsync(new ObjectDisposedException("Test")); // Act - var startTask = client.StartAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(1000, TestContext.CancellationTokenSource.Token); // Should try to connect two times. - await client.StopAsync(TestContext.CancellationTokenSource.Token); - await Task.Delay(ASYNC_DELAY, TestContext.CancellationTokenSource.Token); + var startTask = client.StartAsync(TestContext.CancellationToken); + await Task.Delay(1000, TestContext.CancellationToken); // Should try to connect two times. + await client.StopAsync(TestContext.CancellationToken); + await Task.Delay(ASYNC_DELAY, TestContext.CancellationToken); await startTask; // Assert