public void WriteExcelCsv1() { List <ExcelCsv1Type> arr = new List <ExcelCsv1Type>(); ExcelCsv1Type record; record = new ExcelCsv1Type(); record.OrganizationName = "AllwaysOnTop"; record.TestField = "Test 1,"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "COMPUTERS, HARDWARE"; record.TestField = "Test, 2"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "4S Consulting, Inc."; record.TestField = " Test 3"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "SmartSolutions"; record.TestField = "Test 4"; arr.Add(record); var engine = new FileHelperEngine <ExcelCsv1Type>(); string tmp = engine.WriteString(arr.ToArray()); ExcelCsv1Type[] res = engine.ReadString(tmp); Assert.AreEqual(4, res.Length); Assert.AreEqual("AllwaysOnTop", res[0].OrganizationName); Assert.AreEqual("COMPUTERS, HARDWARE", res[1].OrganizationName); Assert.AreEqual("4S Consulting, Inc.", res[2].OrganizationName); Assert.AreEqual("SmartSolutions", res[3].OrganizationName); Assert.AreEqual("Test 1,", res[0].TestField); Assert.AreEqual("Test, 2", res[1].TestField); Assert.AreEqual(" Test 3", res[2].TestField); Assert.AreEqual("Test 4", res[3].TestField); }
public void WriteExcelCsv1() { var arr = new List<ExcelCsv1Type>(); ExcelCsv1Type record; record = new ExcelCsv1Type(); record.OrganizationName = "AllwaysOnTop"; record.TestField = "Test 1,"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "COMPUTERS, HARDWARE"; record.TestField = "Test, 2"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "4S Consulting, Inc."; record.TestField = " Test 3"; arr.Add(record); record = new ExcelCsv1Type(); record.OrganizationName = "SmartSolutions"; record.TestField = "Test 4"; arr.Add(record); var engine = new FileHelperEngine<ExcelCsv1Type>(); string tmp = engine.WriteString(arr.ToArray()); ExcelCsv1Type[] res = engine.ReadString(tmp); Assert.AreEqual(4, res.Length); Assert.AreEqual("AllwaysOnTop", res[0].OrganizationName); Assert.AreEqual("COMPUTERS, HARDWARE", res[1].OrganizationName); Assert.AreEqual("4S Consulting, Inc.", res[2].OrganizationName); Assert.AreEqual("SmartSolutions", res[3].OrganizationName); Assert.AreEqual("Test 1,", res[0].TestField); Assert.AreEqual("Test, 2", res[1].TestField); Assert.AreEqual(" Test 3", res[2].TestField); Assert.AreEqual("Test 4", res[3].TestField); }