From 717281b9509279ce07c9189ccfefbed82efafc4a Mon Sep 17 00:00:00 2001 From: Paul Morris-Hill Date: Wed, 3 Jul 2024 14:49:06 +0100 Subject: [PATCH] Expose http listener disposable --- FluentSim/FluentSimulator.cs | 7 ++++++- FluentSimTests/FluentSimTests.cs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/FluentSim/FluentSimulator.cs b/FluentSim/FluentSimulator.cs index 0cf474e..68b4d40 100644 --- a/FluentSim/FluentSimulator.cs +++ b/FluentSim/FluentSimulator.cs @@ -10,7 +10,7 @@ namespace FluentSim { - public class FluentSimulator + public class FluentSimulator : IDisposable { private string Address; private List ConfiguredRoutes = new List(); @@ -198,5 +198,10 @@ public void EnableCors() { CorsEnabled = true; } + + public void Dispose() + { + ((IDisposable) HttpListener)?.Dispose(); + } } } \ No newline at end of file diff --git a/FluentSimTests/FluentSimTests.cs b/FluentSimTests/FluentSimTests.cs index 063d884..4f44b6f 100644 --- a/FluentSimTests/FluentSimTests.cs +++ b/FluentSimTests/FluentSimTests.cs @@ -32,6 +32,7 @@ public void SetUp() public void TearDown() { Sim.Stop(); + Sim.Dispose(); } [Test]