public void ReadAndResetUTF8() { //**************************************** string MyResult1, MyResult2; //**************************************** using (var Reader = new BinaryTextReader(_TestInput, Encoding.ASCII, true)) { MyResult1 = Reader.ReadToEnd(); Reader.Reset(); MyResult2 = Reader.ReadToEnd(); } Assert.AreEqual(_TestOutput, MyResult1); Assert.AreEqual(_TestOutput, MyResult2); }
public void ReadToEnd() { string MyResult; using (var Reader = new BinaryTextReader(_TestInput, Encoding.UTF8, false)) { MyResult = Reader.ReadToEnd(); } Assert.AreEqual(_TestOutput, MyResult); }
public void ReadDetectEncodingUTF8() { string MyResult; using (var Reader = new BinaryTextReader(_TestInput, Encoding.ASCII, true)) { MyResult = Reader.ReadToEnd(); } Assert.AreEqual(_TestOutput, MyResult); }
public void ReadASCII() { string MyResult; string TempOutput; using (var RawStream = new MemoryStream(_TestInput)) using (var Reader = new StreamReader(RawStream, Encoding.ASCII, false)) { TempOutput = Reader.ReadToEnd(); } using (var Reader = new BinaryTextReader(_TestInput, Encoding.ASCII, false)) { MyResult = Reader.ReadToEnd(); } Assert.AreEqual(TempOutput, MyResult); }
public void ReadDetectEncodingUTF8NoBOM() { string MyResult; byte[] TempInput; using (var RawStream = new MemoryStream()) { using (var Writer = new StreamWriter(RawStream, new UTF8Encoding(false))) { Writer.Write(_TestOutput); } TempInput = RawStream.ToArray(); } using (var Reader = new BinaryTextReader(TempInput, Encoding.UTF8, true)) { MyResult = Reader.ReadToEnd(); } Assert.AreEqual(_TestOutput, MyResult); }
public void ReadDetectEncodingUnicode([Values(false, true)] bool bigEndian) { string MyResult; byte[] TempInput; using (var RawStream = new MemoryStream()) { using (var Writer = new StreamWriter(RawStream, new UnicodeEncoding(bigEndian, true))) { Writer.Write(_TestOutput); } TempInput = RawStream.ToArray(); } using (var Reader = new BinaryTextReader(TempInput, Encoding.ASCII, true)) { MyResult = Reader.ReadToEnd(); } Assert.AreEqual(_TestOutput, MyResult); }