Exemplo n.º 1
0
            private static IEnumerable <TestCaseData> GetData(string path, string sheetName)
            {
                var testcases = ExcelDataReader.New().FromFileSystem(path).AddSheet(sheetName).GetTestCases(delegate(string sheet, System.Data.DataRow row, int rowNum)
                {
                    var testDataArgs = new Dictionary <string, string>();
                    foreach (System.Data.DataColumn column in row.Table.Columns)
                    {
                        testDataArgs[column.ColumnName] = Convert.ToString(row[column]);
                    }
                    string testName = sheet + " - " + row.ItemArray[0];
                    return(new TestCaseData(testDataArgs).SetName(testName));
                });

                foreach (TestCaseData testCaseData in testcases)
                {
                    yield return(testCaseData);
                }
            }