Skip to content

Commit 4d47546

Browse files
authored
Issue912 (#925)
* Updated comments in NUnitTestFilterBuilder * fixes * updated for 912 and 919 * remove debugflag
1 parent 3be32d6 commit 4d47546

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var configuration = Argument("configuration", "Release");
1313
//////////////////////////////////////////////////////////////////////
1414

1515
var version = "4.2.0";
16-
var modifier = "-alpha.201";
16+
var modifier = "-alpha.919.3";
1717

1818
var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
1919
var packageVersion = version + modifier + dbgSuffix;

src/NUnitTestAdapter/NUnit3TestExecutor.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrame
119119
var vsTestFilter = VsTestFilterFactory.CreateVsTestFilter(Settings, runContext);
120120
filter = builder.ConvertVsTestFilterToNUnitFilter(vsTestFilter);
121121
}
122-
if (filter == null)
123-
{
124-
filter = builder.FilterByWhere(Settings.Where);
125-
}
122+
filter ??= builder.FilterByWhere(Settings.Where);
126123

127124
foreach (string assemblyName in sources)
128125
{

src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public IList<TestCase> Convert(NUnitResults discoveryResults, string assemblyPat
170170
return loadedTestCases;
171171

172172
IEnumerable<NUnitDiscoveryTestCase> RunnableTestCases(bool isExplicit) =>
173-
isExplicit || !Settings.DesignMode
173+
isExplicit
174174
? TestRun.TestAssembly.AllTestCases
175175
: TestRun.TestAssembly.RunnableTestCases;
176176
}

src/NUnitTestAdapter/NUnitTestFilterBuilder.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter, IDisc
6565
return result;
6666
}
6767

68+
/// <summary>
69+
/// Used when running from command line, mode Non-Ide, e.g. 'dotnet test --filter xxxxx'. Reads the TfsTestCaseFilterExpression.
70+
/// </summary>
6871
public TestFilter ConvertVsTestFilterToNUnitFilter(IVsTestFilter vsFilter)
6972
{
7073
if (string.IsNullOrEmpty(vsFilter?.TfsTestCaseFilterExpression?.TestCaseFilterValue))
@@ -87,6 +90,9 @@ public TestFilter ConvertTfsFilterToNUnitFilter(IVsTestFilter vsFilter, IDiscove
8790
return testCases.Any() ? FilterByList(testCases) : NoTestsFound;
8891
}
8992

93+
/// <summary>
94+
/// Used when a Where statement is added as a runsettings parameter, either in a runsettings file or on the command line from dotnet using the '-- NUnit.Where .....' statement.
95+
/// </summary>
9096
public TestFilter FilterByWhere(string where)
9197
{
9298
if (string.IsNullOrEmpty(where))

src/NUnitTestAdapterTests/TestExecutionTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public void LoadMockassembly()
8282
[TestCase("method =~ MockTest?", 5)]
8383
[TestCase("method =~ MockTest? and cat != MockCategory", 3)]
8484
[TestCase("namespace == ThisNamespaceDoesNotExist", 0)]
85-
[TestCase("test==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests, TestName = "{m}_MockTestFixture")]
85+
[TestCase("test==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests - MockTestFixture.Explicit, TestName = "{m}_MockTestFixture")]
8686
[TestCase("test==NUnit.Tests.IgnoredFixture and method == Test2", 1, TestName = "{m}_IgnoredFixture")]
87-
[TestCase("class==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests)]
88-
[TestCase("name==MockTestFixture", MockTestFixture.Tests + NUnit.Tests.TestAssembly.MockTestFixture.Tests)]
89-
[TestCase("cat==FixtureCategory", MockTestFixture.Tests)]
87+
[TestCase("class==NUnit.Tests.Assemblies.MockTestFixture", MockTestFixture.Tests - MockTestFixture.Explicit)]
88+
[TestCase("name==MockTestFixture", MockTestFixture.Tests + NUnit.Tests.TestAssembly.MockTestFixture.Tests - MockTestFixture.Explicit)]
89+
[TestCase("cat==FixtureCategory", MockTestFixture.Tests - MockTestFixture.Explicit)]
9090
public void TestsWhereShouldFilter(string filter, int expectedCount)
9191
{
9292
// Create a fake environment.
@@ -158,7 +158,7 @@ public void CorrectNumberOfTestCasesWereStarted()
158158
Console.WriteLine(ev.TestCase.DisplayName);
159159
Assert.That(
160160
testLog.Events.FindAll(e => e.EventType == eventType).Count,
161-
Is.EqualTo(MockAssembly.ResultCount - BadFixture.Tests - IgnoredFixture.Tests - ExplicitFixture.Tests));
161+
Is.EqualTo(MockAssembly.ResultCount - BadFixture.Tests - IgnoredFixture.Tests - ExplicitFixture.Tests - MockTestFixture.Explicit));
162162
}
163163

164164
[Test]

src/NUnitTestAdapterTests/TestFilterConverterTests/TestFilterParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public void TestParser(string input, string output)
173173
{
174174
Assert.That(_parser.Parse(input), Is.EqualTo($"<filter>{output}</filter>"));
175175

176-
XmlDocument doc = new XmlDocument();
176+
XmlDocument doc = new ();
177177
Assert.DoesNotThrow(() => doc.LoadXml(output));
178178
}
179179

0 commit comments

Comments
 (0)