Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed May 11, 2024
1 parent 3a6227b commit 7f5b678
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class FrameworkAssertReporter : FirstWorkingReporter
public FrameworkAssertReporter()
: base(
MsTestReporter.INSTANCE,
NUnit3Reporter.INSTANCE,
NUnit4Reporter.INSTANCE,
NUnit3Reporter.INSTANCE,
XUnit2Reporter.INSTANCE)
{
}
Expand Down
16 changes: 16 additions & 0 deletions src/ApprovalTests/Reporters/TestFrameworks/NUnit4Reporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ namespace ApprovalTests.Reporters.TestFrameworks;
public class NUnit4Reporter : AssertReporter
{
public readonly static NUnit4Reporter INSTANCE = new();
static readonly Lazy<bool> isNUnit4 = new(IsisNUnit4);

static bool IsisNUnit4()
{
return AppDomain
.CurrentDomain
.GetAssemblies()
.Any(_ =>
{
var name = _.FullName;
return name.Contains("nunit.framework.legacy");
});
}

public override bool IsWorkingInThisEnvironment(string forFile) =>
base.IsWorkingInThisEnvironment(forFile) && isNUnit4.Value;

public NUnit4Reporter()
: base("NUnit.Framework.Legacy.ClassicAssert, nunit.framework.legacy", "AreEqual", NUnitStackTraceParser.Attribute)
Expand Down

0 comments on commit 7f5b678

Please sign in to comment.