public void WriteUtf8Text_Write_String_To_Path() { IFileSystem target = new DotNetFxFileSystem(); var expceted = "κόσμε"; target.WriteUtf8Text("new2.txt", expceted); Assert.True(File.Exists("new2.txt")); var actual = target.ReadUtf8Text("new2.txt"); Assert.Equal(expceted, actual); File.Delete("new2.txt"); }
public void WriteUtf8Text_Write_String_To_Stream() { IFileSystem target = new DotNetFxFileSystem(); var expceted = "κόσμε"; byte[] actual; using (var stream = new MemoryStream()) { target.WriteUtf8Text(stream, expceted); actual = stream.ToArray(); } var excpetedBytes = Encoding.UTF8.GetBytes(expceted); var actualBytesWithoutPreamble = actual.Skip(3).ToArray(); Assert.Equal(excpetedBytes, actualBytesWithoutPreamble); }