public void AddColumnTest() { var rawData = BuildTestCSVData(); CSVData data = new CSVData(rawData.Item1, rawData.Item2); var newColEntries = Enumerable.Range(0, data.RowsCount).Select(x => "NewF").ToList(); data.AddColumn("F", newColEntries); Assert.IsTrue(newColEntries.SequenceEqual(data.GetColumnRaw("F"))); }
public void AddColumnTest1() { var rawData = BuildTestCSVData(); CSVData data = new CSVData(rawData.Item1, rawData.Item2); int bIdx = rawData.Item1.IndexOf("B"); int cIdx = rawData.Item1.IndexOf("C"); data.AddColumn("F", row => row[bIdx] + row[cIdx]); Assert.AreEqual(String.Join(",", data.GetColumnRaw("F")), "bc,bc,cb,cb,cb,bc,ec"); }