public void WritingToFileUpdatesTally() { using (RollingFlatFileTraceListener.TallyKeepingFileStreamWriter writer = new RollingFlatFileTraceListener.TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read))) { writer.Write("12345"); writer.Flush(); Assert.AreEqual(5L, writer.Tally); } }
public void WritingToFileWithEncodingUpdatesTally() { using (RollingFlatFileTraceListener.TallyKeepingFileStreamWriter writer = new RollingFlatFileTraceListener.TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read), Encoding.UTF32)) { writer.Write("12345"); writer.Flush(); Assert.AreEqual(20L, writer.Tally); // BOM is not part of tally - minimal fidelity loss on new files. } }