Skip to content

Commit 6787762

Browse files
Add Tests for NUnit3DriverFactory.
1 parent 8474401 commit 6787762

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace NUnit.Engine.Drivers
99
{
1010
public class NUnit3DriverFactory : IDriverFactory
1111
{
12-
private const string NUNIT_FRAMEWORK = "nunit.framework";
12+
public const string NUNIT_FRAMEWORK = "nunit.framework";
1313

1414
/// <summary>
1515
/// Gets a flag indicating whether a given assembly name and version
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using NUnit.Engine.Drivers;
2+
using NUnit.Framework;
3+
using System;
4+
using System.Reflection;
5+
6+
namespace NUnit.Engine.Tests.Drivers
7+
{
8+
public class NUnit3DriverFactoryTests
9+
{
10+
private NUnit3DriverFactory _factory;
11+
12+
[SetUp]
13+
public void SetUp()
14+
{
15+
_factory = new NUnit3DriverFactory();
16+
}
17+
18+
[TestCase(2, ExpectedResult = false)]
19+
[TestCase(3, ExpectedResult = true)]
20+
[TestCase(4, ExpectedResult = true)]
21+
public bool SupportsNetFramework(int majorVersion)
22+
{
23+
AssemblyName name = new AssemblyName(NUnit3DriverFactory.NUNIT_FRAMEWORK)
24+
{
25+
Version = new Version(majorVersion, 0)
26+
};
27+
28+
return _factory.IsSupportedTestFramework(name);
29+
}
30+
31+
[Test]
32+
public void DoesNotSupportOtherFrameworks()
33+
{
34+
AssemblyName name = new AssemblyName("VSTest.dll")
35+
{
36+
Version = new Version(3, 0)
37+
};
38+
39+
Assert.That(_factory.IsSupportedTestFramework(name), Is.False);
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)