FakeOutput.cs 979 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Drawing;
  2. namespace TerminalGuiFluentTesting;
  3. internal class FakeOutput : IConsoleOutput
  4. {
  5. public IOutputBuffer? LastBuffer { get; set; }
  6. public Size Size { get; set; }
  7. /// <inheritdoc/>
  8. public void Dispose () { }
  9. /// <inheritdoc/>
  10. public void Write (ReadOnlySpan<char> text) { }
  11. /// <inheritdoc/>
  12. public void Write (IOutputBuffer buffer) { LastBuffer = buffer; }
  13. /// <inheritdoc/>
  14. public Size GetSize () { return Size; }
  15. /// <inheritdoc/>
  16. public void SetCursorVisibility (CursorVisibility visibility) { }
  17. /// <inheritdoc/>
  18. public void SetCursorPosition (int col, int row) { CursorPosition = new Point (col, row); }
  19. /// <inheritdoc />
  20. public void SetSize (int width, int height)
  21. {
  22. Size = new (width, height);
  23. }
  24. /// <summary>
  25. /// The last value set by calling <see cref="SetCursorPosition"/>
  26. /// </summary>
  27. public Point CursorPosition { get; private set; }
  28. }