AuScGen.CommonUtilityPlugin.ExcelReader.LoadTestData C# (CSharp) Method

LoadTestData() public method

Loads the test data.
public LoadTestData ( string fileName, string sheetName, string testCaseId, string columnNames ) : Object[]
fileName string Name of the file.
sheetName string Name of the sheet.
testCaseId string The test case identifier.
columnNames string The column names.
return Object[]
        public Object[] LoadTestData(string fileName, string sheetName, string testCaseId, string[] columnNames)
        {
            log4net.Config.XmlConfigurator.Configure();
            log4net.ThreadContext.Properties["myContext"] = "Logging from ExcelReader class";
            Object[] objectArray = null;
            try
            {
                testDataSet = new DataSet();
                InitializeWorkbook(fileName);
                XlsxToTableData(testCaseId, sheetName, columnNames);
                objectArray = DisplayData(testCaseId, testDataSet.Tables[0]);
            }
            catch(NullReferenceException e)
            {
                string errorMessage = string.Concat("You Have Either Specified  wrong Sheet name"
                        , "or the specified sheet name does not have data for the specified columns");
                string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                throw new ResourceException(methodName,errorMessage,e);
            }
            return objectArray;
        }