mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Changed Example to use Run<T> because we need more examples of this
This commit is contained in:
@@ -287,21 +287,17 @@ namespace Terminal.Gui.Core {
|
||||
[Fact]
|
||||
public void Run_T_After_InitNullDriver_with_TestTopLevel_Throws ()
|
||||
{
|
||||
var p = Environment.OSVersion.Platform;
|
||||
if (p == PlatformID.Win32NT || p == PlatformID.Win32S || p == PlatformID.Win32Windows) {
|
||||
Assert.Throws<InvalidOperationException> (() => Application.Init (null, null));
|
||||
} else {
|
||||
Application.Init (null, null);
|
||||
Assert.Equal (typeof (CursesDriver), Application.Driver.GetType ());
|
||||
Application.Shutdown ();
|
||||
}
|
||||
Application.ForceFakeConsole = true;
|
||||
|
||||
Application.Init (null, null);
|
||||
Assert.Equal (typeof (FakeDriver), Application.Driver.GetType ());
|
||||
|
||||
Application.Iteration = () => {
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
// Init has been called without selecting a driver and we're passing no driver to Run<TestTopLevel>. Bad
|
||||
Assert.Throws<ArgumentException> (() => Application.Run<TestToplevel> ());
|
||||
Application.Run<TestToplevel> ();
|
||||
|
||||
Shutdown ();
|
||||
|
||||
@@ -332,14 +328,16 @@ namespace Terminal.Gui.Core {
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Run_T_NoInit_Throws ()
|
||||
public void Run_T_NoInit_DoesNotThrow ()
|
||||
{
|
||||
Application.ForceFakeConsole = true;
|
||||
|
||||
Application.Iteration = () => {
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
// Init has NOT been called and we're passing no driver to Run<TestToplevel>. This is an error.
|
||||
Assert.Throws<ArgumentException> (() => Application.Run<TestToplevel> (errorHandler: null, driver: null, mainLoopDriver: null));
|
||||
Application.Run<TestToplevel> ();
|
||||
Assert.Equal (typeof (FakeDriver), Application.Driver.GetType ());
|
||||
|
||||
Shutdown ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user