Skip to content

Commit

Permalink
Update recipe version
Browse files Browse the repository at this point in the history
  • Loading branch information
CharliePoole committed Jul 16, 2024
1 parent 976acd8 commit 5a6334a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.7.0
next-version: 3.8.0
mode: ContinuousDelivery
legacy-semver-padding: 5
build-metadata-padding: 5
Expand Down
26 changes: 19 additions & 7 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
#tool nuget:?package=NUnit.ConsoleRunner&version=3.17.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.18.0-dev00037
#tool nuget:?package=NUnit.ConsoleRunner.NetCore&version=3.18.0-dev00037
#tool nuget:?package=NUnit.Extension.NUnitProjectLoader&version=3.6.0

// Load the recipe
#load nuget:?package=NUnit.Cake.Recipe&version=1.0.0-dev00001
#load nuget:?package=NUnit.Cake.Recipe&version=1.0.1-dev00001
// Comment out above line and uncomment below for local tests of recipe changes
//#load ../NUnit.Cake.Recipe/recipe/*.cake

Expand All @@ -16,7 +15,7 @@ BuildSettings.Initialize(
"nunit-v2-result-writer",
solutionFile: "nunit-v2-result-writer.sln",
unitTestRunner: new NUnitLiteRunner(),
unitTests: "**/*.Tests.exe");
unitTests: "**/*.tests.exe");

const string NUNIT3_RESULT_FILE = "TestResult.xml";
const string NUNIT2_RESULT_FILE = "NUnit2TestResult.xml";
Expand All @@ -33,7 +32,17 @@ PackageTest[] PackageTests = new PackageTest[]
} ),

new PackageTest(
1, "TwoAssemblies",
1, "SingleAssembly_NetCoreRunner",
"Run mock-assembly under NetCore runner",
$"net6.0/mock-assembly.dll --result={NUNIT3_RESULT_FILE} --result={NUNIT2_RESULT_FILE};format=nunit2",
new ExpectedResult("Failed")
{
Assemblies = new[] { new ExpectedAssemblyResult("mock-assembly.dll", "netcore-6.0") }
},
new IPackageTestRunner[] { (IPackageTestRunner)new NUnitNetCoreConsoleRunner("3.18.0-dev00037") } ),

new PackageTest(
1, "TwoAssembliesTogether",
"Run two copies of mock-assembly",
$"net462/mock-assembly.dll net6.0/mock-assembly.dll --result={NUNIT3_RESULT_FILE} --result={NUNIT2_RESULT_FILE};format=nunit2",
new ExpectedResult("Failed") {
Expand All @@ -54,13 +63,16 @@ PackageTest[] PackageTests = new PackageTest[]
new ExpectedAssemblyResult("mock-assembly.dll", "netcore-6.0")
}
},
KnownExtensions.NUnitProjectLoader )
KnownExtensions.NUnitProjectLoader.SetVersion("3.8.0") )
};

//////////////////////////////////////////////////////////////////////
// NUGET PACKAGE
//////////////////////////////////////////////////////////////////////

private TestRunnerSource DEFAULT_TEST_RUNNER_SOURCE = new TestRunnerSource (
new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037") );

BuildSettings.Packages.Add(
new NuGetPackage(
"NUnit.Extension.NUnitV2ResultWriter",
Expand All @@ -72,7 +84,7 @@ BuildSettings.Packages.Add(
HasDirectory("tools/net6.0").WithFile("nunit-v2-result-writer.dll"),
HasDirectory("tools/net6.0").WithFile("nunit.engine.api.dll") },
tests: PackageTests,
testRunnerSource: new TestRunnerSource(new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037"))
testRunnerSource: DEFAULT_TEST_RUNNER_SOURCE
));

//////////////////////////////////////////////////////////////////////
Expand All @@ -89,7 +101,7 @@ BuildSettings.Packages.Add(
HasDirectory("tools/net6.0").WithFile("nunit-v2-result-writer.dll"),
HasDirectory("tools/net6.0").WithFile("nunit.engine.api.dll") },
tests: PackageTests,
testRunnerSource: new TestRunnerSource(new NUnitConsoleRunner("3.17.0"), new NUnitConsoleRunner("3.15.5"), new NUnitConsoleRunner("3.18.0-dev00037"))
testRunnerSource: DEFAULT_TEST_RUNNER_SOURCE
));

//////////////////////////////////////////////////////////////////////
Expand Down
12 changes: 0 additions & 12 deletions src/mock-assembly/MockAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ public class MockAssembly
public static int Failures = MockTestFixture.Failures;

public static int Categories = MockTestFixture.Categories;

public static string AssemblyPath;

static MockAssembly()
{
var assembly = typeof(MockAssembly).Assembly;
string codeBase = assembly.EscapedCodeBase;

AssemblyPath = codeBase.ToLower().StartsWith(Uri.UriSchemeFile)
? new Uri(codeBase).LocalPath
: assembly.Location;
}
}

[TestFixture(Description = "Fake Test Fixture")]
Expand Down
19 changes: 19 additions & 0 deletions src/tests/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt

using System.Reflection;
using NUnitLite;

namespace NUnit.Engine.Tests
{
class Program
{
static int Main(string[] args)
{
#if NETFRAMEWORK
return new TextRunner(typeof(Program).Assembly).Execute(args);
#else
return new TextRunner(typeof(Program).GetTypeInfo().Assembly).Execute(args);
#endif
}
}
}
5 changes: 3 additions & 2 deletions src/tests/nunit-v2-result-writer.tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<!-- If adding/updating TargetFrameworks, also update build.cake -->
<!-- Even though we don't support running tests build for netcoreapp2.1 yet, we still build for it -->
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<Configurations>Debug;Release</Configurations>
<RootNamespace>NUnit.Engine.Tests</RootNamespace>
<AssemblyName>nunit-v2-result-writer.tests</AssemblyName>
Expand All @@ -16,9 +17,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="nunit.engine.api" Version="3.11.1" />

<!-- This is the newest NUnit that support .NET Framework 2.0 -->
<!-- This is the newest NUnit that supports .NET Framework 2.0 -->
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnitLite" Version="3.11.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\extension\nunit-v2-result-writer.csproj" />
Expand Down

0 comments on commit 5a6334a

Please sign in to comment.