mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Add test for preamble omission
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using CliFx.Infrastructure;
|
||||||
using CliFx.Tests.Utils;
|
using CliFx.Tests.Utils;
|
||||||
using CliWrap;
|
using CliWrap;
|
||||||
using CliWrap.Buffered;
|
using CliWrap.Buffered;
|
||||||
@@ -135,5 +138,22 @@ public class Command : ICommand
|
|||||||
stdOut.Trim().Should().Be("Hello world");
|
stdOut.Trim().Should().Be("Hello world");
|
||||||
stdErr.Trim().Should().Be("Hello world");
|
stdErr.Trim().Should().Be("Hello world");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Console_does_not_emit_preamble_when_used_with_encoding_that_has_it()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using var buffer = new MemoryStream();
|
||||||
|
using var consoleWriter = new ConsoleWriter(FakeConsole, buffer, Encoding.UTF8);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
consoleWriter.Write("Hello world");
|
||||||
|
consoleWriter.Flush();
|
||||||
|
|
||||||
|
var output = consoleWriter.Encoding.GetString(buffer.ToArray());
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
output.Should().Be("Hello world");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user