Skip to content

Commit

Permalink
Fixing unit tests for runsettings with <SkipNonTestAssemblies>false</…
Browse files Browse the repository at this point in the history
…SkipNonTestAssemblies>
  • Loading branch information
OsirisTerje committed Jun 7, 2020
1 parent 873d893 commit 45b3af4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/NUnitTestAdapterTests/Fakes/FakeRunSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ ISettingsProvider IRunSettings.GetSettings(string settingsName)
throw new NotImplementedException();
}

public virtual string SettingsXml => "<RunSettings/>";
public virtual string SettingsXml => "<RunSettings><NUnit><SkipNonTestAssemblies>false</SkipNonTestAssemblies></NUnit></RunSettings>";
}

class FakeRunSettingsForTestOutput : FakeRunSettings
{
public override string SettingsXml => "<RunSettings><NUnit><TestOutputXml>TestResults</TestOutputXml></NUnit></RunSettings>";
public override string SettingsXml => "<RunSettings><NUnit><TestOutputXml>TestResults</TestOutputXml><SkipNonTestAssemblies>false</SkipNonTestAssemblies></NUnit></RunSettings>";
}

class FakeRunSettingsForTestOutputAndWorkDir : FakeRunSettings
Expand All @@ -51,7 +51,7 @@ public FakeRunSettingsForTestOutputAndWorkDir(string testOutput, string workDir)
_workDir = workDir;
_testOutput = testOutput;
}
public override string SettingsXml => $"<RunSettings><NUnit><WorkDirectory>{_workDir}</WorkDirectory><TestOutputXml>{_testOutput}</TestOutputXml></NUnit></RunSettings>";
public override string SettingsXml => $"<RunSettings><NUnit><WorkDirectory>{_workDir}</WorkDirectory><TestOutputXml>{_testOutput}</TestOutputXml><SkipNonTestAssemblies>false</SkipNonTestAssemblies></NUnit></RunSettings>";
}

class FakeRunSettingsForWhere : FakeRunSettings
Expand All @@ -62,6 +62,6 @@ public FakeRunSettingsForWhere(string where)
{
_where = where;
}
public override string SettingsXml => $"<RunSettings><NUnit><Where>{_where}</Where></NUnit></RunSettings>";
public override string SettingsXml => $"<RunSettings><NUnit><Where>{_where}</Where><SkipNonTestAssemblies>false</SkipNonTestAssemblies></NUnit></RunSettings>";
}
}
4 changes: 2 additions & 2 deletions src/NUnitTestAdapterTests/TestDiscoveryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal static class TestDiscoveryDataProvider
{
public static IEnumerable<IDiscoveryContext> TestDiscoveryData()
{
yield return new FakeDiscoveryContext(null);
// yield return new FakeDiscoveryContext(null);
yield return new FakeDiscoveryContext(new FakeRunSettings());
}
}
Expand Down Expand Up @@ -67,7 +67,7 @@ public void LoadMockassembly()
Assert.That(NUnit.Tests.Assemblies.MockAssembly.TestsAtRuntime, Is.EqualTo(NUnit.Tests.Assemblies.MockAssembly.Tests),
"The reference to mock-assembly.dll appears to be the wrong version");
Assert.That(File.Exists(MockAssemblyPath), $"Can't locate mock-assembly.dll at {MockAssemblyPath}");
var runsettings = "<RunSettings><NUnit><UseParentFQNForParametrizedTests>True</UseParentFQNForParametrizedTests></NUnit></RunSettings>";
var runsettings = "<RunSettings><NUnit><UseParentFQNForParametrizedTests>True</UseParentFQNForParametrizedTests><SkipNonTestAssemblies>false</SkipNonTestAssemblies></NUnit></RunSettings>";
var rs = Substitute.For<IRunSettings>();
rs.SettingsXml.Returns(runsettings);
_context.RunSettings.Returns(rs);
Expand Down
1 change: 0 additions & 1 deletion src/NUnitTestAdapterTests/TestExecutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
using NUnit.Framework;
using NUnit.Tests;
using NUnit.Tests.Assemblies;
using NUnit.Tests.Singletons;
using NUnit.VisualStudio.TestAdapter.Tests.Fakes;

namespace NUnit.VisualStudio.TestAdapter.Tests
Expand Down

0 comments on commit 45b3af4

Please sign in to comment.