public static async Task WriteTextAsync() { var writer = new ArrayBufferWriter <char>(); using var actual = writer.AsTextWriter(); using TextWriter expected = new StringWriter(InvariantCulture); await actual.WriteAsync("Hello, world!"); await expected.WriteAsync("Hello, world!"); await actual.WriteAsync("123".AsMemory()); await expected.WriteAsync("123".AsMemory()); await actual.WriteAsync('a'); await expected.WriteAsync('a'); await actual.WriteLineAsync(); await expected.WriteLineAsync(); await actual.FlushAsync(); Equal(expected.ToString(), writer.BuildString()); Equal(expected.ToString(), actual.ToString()); }