ParallelizableBase.cs 1.1 KB

1234567891011121314151617181920212223242526272829
  1. using TerminalGuiFluentTesting;
  2. namespace UnitTests.Parallelizable;
  3. /// <summary>
  4. /// Base class for parallelizable tests. Ensures that tests can run in parallel without interference
  5. /// by setting various Terminal.Gui static properties to their default values. E.g. View.EnableDebugIDisposableAsserts.
  6. /// </summary>
  7. [Collection ("Global Test Setup")]
  8. public abstract class ParallelizableBase
  9. {
  10. // Common setup or utilities for all tests can go here
  11. /// <summary>
  12. /// Creates a new FakeDriver instance with the specified buffer size.
  13. /// This is a convenience method for tests that need to use Draw() and DriverAssert
  14. /// without relying on Application.Driver.
  15. /// </summary>
  16. /// <param name="width">Width of the driver buffer</param>
  17. /// <param name="height">Height of the driver buffer</param>
  18. /// <returns>A configured IFakeConsoleDriver instance</returns>
  19. protected static IConsoleDriver CreateFakeDriver (int width = 25, int height = 25)
  20. {
  21. IConsoleDriver driver = new FakeDriver ();
  22. driver.SetScreenSize (width, height);
  23. return driver;
  24. }
  25. }