Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "The ... framework is not available. Available frameworks: mono-4.0" #1403

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
using NSubstitute;
using NUnit.Framework;

namespace NUnit.Engine.Tests
Expand Down Expand Up @@ -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)))
Expand Down
10 changes: 7 additions & 3 deletions src/NUnitEngine/nunit.engine.core/RuntimeFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down