Skip to content

Commit 536be7a

Browse files
committed
Remove namespace at a more root level when receiving test cases from VS
1 parent 23de67d commit 536be7a

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

GoogleTestAdapter/Core/Model/TestCase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class TestCase
1212
public string CodeFilePath { get; }
1313
public int LineNumber { get; }
1414

15+
public string Namespace { get; set; }
16+
1517
public List<Trait> Traits { get; } = new List<Trait>();
1618
public List<TestProperty> Properties { get; } = new List<TestProperty>();
1719

GoogleTestAdapter/TestAdapter/TestExecutor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,14 @@ private void DoRunTests(ICollection<TestCase> testCasesToRun, IRunContext runCon
237237
int frequency = fullyQualifiedName.Where(x => (x == '.')).Count();
238238
if (frequency > 1)
239239
{
240+
string ns = fullyQualifiedName.Substring(0, fullyQualifiedName.IndexOf('.'));
241+
tc.Namespace = ns;
242+
_logger.LogInfo("NS removing: " + tc.Namespace);
240243
fullyQualifiedName = fullyQualifiedName.Substring(fullyQualifiedName.IndexOf('.') + 1);
241244
}
242245

243246
tc.FullyQualifiedName = fullyQualifiedName;
247+
_logger.LogInfo("Test Name after removing NS: " + tc.FullyQualifiedName);
244248
}
245249

246250
_executor.RunTests(testCasesToRun, reporter, launcher,

0 commit comments

Comments
 (0)