From 9d015350270a9642075286281b00aa24120bee8a Mon Sep 17 00:00:00 2001 From: Ahmed-Yaseen99 <186510963+Ahmed-Yaseen99@users.noreply.github.com> Date: Mon, 26 Oct 2026 10:54:43 +0000 Subject: [PATCH 1/2] test: add test for TracerouteEngine ProbeHopAsync outer exception handling --- .../Core/Engines/TracerouteEngineTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs b/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs index e795f8d..35de70b 100644 --- a/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs +++ b/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs @@ -127,4 +127,22 @@ public async Task RunTracerouteAsync_CancellationRequested_StopsEarly() // Should not have discovered any hops since it was cancelled before loop execution Assert.Empty(hops); } + + [Fact] + public async Task RunTracerouteAsync_ProbeHopException_SetsHopStatusFalse() + { + var engine = new TracerouteEngine(); + var hops = new List(); + bool? completed = null; + engine.HopDiscovered += h => hops.Add(h); + engine.TracerouteCompleted += c => completed = c; + + Func pingClientFactory = () => throw new PingException("Simulated ping failure"); + + await engine.RunTracerouteAsync("127.0.0.1", maxHops: 1, timeoutMs: 2000, pingClientFactory: pingClientFactory, token: default); + + Assert.True(completed); + Assert.Single(hops); + Assert.False(hops[0].Status); + } } From eab993d69b69bf67f32a1f10b35d14bc38499a1a Mon Sep 17 00:00:00 2001 From: Ahmed-Yaseen99 <186510963+Ahmed-Yaseen99@users.noreply.github.com> Date: Mon, 26 Oct 2026 11:02:36 +0000 Subject: [PATCH 2/2] fix(tests): resolve IDE0039 analyzer warning in TracerouteEngineTests --- .../NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs b/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs index 35de70b..eac97cb 100644 --- a/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs +++ b/tests/NodeRadarPro.Tests/Core/Engines/TracerouteEngineTests.cs @@ -137,9 +137,7 @@ public async Task RunTracerouteAsync_ProbeHopException_SetsHopStatusFalse() engine.HopDiscovered += h => hops.Add(h); engine.TracerouteCompleted += c => completed = c; - Func pingClientFactory = () => throw new PingException("Simulated ping failure"); - - await engine.RunTracerouteAsync("127.0.0.1", maxHops: 1, timeoutMs: 2000, pingClientFactory: pingClientFactory, token: default); + await engine.RunTracerouteAsync("127.0.0.1", maxHops: 1, timeoutMs: 2000, pingClientFactory: () => throw new PingException("Simulated ping failure"), token: default); Assert.True(completed); Assert.Single(hops);