Esempio n. 1
0
        public void WithCustomConverters()
        {
            DataSetConverter converter = new DataSetConverter();
            DataSourceConverter <DataRow> table1Converter = new DataSourceConverter <DataRow>();

            table1Converter.Fields.Add(new AdapterBoundField <DataRow>("Name", "Character Name"));
            table1Converter.Fields.Add(new AdapterBoundField <DataRow>("Age", "Age", "{0:###}"));
            converter.TableAdapters.Add(table1Converter);
            converter.TableAdapters.Add(DataSetConverter.CreateDefaultDataTableConverter(_data.Tables[1]));
            XlsDocument doc = new XlsDocument();

            converter.CreateDocument(doc, _data);

            Assert.AreEqual(_data.Tables.Count, doc.Workbook.Worksheets.Count);
            DataSourceConverterTest.ValidateWorksheetFromDataTable(doc.Workbook.Worksheets[0], _data.Tables[0]);
            ValidateSheetFromDataTable(doc.Workbook.Worksheets[1], _data.Tables[1]);
        }
Esempio n. 2
0
 public void Setup()
 {
     _data = new DataSet("Test");
     _data.Tables.Add(DataSourceConverterTest.GetDataTable());
     _data.Tables.Add(GetSecondDataTable());
 }