FakeMainLoop.cs 786 B

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Terminal.Gui;
  2. internal class FakeMainLoop : IMainLoopDriver
  3. {
  4. public Action<ConsoleKeyInfo> MockKeyPressed;
  5. public FakeMainLoop (ConsoleDriver consoleDriver = null)
  6. {
  7. // No implementation needed for FakeMainLoop
  8. }
  9. public void Setup (MainLoop mainLoop)
  10. {
  11. // No implementation needed for FakeMainLoop
  12. }
  13. public void Wakeup ()
  14. {
  15. // No implementation needed for FakeMainLoop
  16. }
  17. public bool EventsPending ()
  18. {
  19. // Always return true for FakeMainLoop
  20. return true;
  21. }
  22. public void Iteration ()
  23. {
  24. if (FakeConsole.MockKeyPresses.Count > 0)
  25. {
  26. MockKeyPressed?.Invoke (FakeConsole.MockKeyPresses.Pop ());
  27. }
  28. }
  29. public void TearDown () { }
  30. }