Skip to content

Commit

Permalink
Merge pull request #1293 from nunit/port-1130
Browse files Browse the repository at this point in the history
Allow Mono 4+ to run all .NET 4 versions
  • Loading branch information
CharliePoole authored Jan 7, 2023
2 parents 173ba23 + 6e8b9e8 commit 3b357db
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/NUnitConsole/nunit4-console.tests/CommandLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ public void CanRecognizeBooleanOptions(string propertyName, string pattern)
[TestCase("DefaultTestNamePattern", "test-name-format", new string[] { "{m}{a}" }, new string[0])]
[TestCase("ConsoleEncoding", "encoding", new string[] { "utf-8", "ascii", "unicode" }, new string[0])]
#if NETFRAMEWORK
[TestCase("RuntimeFramework", "framework", new string[] { "net-4.6.2" }, new string[0])]
// We can't predict which runtimes are available on the test machine, so we don't
// test for any good or bad values. TODO: Create a fake list of availble runtimes.
[TestCase("RuntimeFramework", "framework", new string[0], new string[0])]
[TestCase("ConfigurationFile", "configfile", new string[] { "mytest.config" }, new string[0] )]
[TestCase("PrincipalPolicy", "set-principal-policy", new string[] { "UnauthenticatedPrincipal", "NoPrincipal", "WindowsPrincipal" }, new string[] { "JUNK" })]
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/NUnitEngine/nunit.engine.tests/RuntimeFrameworkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using NUnit.Framework;
using NUnit.Framework.Internal;

namespace NUnit.Engine
{
Expand Down Expand Up @@ -79,6 +80,10 @@ public bool CanLoad(RuntimeFramework f1, RuntimeFramework f2)
new RuntimeFramework(Runtime.Mono, new Version(4,0)),
new RuntimeFramework(Runtime.Net, new Version(4,0)))
.Returns(true),
new TestCaseData(
new RuntimeFramework(Runtime.Mono, new Version(4,0)),
new RuntimeFramework(Runtime.Net, new Version(4,6,2)))
.Returns(true),
new TestCaseData(
new RuntimeFramework(Runtime.Net, new Version(2,0)),
new RuntimeFramework(Runtime.Net, new Version(1,1)))
Expand Down
5 changes: 5 additions & 0 deletions src/NUnitEngine/nunit.engine/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ private class MonoRuntime : NetFrameworkRuntime
public override string DisplayName => "Mono";

public override string ToString() => "Mono";

public override bool Supports(Version runtime, Version target)
{
return base.Supports(runtime, target) || runtime.Major >= 4 && target.Major == 4;
}
}

private class NetCoreRuntime : Runtime
Expand Down

0 comments on commit 3b357db

Please sign in to comment.