#nullable enable using System.Text; /// /// Minimal mock implementation for parallelizable unit tests. /// This is a lightweight stub that provides just enough driver functionality for tests that need /// to set driver properties but don't need full Application initialization or I/O simulation. /// /// /// /// Purpose: This mock is specifically designed for tests in the /// UnitTestsParallelizable project that need to test view behavior in isolation without /// the overhead of full driver initialization. It's intentionally minimal and thread-safe. /// /// /// Not a replacement for FakeDriver: For tests that need full Application /// initialization, event firing, input simulation, or output verification, use /// in the UnitTests project with . /// /// /// Thread Safety: Each test creates its own instance, making it safe for /// parallel test execution. /// /// internal class MockConsoleDriver : IConsoleDriver { public event EventHandler? AttributeSet; private IClipboard? _clipboard; private Rectangle _screen; private Region? _clip; private int _col; private int _cols; private Cell [,]? _contents; private int _left; private int _row; private int _rows; private int _top; private bool _supportsTrueColor; private bool _force16Colors; private Attribute _currentAttribute; /// public IClipboard? Clipboard => _clipboard; /// public Rectangle Screen => _screen; /// public Region? Clip { get => _clip; set => _clip = value; } /// public int Col => _col; /// public int Cols { get => _cols; set => _cols = value; } /// public Cell [,]? Contents { get => _contents; set => _contents = value; } /// public int Left { get => _left; set => _left = value; } /// public int Row => _row; /// public int Rows { get => _rows; set => _rows = value; } /// public int Top { get => _top; set => _top = value; } /// public bool SupportsTrueColor => _supportsTrueColor; /// public bool Force16Colors { get => _force16Colors; set => _force16Colors = value; } /// public Attribute CurrentAttribute { get => _currentAttribute; set => _currentAttribute = value; } /// public string GetVersionInfo () { return string.Empty; } /// public void WriteRaw (string ansi) { } /// public bool IsRuneSupported (Rune rune) { return true; } /// public bool IsValidLocation (Rune rune, int col, int row) { return true; } /// public void Move (int col, int row) { _col = col; _row = row; } /// public void AddRune (Rune rune) { } /// public void AddRune (char c) { } /// public void AddStr (string str) { } /// public void ClearContents () { } /// public event EventHandler? ClearedContents; /// public void FillRect (Rectangle rect, Rune rune = default) { } /// public void FillRect (Rectangle rect, char c) { } /// public bool GetCursorVisibility (out CursorVisibility visibility) { visibility = CursorVisibility.Invisible; return false; } /// public void Refresh () { } /// public bool SetCursorVisibility (CursorVisibility visibility) { throw new NotImplementedException (); } /// public event EventHandler? SizeChanged; /// public void Suspend () { } /// public void UpdateCursor () {} /// public void Init () { } /// public void End () { } /// /// public Attribute SetAttribute (Attribute c) { Attribute oldAttribute = _currentAttribute; _currentAttribute = c; AttributeSet?.Invoke (this, c); return oldAttribute; } /// public Attribute GetAttribute () { return _currentAttribute; } /// public Attribute MakeColor (in Color foreground, in Color background) { throw new NotImplementedException (); } /// public event EventHandler? MouseEvent; /// public event EventHandler? KeyDown; /// public event EventHandler? KeyUp; /// public void SendKeys (char keyChar, ConsoleKey key, bool shift, bool alt, bool ctrl) { throw new NotImplementedException (); } /// public void QueueAnsiRequest (AnsiEscapeSequenceRequest request) { throw new NotImplementedException (); } /// public AnsiRequestScheduler GetRequestScheduler () { throw new NotImplementedException (); } }