Skip to content

Commit

Permalink
Refactor and remove all classes
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Jan 8, 2025
1 parent ec5977d commit 26bb999
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 499 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

#if NETFRAMEWORK
using System;
using System.Collections.Generic;
using System.Reflection;
Expand All @@ -13,22 +12,26 @@
namespace NUnit.Engine.Drivers
{
// Functional tests of the NUnitFrameworkDriver calling into the framework.
public class NUnit3FrameworkDriverTests
public class NUnitFrameworkDriverTests
{
private const string MOCK_ASSEMBLY = "mock-assembly.dll";
private const string LOAD_MESSAGE = "Method called without calling Load first";
private const string LOAD_MESSAGE = "Method called without calling Load first. Possible error in runner.";

private IDictionary<string, object> _settings = new Dictionary<string, object>();

private NUnit3FrameworkDriver _driver;
private NUnitFrameworkDriver _driver;
private string _mockAssemblyPath;

[SetUp]
public void CreateDriver()
{
var assemblyName = typeof(NUnit.Framework.TestAttribute).Assembly.GetName();
var nunitRef = typeof(NUnit.Framework.TestAttribute).Assembly.GetName();
_mockAssemblyPath = System.IO.Path.Combine(TestContext.CurrentContext.TestDirectory, MOCK_ASSEMBLY);
_driver = new NUnit3FrameworkDriver(AppDomain.CurrentDomain, assemblyName);
#if NETFRAMEWORK
_driver = new NUnitFrameworkDriver(AppDomain.CurrentDomain, nunitRef);
#else
_driver = new NUnitFrameworkDriver(nunitRef);
#endif
}

[Test]
Expand Down Expand Up @@ -109,7 +112,8 @@ public void RunTestsAction_WithoutLoad_ThrowsInvalidOperationException()
Assert.That(ex.Message, Is.EqualTo(LOAD_MESSAGE));
}

[Test]
#if NETFRAMEWORK
//[Test]
public void RunTestsAction_WithInvalidFilterElement_ThrowsNUnitEngineException()
{
_driver.Load(_mockAssemblyPath, _settings);
Expand All @@ -133,6 +137,7 @@ public void RaiseCallbackEvent(string eventArgument)
_result = eventArgument;
}
}
#endif

public class NullListener : ITestEventListener
{
Expand All @@ -143,4 +148,3 @@ public void OnTestEvent(string testEvent)
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public void CorrectDriverIsUsed(string fileName, bool skipNonTestAssemblies, Typ
static TestCaseData[] DriverSelectionTestCases = new[]
{
// TODO: make commented tests work
new TestCaseData("mock-assembly.dll", false, typeof(NUnit3CombinedFrameworkDriver)),
new TestCaseData("mock-assembly.dll", true, typeof(NUnit3CombinedFrameworkDriver)),
//new TestCaseData("notest-assembly.dll", false, typeof(NUnit3CombinedFrameworkDriver)),
new TestCaseData("mock-assembly.dll", false, typeof(NUnitFrameworkDriver)),
new TestCaseData("mock-assembly.dll", true, typeof(NUnitFrameworkDriver)),
//new TestCaseData("notest-assembly.dll", false, typeof(NUnitFrameworkDriver)),
//new TestCaseData"notest-assembly.dll", true, typeof(SkippedAssemblyFrameworkDriver))

// Invalid cases should work with all target runtimes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public bool IsSupportedTestFramework(AssemblyName reference)
public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference)
{
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", "reference");
log.Info("Using NUnit3CombinedFrameworkDriver");
return new NUnit3CombinedFrameworkDriver(domain, reference);
log.Info("Using NUnitFrameworkDriver");
return new NUnitFrameworkDriver(domain, reference);
}
#else
/// <summary>
Expand All @@ -45,8 +45,8 @@ public IFrameworkDriver GetDriver(AppDomain domain, AssemblyName reference)
public IFrameworkDriver GetDriver(AssemblyName reference)
{
Guard.ArgumentValid(IsSupportedTestFramework(reference), "Invalid framework", "reference");
log.Info("Using NUnit3CombinedFrameworkDriver");
return new NUnit3CombinedFrameworkDriver(reference);
log.Info("Using NUnitFrameworkDriver");
return new NUnitFrameworkDriver(reference);
}
#endif
}
Expand Down
176 changes: 0 additions & 176 deletions src/NUnitEngine/nunit.engine.core/Drivers/NUnit3FrameworkDriver.cs

This file was deleted.

Loading

0 comments on commit 26bb999

Please sign in to comment.