public void ParseRowWithQuotedText() { var configuration = DataStoreConfiguration.FromColumns("Name", "Age"); var store = new CommaSeperatedFileDataStore(configuration); var expected = store.NewRow("John, Doe (\"Bobby\")", "23"); var actual = store.ParseRow("\"John, Doe (\"\"Bobby\"\")\",23"); TestHelper.AreEqual(expected, actual); }
public void ParseRowWithPlainText() { var configuration = DataStoreConfiguration.FromColumns("First Name", "Last Name", "Age"); var store = new CommaSeperatedFileDataStore(configuration); var expected = store.NewRow("John", "Doe", "23"); var actual = store.ParseRow("John,Doe,23"); TestHelper.AreEqual(expected, actual); }
public void ConvertRowWithCommaText() { var configuration = DataStoreConfiguration.FromColumns("Name", "Age"); var store = new CommaSeperatedFileDataStore(configuration); var row = store.NewRow("John, Doe", "23"); var expected = "\"John, Doe\",23"; var actual = store.ConvertRow(row); TestHelper.AreEqual(expected, actual); }
public void ConvertRowWithNotEnoughColumns() { var configuration = DataStoreConfiguration.FromColumns("First Name", "Last Name", "Age"); var store = new CommaSeperatedFileDataStore(configuration); var row = store.NewRow("John", "Doe", "23"); store.Configuration.Columns.RemoveAt(2); TestHelper.ExpectedException <ArgumentException>(() => store.ConvertRow(row), "The row does not match the column count."); }