|
7 | 7 |
|
8 | 8 | namespace BenchmarkDotNet.Build.Runners;
|
9 | 9 |
|
10 |
| -public class UnitTestRunner |
| 10 | +public class UnitTestRunner(BuildContext context) |
11 | 11 | {
|
12 |
| - private readonly BuildContext context; |
| 12 | + private FilePath UnitTestsProjectFile { get; } = context.RootDirectory |
| 13 | + .Combine("tests") |
| 14 | + .Combine("BenchmarkDotNet.Tests") |
| 15 | + .CombineWithFilePath("BenchmarkDotNet.Tests.csproj"); |
13 | 16 |
|
14 |
| - private FilePath UnitTestsProjectFile { get; } |
15 |
| - private FilePath IntegrationTestsProjectFile { get; } |
16 |
| - private DirectoryPath TestOutputDirectory { get; } |
| 17 | + private FilePath ExporterTestsProjectFile { get; } = context.RootDirectory |
| 18 | + .Combine("tests") |
| 19 | + .Combine("BenchmarkDotNet.Exporters.Plotting.Tests") |
| 20 | + .CombineWithFilePath("BenchmarkDotNet.Exporters.Plotting.Tests.csproj"); |
17 | 21 |
|
18 |
| - public UnitTestRunner(BuildContext context) |
19 |
| - { |
20 |
| - this.context = context; |
21 |
| - UnitTestsProjectFile = context.RootDirectory |
22 |
| - .Combine("tests") |
23 |
| - .Combine("BenchmarkDotNet.Tests") |
24 |
| - .CombineWithFilePath("BenchmarkDotNet.Tests.csproj"); |
25 |
| - IntegrationTestsProjectFile = context.RootDirectory |
26 |
| - .Combine("tests") |
27 |
| - .Combine("BenchmarkDotNet.IntegrationTests") |
28 |
| - .CombineWithFilePath("BenchmarkDotNet.IntegrationTests.csproj"); |
29 |
| - TestOutputDirectory = context.RootDirectory |
30 |
| - .Combine("TestResults"); |
31 |
| - } |
| 22 | + private FilePath IntegrationTestsProjectFile { get; } = context.RootDirectory |
| 23 | + .Combine("tests") |
| 24 | + .Combine("BenchmarkDotNet.IntegrationTests") |
| 25 | + .CombineWithFilePath("BenchmarkDotNet.IntegrationTests.csproj"); |
| 26 | + |
| 27 | + private DirectoryPath TestOutputDirectory { get; } = context.RootDirectory |
| 28 | + .Combine("TestResults"); |
32 | 29 |
|
33 | 30 | private DotNetTestSettings GetTestSettingsParameters(FilePath logFile, string tfm)
|
34 | 31 | {
|
@@ -58,14 +55,15 @@ private void RunTests(FilePath projectFile, string alias, string tfm)
|
58 | 55 | context.DotNetTest(projectFile.FullPath, settings);
|
59 | 56 | }
|
60 | 57 |
|
61 |
| - private void RunUnitTests(string tfm) => RunTests(UnitTestsProjectFile, "unit", tfm); |
| 58 | + private void RunUnitTests(string tfm) |
| 59 | + { |
| 60 | + RunTests(UnitTestsProjectFile, "unit", tfm); |
| 61 | + RunTests(ExporterTestsProjectFile, "exporters", tfm); |
| 62 | + } |
62 | 63 |
|
63 | 64 | public void RunUnitTests()
|
64 | 65 | {
|
65 |
| - var targetFrameworks = context.IsRunningOnWindows() |
66 |
| - ? new[] { "net462", "net8.0" } |
67 |
| - : new[] { "net8.0" }; |
68 |
| - |
| 66 | + string[] targetFrameworks = context.IsRunningOnWindows() ? ["net462", "net8.0"] : ["net8.0"]; |
69 | 67 | foreach (var targetFramework in targetFrameworks)
|
70 | 68 | RunUnitTests(targetFramework);
|
71 | 69 | }
|
|
0 commit comments