ParallelizableBase.cs 1.2 KB

123456789101112131415161718192021222324252627282930
  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 IFakeConsoleDriver CreateFakeDriver (int width = 25, int height = 25)
  20. {
  21. var factory = new FakeDriverFactory ();
  22. IFakeConsoleDriver driver = factory.Create ();
  23. driver.SetBufferSize (width, height);
  24. return driver;
  25. }
  26. }