mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Commented out `driver ??= Application.Driver` assignments in `DriverAssert` to prevent automatic global driver assignment. Removed `Application.ResetState(true)` calls and commented out state validation assertions in `GlobalTestSetup` to reduce dependency on global state. Reintroduced `ApplicationForceDriverTests` and `ApplicationModelFencingTests` to validate `ForceDriver` behavior and ensure proper handling of legacy and modern Application models. Skipped certain `ToAnsiTests` that rely on `Application`. Removed direct `Application.Driver` assignments in `ViewDrawingClippingTests` and `ViewDrawingFlowTests`. Performed general cleanup of redundant code and unused imports to simplify the codebase.
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using UnitTests;
|
|
|
|
namespace UnitTests_Parallelizable.ApplicationTests;
|
|
|
|
public class ApplicationForceDriverTests : FakeDriverBase
|
|
{
|
|
[Fact]
|
|
public void ForceDriver_Does_Not_Changes_If_It_Has_Valid_Value ()
|
|
{
|
|
Assert.False (Application.Initialized);
|
|
Assert.Null (Application.Driver);
|
|
Assert.Equal (string.Empty, Application.ForceDriver);
|
|
|
|
Application.ForceDriver = "fake";
|
|
Assert.Equal ("fake", Application.ForceDriver);
|
|
|
|
Application.ForceDriver = "dotnet";
|
|
Assert.Equal ("fake", Application.ForceDriver);
|
|
}
|
|
|
|
[Fact]
|
|
public void ForceDriver_Throws_If_Initialized_Changed_To_Another_Value ()
|
|
{
|
|
IDriver driver = CreateFakeDriver ();
|
|
|
|
Assert.False (Application.Initialized);
|
|
Assert.Null (Application.Driver);
|
|
Assert.Equal (string.Empty, Application.ForceDriver);
|
|
|
|
Application.Init (driverName: "fake");
|
|
Assert.True (Application.Initialized);
|
|
Assert.NotNull (Application.Driver);
|
|
Assert.Equal ("fake", Application.Driver.GetName ());
|
|
Assert.Equal (string.Empty, Application.ForceDriver);
|
|
|
|
Assert.Throws<InvalidOperationException> (() => Application.ForceDriver = "dotnet");
|
|
|
|
Application.ForceDriver = "fake";
|
|
Assert.Equal ("fake", Application.ForceDriver);
|
|
}
|
|
}
|