public async Task Fake_console_can_be_used_with_an_in_memory_backing_store() { // Arrange var commandType = DynamicCommandBuilder.Compile( // language=cs @" [Command] public class Command : ICommand { public ValueTask ExecuteAsync(IConsole console) { var input = console.Input.ReadToEnd(); console.Output.WriteLine(input); console.Error.WriteLine(input); return default; } } "); var application = new CliApplicationBuilder() .AddCommand(commandType) .UseConsole(FakeConsole) .Build(); // Act FakeConsole.WriteInput("Hello world"); var exitCode = await application.RunAsync( Array.Empty <string>(), new Dictionary <string, string>() ); var stdOut = FakeConsole.ReadOutputString(); var stdErr = FakeConsole.ReadErrorString(); // Assert exitCode.Should().Be(0); stdOut.Trim().Should().Be("Hello world"); stdErr.Trim().Should().Be("Hello world"); }