Skip to content

Commit bf43151

Browse files
committed
Fix run selected tests in Test Explorer
1 parent 4dba0ee commit bf43151

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/NUnitTestAdapter/NUnit3TestExecutor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public sealed class NUnit3TestExecutor : NUnitTestAdapter, ITestExecutor, IDispo
6363
IExecutionContext
6464
{
6565
#region Properties
66+
private bool IsMTP { get; }
6667

6768
private RunType RunType { get; set; }
6869

@@ -87,6 +88,11 @@ public sealed class NUnit3TestExecutor : NUnitTestAdapter, ITestExecutor, IDispo
8788

8889
#endregion
8990

91+
public NUnit3TestExecutor(bool isMTP = false)
92+
{
93+
IsMTP = isMTP;
94+
}
95+
9096
#region ITestExecutor Implementation
9197

9298
/// <summary>
@@ -125,6 +131,10 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrame
125131
var vsTestFilter = VsTestFilterFactory.CreateVsTestFilter(Settings, runContext);
126132
filter = builder.ConvertVsTestFilterToNUnitFilter(vsTestFilter);
127133
}
134+
else if (RunType == RunType.Ide && IsMTP)
135+
{
136+
filter = builder.ConvertVsTestFilterToNUnitFilter(VsTestFilter);
137+
}
128138

129139
filter ??= builder.FilterByWhere(Settings.Where);
130140

src/NUnitTestAdapter/TestingPlatformAdapter/NUnitBridgedTestFramework.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected override Task SynchronizedDiscoverTestsAsync(VSTestDiscoverTestExecuti
3434
protected override Task SynchronizedRunTestsAsync(VSTestRunTestExecutionRequest request, IMessageBus messageBus,
3535
CancellationToken cancellationToken)
3636
{
37-
ITestExecutor executor = new NUnit3TestExecutor();
37+
ITestExecutor executor = new NUnit3TestExecutor(isMTP: true);
3838
using (cancellationToken.Register(executor.Cancel))
3939
{
4040
if (request.VSTestFilter.TestCases is { } testCases)

0 commit comments

Comments
 (0)