Step 3: Port SetupFakeDriverAttribute to use built-in FakeDriver

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-26 20:23:14 +00:00
parent 8feed295e8
commit 359e6a5d7e
2 changed files with 9 additions and 10 deletions

View File

@@ -1,6 +1,5 @@
using System.Diagnostics;
using System.Reflection;
using TerminalGuiFluentTesting;
using Xunit.Sdk;
namespace UnitTests;
@@ -10,8 +9,7 @@ namespace UnitTests;
/// FakeDriver(). The driver is set up with 25 rows and columns.
/// </summary>
/// <remarks>
/// On Before, sets Configuration.Locations to ConfigLocations.DefaultOnly.
/// On After, sets Configuration.Locations to ConfigLocations.All.
/// This attribute uses the built-in FakeDriver from Terminal.Gui.Drivers namespace.
/// </remarks>
[AttributeUsage (AttributeTargets.Class | AttributeTargets.Method)]
public class SetupFakeDriverAttribute : BeforeAfterTestAttribute
@@ -36,9 +34,10 @@ public class SetupFakeDriverAttribute : BeforeAfterTestAttribute
Application.ResetState (true);
Assert.Null (Application.Driver);
var ff = new FakeDriverFactory ();
var driver = ff.Create ();
// Use the built-in FakeDriver from the library
var driver = new FakeDriver ();
driver.Init ();
Application.Driver = driver;
driver.SetBufferSize (25, 25);