Exemplo n.º 1
0
        public void WriteExcelCsv1()
        {
            ArrayList     arr = new ArrayList();
            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);

            engine = new FileHelperEngine(typeof(ExcelCsv1Type));

            string tmp = engine.WriteString(arr.ToArray());

            ExcelCsv1Type[] res = (ExcelCsv1Type[])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);
        }
Exemplo n.º 2
0
		public void WriteExcelCsv1()
		{
			ArrayList arr = new ArrayList();
			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);

			engine = new FileHelperEngine(typeof (ExcelCsv1Type));

			string tmp = engine.WriteString(arr.ToArray());
			ExcelCsv1Type[] res = (ExcelCsv1Type[]) 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);
			
		}