public void ReadColumnsAddColumnsTest() { const byte separator = BytesSplitReader.Comma; var expecteds = new string[] { "A", "B", "C", "D", "", }; var text = string.Join(((char)separator).ToString(), expecteds); var raw = Encoding.UTF8.GetBytes(text); var actuals = new BytesColumns(); using (var readerStream = new MemoryStream(raw)) using (var reader = new BytesSplitReader(readerStream)) { Assert.IsTrue(reader.ReadColumnsLength(separator, actuals), "!ReadColumns"); Assert.AreEqual(expecteds.Length, actuals.Count, "expecteds.Length != actuals.Count"); var actualsColumns = actuals.ToStringsArray(Encoding.UTF8); for (var i = expecteds.Length - 1; i >= 0; --i) { Assert.AreEqual(expecteds[i], actualsColumns[i], i.ToString()); } } }
public static void WriteLine(Stream writer, BytesColumns columns, byte[] separator, byte[] newline) { columns.WriteLine(writer, separator, newline); }
public static void Clear(BytesColumns value) { value.Clear(); }