public void ConvertRowWithTooManyColumns() { var configuration = DataStoreConfiguration.FromColumns("First Name", "Last Name", "Age"); var store = new CommaSeperatedFileDataStore(configuration); var row = store.NewRow("John", "Doe", "23"); store.Configuration.Columns.Add(new DataStoreColumn { Name = "Birthday" }); TestHelper.ExpectedException<ArgumentException>(() => store.ConvertRow(row), "The row does not match the column count."); }
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 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); }