static TestCase GetTestCase(DiaSessionWrapper diaSession, string source, XmlNode methodNode) { string typeName = methodNode.Attributes["type"].Value; string methodName = methodNode.Attributes["method"].Value; string displayName = methodNode.Attributes["name"].Value; string fullyQualifiedName = String.Format("{0}.{1}", typeName, methodName); TestCase testCase = new TestCase(fullyQualifiedName, uri, source) { DisplayName = GetDisplayName(displayName, methodName, fullyQualifiedName), }; if (addTraitThunk != null) foreach (XmlNode traitNode in methodNode.SelectNodes("traits/trait")) { string value = traitNode.Attributes["name"].Value; string value2 = traitNode.Attributes["value"].Value; addTraitThunk(testCase, value, value2); } DiaNavigationData navigationData = diaSession.GetNavigationData(typeName, methodName); if (navigationData != null) { testCase.CodeFilePath = navigationData.FileName; testCase.LineNumber = navigationData.MinLineNumber; } return testCase; }
static IEnumerable<TestCase> GetTestCases(ExecutorWrapper executor) { string source = executor.AssemblyFilename; using (DiaSessionWrapper diaSession = new DiaSessionWrapper(source)) foreach (XmlNode methodNode in executor.EnumerateTests().SelectNodes("//method")) yield return GetTestCase(diaSession, source, methodNode); }
static TestCase GetTestCase(DiaSessionWrapper diaSession, string source, XmlNode methodNode) { string typeName = methodNode.Attributes["type"].Value; string methodName = methodNode.Attributes["method"].Value; string displayName = methodNode.Attributes["name"].Value; string fullyQualifiedName = String.Format("{0}.{1}", typeName, methodName); TestCase testCase = new TestCase(fullyQualifiedName, uri, source) { DisplayName = GetDisplayName(displayName, methodName, fullyQualifiedName), }; DiaNavigationData navigationData = diaSession.GetNavigationData(typeName, methodName); if (navigationData != null) { testCase.CodeFilePath = navigationData.FileName; testCase.LineNumber = navigationData.MinLineNumber; } return testCase; }