Files
Terminal.Gui/Tests/TerminalGuiFluentTesting/FakeDriver/FakeApplicationLifecycle.cs
2025-11-20 19:34:48 +00:00

20 lines
594 B
C#

#nullable enable
namespace Terminal.Gui.Drivers;
/// <summary>
/// Implements a fake application lifecycle for testing purposes. Cleans up the application on dispose by cancelling
/// the provided <see cref="CancellationTokenSource"/> and shutting down the application.
/// </summary>
/// <param name="hardStop"></param>
internal class FakeApplicationLifecycle (CancellationTokenSource hardStop) : IDisposable
{
/// <inheritdoc/>
public void Dispose ()
{
hardStop.Cancel ();
Application.TopRunnable?.Dispose ();
Application.Shutdown ();
}
}