protected static void WriteFailed <T, TException>(IWriteBuffer <T> buffer, T item) where TException : Exception { Action act = () => buffer.TryWrite(item); act.Should().Throw <TException>(); }
private static void RunLoop(IWriteBuffer <char> writeBuffer, ILogger logger) { logger.LogInformation("Press 'esc' to exit"); logger.LogInformation("Press any key to stream it to the output file:"); while (true) { ConsoleKeyInfo keyPress = Console.ReadKey(); if (keyPress.Key == ConsoleKey.Escape) { return; } writeBuffer.TryWrite(keyPress.KeyChar); } }
protected static void Write <T>(IWriteBuffer <T> buffer, T item) { bool result = buffer.TryWrite(item); result.Should().BeTrue(); }