mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Step 3: Port SetupFakeDriverAttribute to use built-in FakeDriver
Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user