예제 #1
0
        public void ConvertToCSVValid()
        {
            string expectedCSV = File.ReadAllText(Path.Combine(executingAssemblyPath, "Files", "ExpectedCSV-CommaEscaped.txt"));

            string actualCSV = ExtractedDataConverter.ConvertToCSV(XLSXDataExtractorTestHelper.GenTwoDimensionalCollectionOfExtractedData());

            Assert.That(actualCSV, Is.EqualTo(expectedCSV));
        }
예제 #2
0
        public void ConvertToCSVFromDataTable_TabDelimited_NotEscaped()
        {
            string expectedCSV = ExpectedStrings.ExpectedCSV_TabDelimited_NotEscaped;

            var    dataTable = ExtractedDataConverter.GenerateDataTable(XLSXDataExtractorTestHelper.GenTwoDimensionalCollectionOfExtractedData());
            string actualCSV = ExtractedDataConverter.ConvertToDelimitedString(dataTable, "\t", false);

            Assert.That(actualCSV, Is.EqualTo(expectedCSV));
        }
예제 #3
0
        public void GenerateDataTableValidTest()
        {
            var dataTable = ExtractedDataConverter.GenerateDataTable(XLSXDataExtractorTestHelper.GenTwoDimensionalCollectionOfExtractedData());

            Assert.That(dataTable.Columns.Count, Is.EqualTo(10));
            Assert.That(dataTable.Rows.Count, Is.EqualTo(10));

            for (int i = 0; i < 10; i++)
            {
                DataColumn column = dataTable.Columns[i];
                Assert.That(column.ColumnName, Is.EqualTo("Test" + i));
            }
        }
예제 #4
0
        public void ConvertToWorksheetValidTest()
        {
            var worksheet = ExtractedDataConverter.ConvertToWorksheet(XLSXDataExtractorTestHelper.GenTwoDimensionalCollectionOfExtractedData());

            var cellsUsed = worksheet.CellsUsed();

            bool emptyCellsFromDataTable = cellsUsed.Any(x => x.Address.ColumnNumber == 6 && x.Address.RowNumber > 1);

            Assert.That(emptyCellsFromDataTable, Is.False);
            foreach (var cell in cellsUsed)
            {
                //generated table should be 12 cells by 12 cells start from cell 0,0.
                Assert.That(cell.Address.RowNumber, Is.LessThan(12));
                Assert.That(cell.Address.ColumnNumber, Is.LessThan(12));
            }
        }