TestStandardIO.cs 667 B

123456789101112131415161718192021222324252627
  1. using Lua.IO;
  2. namespace Lua.Tests.Helpers;
  3. public class TestStandardIO : ILuaStandardIO
  4. {
  5. readonly ConsoleStandardIO consoleStandardIO = new();
  6. public ILuaStream Input
  7. {
  8. get
  9. {
  10. return consoleStandardIO.Input;
  11. }
  12. }
  13. // This is a test implementation of Output that writes to the console. Because NUnit does not support Console output streams.
  14. public ILuaStream Output { get; set; } = new StandardIOStream(new BufferedOutputStream((memory) => { Console.WriteLine(memory.ToString()); }));
  15. public ILuaStream Error
  16. {
  17. get
  18. {
  19. return consoleStandardIO.Error;
  20. }
  21. }
  22. }