diff --git a/src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs b/src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs index 3d1b650d5..ce84443fc 100644 --- a/src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs +++ b/src/NUnitEngine/nunit.engine.core.tests/RuntimeFrameworkTests.cs @@ -3,6 +3,7 @@ #if NETFRAMEWORK using System; using System.Collections.Generic; +using NSubstitute; using NUnit.Framework; namespace NUnit.Engine.Tests @@ -163,6 +164,10 @@ public bool CanLoad(RuntimeFramework f1, RuntimeFramework f2) new RuntimeFramework(RuntimeType.Mono, new Version(4,0)), new RuntimeFramework(RuntimeType.Net, new Version(4,0))) .Returns(true), + new TestCaseData( + new RuntimeFramework(RuntimeType.Mono, new Version(4,0)), + new RuntimeFramework(RuntimeType.Net, new Version(4,6,2))) + .Returns(true), new TestCaseData( new RuntimeFramework(RuntimeType.Net, new Version(2,0)), new RuntimeFramework(RuntimeType.Net, new Version(1,1))) diff --git a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs index c04ed5766..8f93d1bb9 100644 --- a/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs +++ b/src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs @@ -457,9 +457,13 @@ public bool Supports(RuntimeFramework target) if (FrameworkVersion == DefaultVersion || target.FrameworkVersion == DefaultVersion) return true; - return VersionsMatch(this.ClrVersion, target.ClrVersion) - && this.FrameworkVersion.Major >= target.FrameworkVersion.Major - && this.FrameworkVersion.Minor >= target.FrameworkVersion.Minor; + if (!VersionsMatch(this.ClrVersion, target.ClrVersion)) + return false; + + return this.Runtime == RuntimeType.Mono + ? this.FrameworkVersion.Major >= target.FrameworkVersion.Major + : this.FrameworkVersion.Major >= target.FrameworkVersion.Major && + this.FrameworkVersion.Minor >= target.FrameworkVersion.Minor; } private bool Supports(RuntimeType targetRuntime)