mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
All unit test pass for reals?
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
@@ -80,6 +81,16 @@ public static partial class Application // Initialization (Init/Shutdown)
|
|||||||
if (driver is { })
|
if (driver is { })
|
||||||
{
|
{
|
||||||
Driver = driver;
|
Driver = driver;
|
||||||
|
|
||||||
|
if (driver is FakeDriver)
|
||||||
|
{
|
||||||
|
// We're running unit tests. Disable loading config files other than default
|
||||||
|
if (Locations == ConfigLocations.All)
|
||||||
|
{
|
||||||
|
Locations = ConfigLocations.DefaultOnly;
|
||||||
|
Reset ();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the process of configuration management.
|
// Start the process of configuration management.
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class AutoInitShutdownAttribute : BeforeAfterTestAttribute
|
|||||||
_verifyShutdown = verifyShutdown;
|
_verifyShutdown = verifyShutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _verifyShutdown;
|
private readonly bool _verifyShutdown;
|
||||||
private readonly Type _driverType;
|
private readonly Type _driverType;
|
||||||
|
|
||||||
public override void After (MethodInfo methodUnderTest)
|
public override void After (MethodInfo methodUnderTest)
|
||||||
@@ -114,7 +114,7 @@ public class AutoInitShutdownAttribute : BeforeAfterTestAttribute
|
|||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
// Enable subsequent tests that call Init to get all config files (the default).
|
// Enable subsequent tests that call Init to get all config files (the default).
|
||||||
Locations = ConfigLocations.All;
|
//Locations = ConfigLocations.All;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Before (MethodInfo methodUnderTest)
|
public override void Before (MethodInfo methodUnderTest)
|
||||||
@@ -161,9 +161,6 @@ public class TestRespondersDisposed : BeforeAfterTestAttribute
|
|||||||
Debug.WriteLine ($"After: {methodUnderTest.Name}");
|
Debug.WriteLine ($"After: {methodUnderTest.Name}");
|
||||||
base.After (methodUnderTest);
|
base.After (methodUnderTest);
|
||||||
|
|
||||||
// Reset the to default All
|
|
||||||
Locations = ConfigLocations.All;
|
|
||||||
|
|
||||||
#if DEBUG_IDISPOSABLE
|
#if DEBUG_IDISPOSABLE
|
||||||
Assert.Empty (Responder.Instances);
|
Assert.Empty (Responder.Instances);
|
||||||
#endif
|
#endif
|
||||||
@@ -173,10 +170,6 @@ public class TestRespondersDisposed : BeforeAfterTestAttribute
|
|||||||
{
|
{
|
||||||
Debug.WriteLine ($"Before: {methodUnderTest.Name}");
|
Debug.WriteLine ($"Before: {methodUnderTest.Name}");
|
||||||
|
|
||||||
// Force the use of the default config file
|
|
||||||
Locations = ConfigLocations.DefaultOnly;
|
|
||||||
Reset ();
|
|
||||||
|
|
||||||
base.Before (methodUnderTest);
|
base.Before (methodUnderTest);
|
||||||
#if DEBUG_IDISPOSABLE
|
#if DEBUG_IDISPOSABLE
|
||||||
|
|
||||||
@@ -208,19 +201,12 @@ public class SetupFakeDriverAttribute : BeforeAfterTestAttribute
|
|||||||
|
|
||||||
Application.Driver = null;
|
Application.Driver = null;
|
||||||
base.After (methodUnderTest);
|
base.After (methodUnderTest);
|
||||||
|
|
||||||
// Reset the to default All
|
|
||||||
Locations = ConfigLocations.All;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Before (MethodInfo methodUnderTest)
|
public override void Before (MethodInfo methodUnderTest)
|
||||||
{
|
{
|
||||||
Debug.WriteLine ($"Before: {methodUnderTest.Name}");
|
Debug.WriteLine ($"Before: {methodUnderTest.Name}");
|
||||||
|
|
||||||
// Force the use of the default config file
|
|
||||||
Locations = ConfigLocations.DefaultOnly;
|
|
||||||
Reset ();
|
|
||||||
|
|
||||||
Application.ResetState (true);
|
Application.ResetState (true);
|
||||||
Assert.Null (Application.Driver);
|
Assert.Null (Application.Driver);
|
||||||
Application.Driver = new FakeDriver { Rows = 25, Cols = 25 };
|
Application.Driver = new FakeDriver { Rows = 25, Cols = 25 };
|
||||||
|
|||||||
@@ -1318,6 +1318,9 @@ public class TabViewTests (ITestOutputHelper output)
|
|||||||
|
|
||||||
private void InitFakeDriver ()
|
private void InitFakeDriver ()
|
||||||
{
|
{
|
||||||
|
ConfigurationManager.Locations = ConfigurationManager.ConfigLocations.DefaultOnly;
|
||||||
|
ConfigurationManager.Reset ();
|
||||||
|
|
||||||
var driver = new FakeDriver ();
|
var driver = new FakeDriver ();
|
||||||
Application.Init (driver);
|
Application.Init (driver);
|
||||||
driver.Init ();
|
driver.Init ();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[AutoInitShutdown]
|
[AutoInitShutdown (configLocation: ConfigurationManager.ConfigLocations.DefaultOnly)]
|
||||||
public void CellEventsBackgroundFill ()
|
public void CellEventsBackgroundFill ()
|
||||||
{
|
{
|
||||||
var tv = new TableView { Width = 20, Height = 4 };
|
var tv = new TableView { Width = 20, Height = 4 };
|
||||||
@@ -412,7 +412,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[AutoInitShutdown]
|
[AutoInitShutdown (configLocation: ConfigurationManager.ConfigLocations.DefaultOnly)]
|
||||||
public void LongColumnTest ()
|
public void LongColumnTest ()
|
||||||
{
|
{
|
||||||
var tableView = new TableView ();
|
var tableView = new TableView ();
|
||||||
@@ -602,7 +602,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|||||||
top.Dispose ();
|
top.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
[AutoInitShutdown]
|
[AutoInitShutdown (configLocation: ConfigurationManager.ConfigLocations.DefaultOnly)]
|
||||||
[Fact]
|
[Fact]
|
||||||
public void PageDown_ExcludesHeaders ()
|
public void PageDown_ExcludesHeaders ()
|
||||||
{
|
{
|
||||||
@@ -1000,7 +1000,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[AutoInitShutdown]
|
[AutoInitShutdown (configLocation: ConfigurationManager.ConfigLocations.DefaultOnly)]
|
||||||
public void TableView_Activate ()
|
public void TableView_Activate ()
|
||||||
{
|
{
|
||||||
string activatedValue = null;
|
string activatedValue = null;
|
||||||
@@ -1566,7 +1566,7 @@ public class TableViewTests (ITestOutputHelper output)
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
[AutoInitShutdown]
|
[AutoInitShutdown (configLocation: ConfigurationManager.ConfigLocations.DefaultOnly)]
|
||||||
public void Test_CollectionNavigator ()
|
public void Test_CollectionNavigator ()
|
||||||
{
|
{
|
||||||
var tv = new TableView ();
|
var tv = new TableView ();
|
||||||
|
|||||||
Reference in New Issue
Block a user