Skip to content

Commit

Permalink
Changes to allow for using NUnit.Engine 4 pre-release to support Net7…
Browse files Browse the repository at this point in the history
  • Loading branch information
OsirisTerje committed Jun 26, 2022
1 parent 6a6e422 commit 7bb16ba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.cake
Expand Up @@ -12,7 +12,7 @@ var configuration = Argument("configuration", "Release");
// SET PACKAGE VERSION
//////////////////////////////////////////////////////////////////////

var version = "4.3.0";
var version = "4.3.0-alpha-net7";
var modifier = "";

var dbgSuffix = configuration.ToLower() == "debug" ? "-dbg" : "";
Expand Down
9 changes: 8 additions & 1 deletion src/NUnitTestAdapter/NUnit.TestAdapter.csproj
Expand Up @@ -12,6 +12,14 @@
<SourceLinkCreate>true</SourceLinkCreate>
</PropertyGroup>

<PropertyGroup>
<RestoreAdditionalProjectSource>https://www.myget.org/F/nunit/api/v3/index.json</RestoreAdditionalProjectSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit.engine" Version="4.0.0-dev00100" />
</ItemGroup>

<PropertyGroup>
<PackageId>NUnit3TestAdapter</PackageId>
<Authors>Charlie Poole, Terje Sandstrom</Authors>
Expand All @@ -24,7 +32,6 @@

<ItemGroup>
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="All" />
<PackageReference Include="nunit.engine" Version="3.15.0" />
<PackageReference Include="TestCentric.Metadata" Version="1.7.1" Aliases="TestCentric" />
</ItemGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/NUnitTestAdapter/NUnitEngine/DiscoveryConverter.cs
Expand Up @@ -412,9 +412,9 @@ private NUnitDiscoveryTestAssembly ExtractTestAssembly(XElement node, NUnitDisco
private static BaseProperties ExtractSuiteBasePropertiesClass(XElement node)
{
string dId = node.Attribute(NUnitXmlAttributeNames.Id).Value;
string dName = node.Attribute(NUnitXmlAttributeNames.Name).Value;
string dFullname = node.Attribute(NUnitXmlAttributeNames.Fullname).Value;
var dRunstate = ExtractRunState(node);
// test-run no longer has a name/fullname property
string dName = node.Attribute(NUnitXmlAttributeNames.Name)?.Value ?? "Unnamed";
string dFullname = node.Attribute(NUnitXmlAttributeNames.Fullname)?.Value ?? "Unnamed"; var dRunstate = ExtractRunState(node);
const char apo = '\'';
var tcs = node.Attribute(NUnitXmlAttributeNames.Testcasecount)?.Value.Trim(apo);
int dTestcasecount = int.Parse(tcs ?? "1", CultureInfo.InvariantCulture);
Expand Down
@@ -1,6 +1,8 @@
using System.Linq;
using System.Xml;

using NSubstitute;

using NUnit.Framework;
using NUnit.VisualStudio.TestAdapter.NUnitEngine;
// ReSharper disable StringLiteralTypo
Expand All @@ -13,8 +15,8 @@ public class NUnitDiscoveryTests
private IAdapterSettings settings;

private const string FullDiscoveryXml =
@"<test-run id='2' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' testcasecount='108'>
<test-suite type='Assembly' id='0-1157' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' runstate='Runnable' testcasecount='108'>
@"<test-run id='2' testcasecount='108'>
<test-suite type='Assembly' id='0-1157' name='CSharpTestDemo.dll' fullname='D:\repos\NUnit\nunit3-vs-adapter-demo\solutions\vs2017\CSharpTestDemo\bin\Debug\CSharpTestDemo.dll' runstate='Runnable' testcasecount='108'>
<properties>
<property name='_PID' value='9856' />
<property name='_APPDOMAIN' value='domain-807ad471-CSharpTestDemo.dll' />
Expand Down
4 changes: 0 additions & 4 deletions src/NUnitTestAdapterTests/TestAdapterUtils.cs
Expand Up @@ -51,13 +51,9 @@ private static void InitializeForTesting(NUnitTestAdapter adapter)
adapter.NUnitEngineAdapter.InternalEngineCreated += engine =>
{
var concreteEngineType = (NUnit.Engine.TestEngine)engine;
concreteEngineType.Services.Add(new SettingsService(true));
concreteEngineType.Services.Add(new ExtensionService());
concreteEngineType.Services.Add(new DriverService());
concreteEngineType.Services.Add(new RecentFilesService());
concreteEngineType.Services.Add(new ProjectService());
concreteEngineType.Services.Add(new RuntimeFrameworkService());
concreteEngineType.Services.Add(new DefaultTestRunnerFactory());
concreteEngineType.Services.Add(new TestAgency()); // "TestAgency for " + TestContext.CurrentContext.Test.Name, 0));
concreteEngineType.Services.Add(new ResultService());
concreteEngineType.Services.Add(new TestFilterService());
Expand Down

0 comments on commit 7bb16ba

Please sign in to comment.