Skip to content

Commit 8045464

Browse files
authored
Merge pull request #1135 from nunit/nunit4-support
Nunit4 support
2 parents 46198ba + 94a05df commit 8045464

3 files changed

Lines changed: 47 additions & 3 deletions

File tree

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
next-version: 3.14.0
1+
next-version: 4.0.0
22
mode: ContinuousDelivery
33
legacy-semver-padding: 5
44
build-metadata-padding: 5
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
2+
3+
using NUnit.Engine.Drivers;
4+
using NUnit.Framework;
5+
using System;
6+
using System.Reflection;
7+
8+
namespace NUnit.Engine.Tests.Drivers
9+
{
10+
public class NUnit3DriverFactoryTests
11+
{
12+
private NUnit3DriverFactory _factory;
13+
14+
[SetUp]
15+
public void SetUp()
16+
{
17+
_factory = new NUnit3DriverFactory();
18+
}
19+
20+
[TestCase(2, ExpectedResult = false)]
21+
[TestCase(3, ExpectedResult = true)]
22+
[TestCase(4, ExpectedResult = true)]
23+
public bool SupportsNetFramework(int majorVersion)
24+
{
25+
AssemblyName name = new AssemblyName(NUnit3DriverFactory.NUNIT_FRAMEWORK)
26+
{
27+
Version = new Version(majorVersion, 0)
28+
};
29+
30+
return _factory.IsSupportedTestFramework(name);
31+
}
32+
33+
[Test]
34+
public void DoesNotSupportOtherFrameworks()
35+
{
36+
AssemblyName name = new AssemblyName("VSTest.dll")
37+
{
38+
Version = new Version(3, 0)
39+
};
40+
41+
Assert.That(_factory.IsSupportedTestFramework(name), Is.False);
42+
}
43+
}
44+
}

src/NUnitEngine/nunit.engine.core/Drivers/NUnit3DriverFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace NUnit.Engine.Drivers
1010
{
1111
public class NUnit3DriverFactory : IDriverFactory
1212
{
13-
private const string NUNIT_FRAMEWORK = "nunit.framework";
13+
internal const string NUNIT_FRAMEWORK = "nunit.framework";
1414
static ILogger log = InternalTrace.GetLogger(typeof(NUnit3DriverFactory));
1515

1616
/// <summary>
@@ -20,7 +20,7 @@ public class NUnit3DriverFactory : IDriverFactory
2020
/// <param name="reference">An AssemblyName referring to the possible test framework.</param>
2121
public bool IsSupportedTestFramework(AssemblyName reference)
2222
{
23-
return NUNIT_FRAMEWORK.Equals(reference.Name, StringComparison.OrdinalIgnoreCase) && reference.Version.Major == 3;
23+
return NUNIT_FRAMEWORK.Equals(reference.Name, StringComparison.OrdinalIgnoreCase) && reference.Version.Major >= 3;
2424
}
2525

2626
#if NETFRAMEWORK

0 commit comments

Comments
 (0)