mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 16:27:55 +01:00
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 (driver);
|
|
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);
|
|
}
|
|
}
|