Accord.Tests.IO.ExcelReaderTest.ExcelReaderConstructorTest C# (CSharp) Method

ExcelReaderConstructorTest() private method

private ExcelReaderConstructorTest ( ) : void
return void
        public void ExcelReaderConstructorTest()
        {
            string path = Path.Combine("Resources", "sample.xls");

            // Create a new reader, opening a given path
            ExcelReader reader = new ExcelReader(path);

            // Afterwards, we can query the file for all
            // worksheets within the specified workbook:
            string[] sheets = reader.GetWorksheetList();

            // Finally, we can request an specific sheet:
            DataTable table = reader.GetWorksheet(sheets[1]);

            // Now, we have loaded the Excel file into a DataTable. We
            // can go further and transform it into a matrix to start
            // running other algorithms on it: 

            Assert.AreEqual(4, sheets.Length);
            Assert.AreEqual("Plan1", sheets[0]);
            Assert.AreEqual("Plan2", sheets[1]);
            Assert.AreEqual("Plan3", sheets[2]);
            Assert.AreEqual("Sheet1", sheets[3]);
            Assert.AreEqual(3, table.Columns.Count);
            Assert.AreEqual(2, table.Rows.Count);
        }