Skip to content

Commit c99cd2f

Browse files
better comparison to enum
1 parent 21c8d7c commit c99cd2f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

GoogleTestAdapter/Core/Runners/SequentialTestRunner.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ public void RunTests(IEnumerable<TestCase> testCasesToRun, string baseDir,
6767
var key = Path.GetFullPath(testCase.Source) + ":" + testCase.FullyQualifiedName;
6868

6969
var testType = testCase.Traits.FirstOrDefault(t => t.Name.Equals(nameof(TestCaseDescriptor.TestType)));
70+
7071
// If it is a parameterized test, we should look for the "parent" key which doesn't have the suite or the id defined in the xml file.
7172
// The strategy for this can also be seen in the MethodSignatureCreate.cs file, going the other way.
72-
if (testType != null && testType.Value.Equals(TestCaseDescriptor.TestTypes.Parameterized))
73+
if (testType != null && Enum.TryParse(testType.Value, out TestCaseDescriptor.TestTypes type) && type == TestCaseDescriptor.TestTypes.Parameterized)
7374
{
74-
int firstIndex = key.IndexOf("/");
75-
int lastIndex = key.LastIndexOf("/");
76-
key = string.Concat("*", key.Substring(firstIndex, lastIndex - firstIndex), "/*");
75+
int firstIndex = testCase.FullyQualifiedName.IndexOf("/");
76+
int lastIndex = testCase.FullyQualifiedName.LastIndexOf("/");
77+
key = string.Concat(Path.GetFullPath(testCase.Source), ":", "*", testCase.FullyQualifiedName.Substring(firstIndex, lastIndex - firstIndex), "/*");
7778
}
7879

7980
ITestPropertySettings settings;

0 commit comments

Comments
 (0)