private static void SetExpandedPaths(RowAttribute[] rows, TestMethodInvokerContext invokerContext) { Debug.Assert(rows != null, "rows != null"); Debug.Assert(invokerContext != null, "invokerContext != null"); Dictionary<string, string> testContextPairs = null; // Process each RowAttribute, or derived attribute foreach (RowAttribute attr in rows) { // Prepare a custom list of test context key/value pairs is the row attribute needs it if (attr.NeedsTestContextPairs) { if (testContextPairs == null) { testContextPairs = new Dictionary<string, string>(); foreach (object key in invokerContext.TestContext.Properties.Keys) { object value = invokerContext.TestContext.Properties[key]; testContextPairs.Add(key.ToString(), value.ToString()); } } // Let the row driver adjust its paths for its own purposes attr.SetExpandedPath(testContextPairs); } } }
private static IEnumerable<DataRowValues> GetAllDataRowValues(RowAttribute[] rows, TestMethodInvokerContext invokerContext, HelperTestGridResults results) { Debug.Assert(rows != null, "rows != null"); Debug.Assert(invokerContext != null, "invokerContext != null"); Debug.Assert(results != null, "results != null"); if (rows.Length > 0) { Assembly testMethodAssembly = invokerContext.TestMethodInfo.DeclaringType.Assembly; // Process each RowAttribute, or derived attribute foreach (RowAttribute attr in rows) { // enumerate row data and invoke the test case with each yield they give us foreach (DataRowValues dataRowValues in attr.GetRowEnumerator(testMethodAssembly, results)) { if (attr.Ignore) { dataRowValues.Ignore = true; } yield return dataRowValues; } } } else { yield return new DataRowValues(); } }