2
0
Tig 48d6e13138 Fixes #4466 - `FillRect` Corrupts Wide Characters When Overlapping (#4486) 1 өдөр өмнө
..
Application 3ae28bbf5a Makes timeout tests more robust to slow GH runners (#4461) 5 өдөр өмнө
Configuration d303943809 Fixes #4004 & #4445 - Merge of `Application.ForceDriver and Driver.Force16Colors` and `windows" broken in conhost and cmd` (#4448) 1 долоо хоног өмнө
Drawing aab90e1fbc Fixes #4463 - Adds `LineCanvas.GetRegion()` - 10x performance regression in `RenderLineCanvas` (#4464) 5 өдөр өмнө
Drivers 48d6e13138 Fixes #4466 - `FillRect` Corrupts Wide Characters When Overlapping (#4486) 1 өдөр өмнө
FileServices a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
Input a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
Resources a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
Text d303943809 Fixes #4004 & #4445 - Merge of `Application.ForceDriver and Driver.Force16Colors` and `windows" broken in conhost and cmd` (#4448) 1 долоо хоног өмнө
ViewBase e7a4df492d Fixes #4050. Rename Command.Select and Selecting to Activate/Activating (#4470) 4 өдөр өмнө
Views e7a4df492d Fixes #4050. Rename Command.Select and Selecting to Activate/Activating (#4470) 4 өдөр өмнө
AssemblyInfo.cs cab22566ea Fixes #4107 - Revamps Terminal.Gui's `namespace` (#4109) 6 сар өмнө
LocalPackagesTests.cs a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
README.md a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
TestDateAttribute.cs b9f55a5a96 Fixes #4410, #4413, #4414, #4415 - `MessageBox` nullable, `Clipboard` refactor, fence for legacy/modern App, and makes internal classes thread safe. (#4411) 2 долоо хоног өмнө
TestSetup.cs b9f55a5a96 Fixes #4410, #4413, #4414, #4415 - `MessageBox` nullable, `Clipboard` refactor, fence for legacy/modern App, and makes internal classes thread safe. (#4411) 2 долоо хоног өмнө
UnitTests.Parallelizable.csproj a84b2c4896 Fixes #4419, #4148, #4408 - Toplevel is GONE - Replaced by Runnable (#4422) 1 долоо хоног өмнө
UnitTests.Parallelizable.csproj.DotSettings b0f32811eb Fixes #3930 - Splits tests to `Tests/UnitTests`, `Tests/IntegrationTests`, `Tests/StressTests` (#3954) 9 сар өмнө
runsettings.coverage.xml dc0d8f2f85 Fixes #4429 - Timeouts lost (#4430) 1 долоо хоног өмнө
runsettings.xml dc0d8f2f85 Fixes #4429 - Timeouts lost (#4430) 1 долоо хоног өмнө
xunit.runner.json aab90e1fbc Fixes #4463 - Adds `LineCanvas.GetRegion()` - 10x performance regression in `RenderLineCanvas` (#4464) 5 өдөр өмнө

README.md

UnitTests.Parallelizable

This project contains unit tests that can run in parallel without interference. Tests here must not depend on global state or static Application infrastructure.

Important Notes

  • Many tests in UnitTests blindly use the the legacy model they don't actually need to
  • These tests CAN be rewritten to remove unnecessary dependencies and migrated here
  • Many tests APPEAR to be integration tests but are just poorly written and cover multiple surface areas - these can be split into focused unit tests
  • When in doubt, analyze if the test truly needs global state or can be refactored

Example Migrations

Simple Property Test (no changes needed)

// Before (in UnitTests)
[Fact]
public void Constructor_Sets_Defaults ()
{
    var view = new Button ();
    Assert.Empty (view.Text);
}

// After (in UnitTests.Parallelizable) - just move it!
[Fact]
public void Constructor_Sets_Defaults ()
{
    var view = new Button ();
    Assert.Empty (view.Text);
}

Remove Unnecessary [SetupFakeApplication]

// Before (in UnitTests)
[Fact]
[SetupFakeApplication]
public void Event_Fires_When_Property_Changes ()
{
    var view = new Button ();
    var fired = false;
    view.TextChanged += (s, e) => fired = true;
    view.Text = "Hello";
    Assert.True (fired);
}

// After (in UnitTests.Parallelizable) - remove attribute!
[Fact]
public void Event_Fires_When_Property_Changes ()
{
    var view = new Button ();
    var fired = false;
    view.TextChanged += (s, e) => fired = true;
    view.Text = "Hello";
    Assert.True (fired);
}

Replace Application.Begin with View Initialization

// Before (in UnitTests)
[Fact]
[AutoInitShutdown]
public void Focus_Test ()
{
    var view = new Button ();
    var top = new Runnable ();
    top.Add (view);
    Application.Begin (top);
    view.SetFocus ();
    Assert.True (view.HasFocus);
    top.Dispose ();
}

// After (in UnitTests.Parallelizable) - use BeginInit/EndInit!
[Fact]
public void Focus_Test ()
{
    var superView = new View ();
    var view = new Button ();
    superView.Add (view);
    superView.BeginInit ();
    superView.EndInit ();
    view.SetFocus ();
    Assert.True (view.HasFocus);
}

Running Tests

Tests in this project run in parallel automatically. To run them:

dotnet test Tests/UnitTestsParallelizable/UnitTests.Parallelizable.csproj

See Also