From 3ffc6405b4f29ebc7150042d43473217041af7c1 Mon Sep 17 00:00:00 2001 From: BDisp Date: Sat, 23 Mar 2024 19:45:32 +0000 Subject: [PATCH] Fix ConsoleDriverTests. --- UnitTests/ConsoleDrivers/ConsoleDriverTests.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs index d08d3a969..ad2d19dc6 100644 --- a/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs +++ b/UnitTests/ConsoleDrivers/ConsoleDriverTests.cs @@ -49,7 +49,7 @@ public class ConsoleDriverTests Console.MockKeyPresses = mKeys; - Toplevel top = Application.Top; + Toplevel top = new (); var view = new View { CanFocus = true }; var rText = ""; var idx = 0; @@ -72,10 +72,11 @@ public class ConsoleDriverTests } }; - Application.Run (); + Application.Run (top); Assert.Equal ("MockKeyPresses", rText); + top.Dispose (); // Shutdown must be called to safely clean up Application if Init has been called Application.Shutdown (); } @@ -87,7 +88,7 @@ public class ConsoleDriverTests var driver = (ConsoleDriver)Activator.CreateInstance (driverType); Application.Init (driver); - Toplevel top = Application.Top; + Toplevel top = new (); var view = new View { CanFocus = true }; var count = 0; var wasKeyPressed = false; @@ -105,10 +106,11 @@ public class ConsoleDriverTests } }; - Application.Run (); + Application.Run (top); Assert.False (wasKeyPressed); + top.Dispose (); // Shutdown must be called to safely clean up Application if Init has been called Application.Shutdown (); }