Example #1
0
        private IEnumerable <T> ReadDataFromSource <T>(TestCaseWrapper <T> testCaseWrapper)
            where T : new()
        {
            using (var connection = new SqlConnection(ConnectionString))
            {
                connection.Open();

                var command = new SqlCommand($"SELECT * FROM {TableName}", connection);

                using (var sqlDataAdapter = new SqlDataAdapter(command))
                {
                    var dataTable = sqlDataAdapter.GetAsDataTable();

                    foreach (DataRow row in dataTable.Rows)
                    {
                        yield return(GetTestDataObject(testCaseWrapper,
                                                       new TestSourceWrapper <DataTable, DataRow>(dataTable, row)));
                    }
                }

                connection.Close();
            }
        }