From bceb564ffd27b716c496abd7e798f9555050a61b Mon Sep 17 00:00:00 2001 From: Bert Date: Tue, 13 May 2025 09:36:44 +0200 Subject: [PATCH 1/3] initial --- .../Coverage/InstrumenterHelper.cs | 3 +- .../coverlet.core.coverage.tests.csproj | 1 - test/coverlet.tests.utils/FunctionExecutor.cs | 93 ++++++++ test/coverlet.tests.utils/RemoteExecution.cs | 198 ++++++++++++++++++ 4 files changed, 292 insertions(+), 3 deletions(-) create mode 100644 test/coverlet.tests.utils/FunctionExecutor.cs create mode 100644 test/coverlet.tests.utils/RemoteExecution.cs diff --git a/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs index c5e616ebc..2af885a66 100644 --- a/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Toni Solarin-Sodara +// Copyright (c) Toni Solarin-Sodara // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; @@ -16,7 +16,6 @@ using Microsoft.Extensions.DependencyInjection; using Moq; using Palmmedia.ReportGenerator.Core; -using Tmds.Utils; using Xunit; namespace Coverlet.Core.Tests diff --git a/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj b/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj index 43b19b7ad..d1b595546 100644 --- a/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj +++ b/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj @@ -20,7 +20,6 @@ - diff --git a/test/coverlet.tests.utils/FunctionExecutor.cs b/test/coverlet.tests.utils/FunctionExecutor.cs new file mode 100644 index 000000000..261f2763b --- /dev/null +++ b/test/coverlet.tests.utils/FunctionExecutor.cs @@ -0,0 +1,93 @@ +// Copyright (c) Toni Solarin-Sodara +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace coverlet.tests.utils +{ + public class FunctionExecutor + { + private readonly Action _configure; + + public FunctionExecutor(Action configure) + { + _configure = configure; + } + + public Process Start(Action action, Action configure = null) + => ExecFunction.Start(action, _configure + configure); + + public Process Start(Action action, string[] args, Action configure = null) + => ExecFunction.Start(action, args, _configure + configure); + + public Process Start(Func action, Action configure = null) + => ExecFunction.Start(action, _configure + configure); + + public Process Start(Func action, string[] args, Action configure = null) + => ExecFunction.Start(action, args, _configure + configure); + + public Process Start(Func action, Action configure = null) + => ExecFunction.Start(action, _configure + configure); + + public Process Start(Func action, string[] args, Action configure = null) + => ExecFunction.Start(action, args, _configure + configure); + + public Process Start(Func> action, Action configure = null) + => ExecFunction.Start(action, _configure + configure); + + public Process Start(Func> action, string[] args, Action configure = null) + => ExecFunction.Start(action, args, _configure + configure); + + public void Run(Action action, Action configure = null) + => ExecFunction.Run(action, _configure + configure); + + public void Run(Action action, string[] args, Action configure = null) + => ExecFunction.Run(action, args, _configure + configure); + + public void Run(Func action, Action configure = null) + => ExecFunction.Run(action, _configure + configure); + + public void Run(Func action, string[] args, Action configure = null) + => ExecFunction.Run(action, args, _configure + configure); + + public void Run(Func action, Action configure = null) + => ExecFunction.Run(action, _configure + configure); + + public void Run(Func action, string[] args, Action configure = null) + => ExecFunction.Run(action, args, _configure + configure); + + public void Run(Func> action, Action configure = null) + => ExecFunction.Run(action, _configure + configure); + + public void Run(Func> action, string[] args, Action configure = null) + => ExecFunction.Run(action, args, _configure + configure); + + public Task RunAsync(Action action, Action configure = null) + => ExecFunction.RunAsync(action, _configure + configure); + + public Task RunAsync(Action action, string[] args, Action configure = null) + => ExecFunction.RunAsync(action, args, _configure + configure); + + public Task RunAsync(Func action, Action configure = null) + => ExecFunction.RunAsync(action, _configure + configure); + + public Task RunAsync(Func action, string[] args, Action configure = null) + => ExecFunction.RunAsync(action, args, _configure + configure); + + public Task RunAsync(Func action, Action configure = null) + => ExecFunction.RunAsync(action, _configure + configure); + + public Task RunAsync(Func action, string[] args, Action configure = null) + => ExecFunction.RunAsync(action, args, _configure + configure); + + public Task RunAsync(Func> action, Action configure = null) + => ExecFunction.RunAsync(action, _configure + configure); + + public Task RunAsync(Func> action, string[] args, Action configure = null) + => ExecFunction.RunAsync(action, args, _configure + configure); + } +} diff --git a/test/coverlet.tests.utils/RemoteExecution.cs b/test/coverlet.tests.utils/RemoteExecution.cs new file mode 100644 index 000000000..287912ae9 --- /dev/null +++ b/test/coverlet.tests.utils/RemoteExecution.cs @@ -0,0 +1,198 @@ +// Copyright (c) Toni Solarin-Sodara +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.IO; +using System.Runtime.InteropServices; + +// from https://github.com/dotnet/command-line-api/blob/main/src/System.CommandLine.Tests/Utility/RemoteExecution.cs +namespace coverlet.tests.utils +{ + public class RemoteExecution : IDisposable + { + private const int FailWaitTimeoutMilliseconds = 60 * 1000; + private readonly string _exceptionFile; + + public RemoteExecution(System.Diagnostics.Process process, string className, string methodName, string exceptionFile) + { + Process = process; + ClassName = className; + MethodName = methodName; + _exceptionFile = exceptionFile; + } + + public System.Diagnostics.Process Process { get; private set; } + public string ClassName { get; } + public string MethodName { get; } + + public string FunctionExecutor; + + public void Dispose() + { + GC.SuppressFinalize(this); // before Dispose(true) in case the Dispose call throws + Dispose(disposing: true); + } + + private void Dispose(bool disposing) + { + //Assert.True(disposing, $"A test {ClassName}.{MethodName} forgot to Dispose() the result of RemoteInvoke()"); + + if (Process != null) + { + //Assert.True(Process.WaitForExit(FailWaitTimeoutMilliseconds), + //$"Timed out after {FailWaitTimeoutMilliseconds}ms waiting for remote process {Process.Id}"); + + // A bit unorthodox to do throwing operations in a Dispose, but by doing it here we avoid + // needing to do this in every derived test and keep each test much simpler. + try + { + if (File.Exists(_exceptionFile)) + { + throw new RemoteExecutionException(File.ReadAllText(_exceptionFile)); + } + } + finally + { + if (File.Exists(_exceptionFile)) + { + File.Delete(_exceptionFile); + } + + // Cleanup + try { Process.Kill(); } + catch { } // ignore all cleanup errors + } + + Process.Dispose(); + Process = null; + } + } + + private sealed class RemoteExecutionException : Exception + { + private readonly string _stackTrace; + + internal RemoteExecutionException(string stackTrace) + : base("Remote process failed with an unhandled exception.") + { + _stackTrace = stackTrace; + } + + public override string StackTrace => _stackTrace ?? base.StackTrace; + } + } + internal static class DotnetMuxer + { + public static FileInfo Path { get; } + + static DotnetMuxer() + { + var muxerFileName = ExecutableName("dotnet"); + var fxDepsFile = GetDataFromAppDomain("FX_DEPS_FILE"); + + if (string.IsNullOrEmpty(fxDepsFile)) + { + return; + } + + var muxerDir = new FileInfo(fxDepsFile).Directory?.Parent?.Parent?.Parent; + + if (muxerDir is null) + { + return; + } + + var muxerCandidate = new FileInfo(System.IO.Path.Combine(muxerDir.FullName, muxerFileName)); + + if (muxerCandidate.Exists) + { + Path = muxerCandidate; + } + else + { + throw new InvalidOperationException("no muxer!"); + } + } + + public static string GetDataFromAppDomain(string propertyName) + { + return AppContext.GetData(propertyName) as string; + } + + public static string ExecutableName(this string withoutExtension) => + RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? withoutExtension + ".exe" + : withoutExtension; + } + public static class Process + { + public static int RunToCompletion( + string command, + string args, + Action stdOut = null, + Action stdErr = null, + string workingDirectory = null, + params (string key, string value)[] environmentVariables) + { + args ??= ""; + + var process = new System.Diagnostics.Process + { + StartInfo = + { + Arguments = args, + FileName = command, + RedirectStandardError = true, + RedirectStandardOutput = true, + RedirectStandardInput = true, + UseShellExecute = false + } + }; + + if (!string.IsNullOrWhiteSpace(workingDirectory)) + { + process.StartInfo.WorkingDirectory = workingDirectory; + } + + if (environmentVariables.Length > 0) + { + for (var i = 0; i < environmentVariables.Length; i++) + { + var (key, value) = environmentVariables[i]; + process.StartInfo.Environment.Add(key, value); + } + } + + if (stdOut != null) + { + process.OutputDataReceived += (sender, eventArgs) => + { + if (eventArgs.Data != null) + { + stdOut(eventArgs.Data); + } + }; + } + + if (stdErr != null) + { + process.ErrorDataReceived += (sender, eventArgs) => + { + if (eventArgs.Data != null) + { + stdErr(eventArgs.Data); + } + }; + } + + process.Start(); + + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + + process.WaitForExit(); + + return process.ExitCode; + } + } +} From b5bd28bfff63635c38a624bae9cabda9ccfa3574 Mon Sep 17 00:00:00 2001 From: Bert Date: Wed, 14 May 2025 09:49:59 +0200 Subject: [PATCH 2/3] use FunctionExecutor only specific test --- global.json | 2 +- .../Coverage/CoverageTests.AsyncAwait.cs | 123 ++++------- .../CoverageTests.AsyncAwaitValueTask.cs | 26 +-- .../Coverage/CoverageTests.AsyncForeach.cs | 20 +- .../Coverage/CoverageTests.AsyncIterator.cs | 15 +- .../Coverage/CoverageTests.AutoProps.cs | 84 +++---- .../Coverage/CoverageTests.AwaitUsing.cs | 18 +- .../Coverage/CoverageTests.CatchBlock.cs | 77 +++---- .../Coverage/CoverageTests.DoesNotReturn.cs | 8 +- ...erageTests.ExcludeFromCoverageAttribute.cs | 205 +++++++----------- .../Coverage/CoverageTests.Filters.cs | 93 ++++---- .../CoverageTests.GenericAsyncIterator.cs | 14 +- .../Coverage/CoverageTests.Lambda.cs | 92 +++----- .../CoverageTests.SelectionStatements.cs | 85 +++----- .../Coverage/CoverageTests.Yield.cs | 85 +++----- .../Coverage/InstrumenterHelper.cs | 1 + .../coverlet.core.coverage.tests.csproj | 1 + test/coverlet.tests.utils/FunctionExecutor.cs | 93 -------- 18 files changed, 371 insertions(+), 671 deletions(-) delete mode 100644 test/coverlet.tests.utils/FunctionExecutor.cs diff --git a/global.json b/global.json index 6dfc6666e..0417b6523 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "8.0.407" + "version": "8.0.408" } } diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwait.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwait.cs index 2cd661086..1261978df 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwait.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwait.cs @@ -9,7 +9,6 @@ using Coverlet.Core.CoverageSamples.Tests; using Coverlet.Core.Tests; using Coverlet.Tests.Utils; -using Tmds.Utils; using Xunit; namespace Coverlet.CoreCoverage.Tests @@ -17,27 +16,24 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void AsyncAwait() + public async Task AsyncAwaitAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - instance.SyncExecution(); - - int res = await (Task)instance.AsyncExecution(true); - res = await (Task)instance.AsyncExecution(1); - res = await (Task)instance.AsyncExecution(2); - res = await (Task)instance.AsyncExecution(3); - res = await (Task)instance.ContinuationCalled(); - res = await (Task)instance.ConfigureAwait(); - - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + instance.SyncExecution(); + + int res = await (Task)instance.AsyncExecution(true); + res = await (Task)instance.AsyncExecution(1); + res = await (Task)instance.AsyncExecution(2); + res = await (Task)instance.AsyncExecution(3); + res = await (Task)instance.ContinuationCalled(); + res = await (Task)instance.ConfigureAwait(); + + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncAwait.cs") @@ -73,21 +69,16 @@ public void AsyncAwait() } [Fact] - public void AsyncAwait_Issue_669_1() + public async Task AsyncAwait_Issue_669_1Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.Test(); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.Test(); + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncAwait.cs") @@ -102,23 +93,18 @@ public void AsyncAwait_Issue_669_1() } } - [Fact(Skip = "Unhandled exception: System.InvalidOperationException: Sequence contains more than one matching element, InstrumenterHelper.cs:line 139 ")] - public void AsyncAwait_Issue_669_2() + [Fact] + public async Task AsyncAwait_Issue_669_2Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (ValueTask)instance.SendRequest(); - }, - persistPrepareResultToFile: pathSerialize[0], - assemblyLocation: Assembly.GetExecutingAssembly().Location); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (ValueTask)instance.SendRequest(); + }, + persistPrepareResultToFile: path, + assemblyLocation: Assembly.GetExecutingAssembly().Location); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncAwait.cs") @@ -132,21 +118,16 @@ public void AsyncAwait_Issue_669_2() } [Fact] - public void AsyncAwait_Issue_1177() + public async Task AsyncAwait_Issue_1177Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.Test(); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.Test(); + }, + persistPrepareResultToFile: path); Core.Instrumentation.Document document = TestInstrumentationHelper.GetCoverageResult(path).Document("Instrumentation.AsyncAwait.cs"); document.AssertLinesCovered(BuildConfiguration.Debug, (133, 1), (134, 1), (135, 1), (136, 1), (137, 1)); @@ -159,21 +140,16 @@ public void AsyncAwait_Issue_1177() } [Fact] - public void AsyncAwait_Issue_1233() + public async Task AsyncAwait_Issue_1233Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.Test(); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.Test(); + }, + persistPrepareResultToFile: path); Core.Instrumentation.Document document = TestInstrumentationHelper.GetCoverageResult(path).Document("Instrumentation.AsyncAwait.cs"); document.AssertLinesCovered(BuildConfiguration.Debug, (150, 1)); @@ -186,22 +162,17 @@ public void AsyncAwait_Issue_1233() } [Fact] - public void AsyncAwait_Issue_1275() + public async Task AsyncAwait_Issue_1275Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - using var cts = new CancellationTokenSource(); - await (Task)instance.Execute(cts.Token); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + using var cts = new CancellationTokenSource(); + await (Task)instance.Execute(cts.Token); + }, + persistPrepareResultToFile: path); Core.Instrumentation.Document document = TestInstrumentationHelper.GetCoverageResult(path).Document("Instrumentation.AsyncAwait.cs"); document.AssertLinesCoveredFromTo(BuildConfiguration.Debug, 170, 176); diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwaitValueTask.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwaitValueTask.cs index 46ebc6d40..b7f743d87 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwaitValueTask.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncAwaitValueTask.cs @@ -14,26 +14,22 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void AsyncAwaitWithValueTask() + public async Task AsyncAwaitWithValueTaskAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - instance.SyncExecution(); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + instance.SyncExecution(); - int res = await (ValueTask)instance.AsyncExecution(true); - res = await (ValueTask)instance.AsyncExecution(1); - res = await (ValueTask)instance.AsyncExecution(2); - res = await (ValueTask)instance.AsyncExecution(3); - res = await (ValueTask)instance.ConfigureAwait(); - res = await (Task)instance.WrappingValueTaskAsTask(); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + int res = await (ValueTask)instance.AsyncExecution(true); + res = await (ValueTask)instance.AsyncExecution(1); + res = await (ValueTask)instance.AsyncExecution(2); + res = await (ValueTask)instance.AsyncExecution(3); + res = await (ValueTask)instance.ConfigureAwait(); + res = await (Task)instance.WrappingValueTaskAsTask(); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncAwaitValueTask.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncForeach.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncForeach.cs index 017a69cd9..c2e6595b9 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncForeach.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncForeach.cs @@ -15,23 +15,19 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void AsyncForeach() + public async Task AsyncForeachAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - int res = await (ValueTask)instance.SumWithATwist(AsyncEnumerable.Range(1, 5)); - res += await (ValueTask)instance.Sum(AsyncEnumerable.Range(1, 3)); - res += await (ValueTask)instance.SumEmpty(); - await (ValueTask)instance.GenericAsyncForeach(AsyncEnumerable.Range(1, 3)); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + int res = await (ValueTask)instance.SumWithATwist(AsyncEnumerable.Range(1, 5)); + res += await (ValueTask)instance.Sum(AsyncEnumerable.Range(1, 3)); + res += await (ValueTask)instance.SumEmpty(); + await (ValueTask)instance.GenericAsyncForeach(AsyncEnumerable.Range(1, 3)); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncForeach.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncIterator.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncIterator.cs index 8bf9703cf..57a84a99f 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncIterator.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AsyncIterator.cs @@ -7,7 +7,6 @@ using Coverlet.Core.CoverageSamples.Tests; using Coverlet.Core.Tests; using Coverlet.Tests.Utils; -using Tmds.Utils; using Xunit; namespace Coverlet.CoreCoverage.Tests @@ -15,20 +14,16 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void AsyncIterator() + public async Task AsyncIteratorAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - int res = await (Task)instance.Issue1104_Repro(); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + int res = await (Task)instance.Issue1104_Repro(); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AsyncIterator.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AutoProps.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AutoProps.cs index 7deabe6f0..d98ed2fb6 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AutoProps.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AutoProps.cs @@ -16,25 +16,20 @@ public partial class CoverageTests [Theory] [InlineData(true)] [InlineData(false)] - public void SkipAutoProps(bool skipAutoProps) + public async Task SkipAutoPropsAsync(bool skipAutoProps) { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] parameters) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.AutoPropsNonInit = 10; - instance.AutoPropsInit = 20; - int readValue = instance.AutoPropsNonInit; - readValue = instance.AutoPropsInit; - return Task.CompletedTask; - }, - persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1])); - - return 0; - }, [path, skipAutoProps.ToString()]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.AutoPropsNonInit = 10; + instance.AutoPropsInit = 20; + int readValue = instance.AutoPropsNonInit; + readValue = instance.AutoPropsInit; + return Task.CompletedTask; + }, + persistPrepareResultToFile: path, skipAutoProps: bool.Parse(skipAutoProps.ToString())); if (skipAutoProps) { @@ -64,25 +59,20 @@ public void SkipAutoProps(bool skipAutoProps) [Theory] [InlineData(true)] [InlineData(false)] - public void SkipAutoPropsInRecords(bool skipAutoProps) + public async Task SkipAutoPropsInRecords(bool skipAutoProps) { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] parameters) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.RecordAutoPropsNonInit = string.Empty; - instance.RecordAutoPropsInit = string.Empty; - string readValue = instance.RecordAutoPropsInit; - readValue = instance.RecordAutoPropsNonInit; - return Task.CompletedTask; - }, - persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1])); - - return 0; - }, [path, skipAutoProps.ToString()]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.RecordAutoPropsNonInit = string.Empty; + instance.RecordAutoPropsInit = string.Empty; + string readValue = instance.RecordAutoPropsInit; + readValue = instance.RecordAutoPropsNonInit; + return Task.CompletedTask; + }, + persistPrepareResultToFile: path, skipAutoProps: bool.Parse(skipAutoProps.ToString())); if (skipAutoProps) { @@ -111,21 +101,16 @@ public void SkipAutoPropsInRecords(bool skipAutoProps) [Theory] [InlineData(true)] [InlineData(false)] - public void SkipRecordWithProperties(bool skipAutoProps) + public async Task SkipRecordWithPropertiesAsync(bool skipAutoProps) { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] parameters) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - return Task.CompletedTask; - }, - persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1])); - - return 0; - }, [path, skipAutoProps.ToString()]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + return Task.CompletedTask; + }, + persistPrepareResultToFile: path, skipAutoProps: bool.Parse(skipAutoProps.ToString())); if (skipAutoProps) { @@ -153,21 +138,16 @@ public void SkipRecordWithProperties(bool skipAutoProps) [Theory] [InlineData(true)] [InlineData(false)] - public void SkipInheritingRecordsWithProperties(bool skipAutoProps) + public async Task SkipInheritingRecordsWithPropertiesAsync(bool skipAutoProps) { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] parameters) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - return Task.CompletedTask; - }, - persistPrepareResultToFile: parameters[0], skipAutoProps: bool.Parse(parameters[1])); - - return 0; - }, [path, skipAutoProps.ToString()]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + return Task.CompletedTask; + }, + persistPrepareResultToFile: path, skipAutoProps: bool.Parse(skipAutoProps.ToString())); if (skipAutoProps) { diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AwaitUsing.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AwaitUsing.cs index 6bb985d46..f3f110daf 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AwaitUsing.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.AwaitUsing.cs @@ -14,22 +14,18 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void AwaitUsing() + public async Task AwaitUsingAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (ValueTask)instance.HasAwaitUsing(); - await (Task)instance.Issue914_Repro(); - await (Task)instance.Issue1490_Repro(); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (ValueTask)instance.HasAwaitUsing(); + await (Task)instance.Issue914_Repro(); + await (Task)instance.Issue1490_Repro(); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.AwaitUsing.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.CatchBlock.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.CatchBlock.cs index 3561616b8..0a39b197b 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.CatchBlock.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.CatchBlock.cs @@ -7,7 +7,6 @@ using Coverlet.Core.CoverageSamples.Tests; using Coverlet.Core.Tests; using Coverlet.Tests.Utils; -using Tmds.Utils; using Xunit; namespace Coverlet.CoreCoverage.Tests @@ -15,58 +14,54 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void CatchBlock_Issue465() + public async Task CatchBlock_Issue465Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - instance.Test(); - instance.Test_Catch(); - await (Task)instance.TestAsync(); - await (Task)instance.TestAsync_Catch(); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + instance.Test(); + instance.Test_Catch(); + await (Task)instance.TestAsync(); + await (Task)instance.TestAsync_Catch(); - instance.Test(true); - instance.Test_Catch(true); - await (Task)instance.TestAsync(true); - await (Task)instance.TestAsync_Catch(true); + instance.Test(true); + instance.Test_Catch(true); + await (Task)instance.TestAsync(true); + await (Task)instance.TestAsync_Catch(true); - instance.Test(false); - instance.Test_Catch(false); - await (Task)instance.TestAsync(false); - await (Task)instance.TestAsync_Catch(false); + instance.Test(false); + instance.Test_Catch(false); + await (Task)instance.TestAsync(false); + await (Task)instance.TestAsync_Catch(false); - instance.Test_WithTypedCatch(); - instance.Test_Catch_WithTypedCatch(); - await (Task)instance.TestAsync_WithTypedCatch(); - await (Task)instance.TestAsync_Catch_WithTypedCatch(); + instance.Test_WithTypedCatch(); + instance.Test_Catch_WithTypedCatch(); + await (Task)instance.TestAsync_WithTypedCatch(); + await (Task)instance.TestAsync_Catch_WithTypedCatch(); - instance.Test_WithTypedCatch(true); - instance.Test_Catch_WithTypedCatch(true); - await (Task)instance.TestAsync_WithTypedCatch(true); - await (Task)instance.TestAsync_Catch_WithTypedCatch(true); + instance.Test_WithTypedCatch(true); + instance.Test_Catch_WithTypedCatch(true); + await (Task)instance.TestAsync_WithTypedCatch(true); + await (Task)instance.TestAsync_Catch_WithTypedCatch(true); - instance.Test_WithTypedCatch(false); - instance.Test_Catch_WithTypedCatch(false); - await (Task)instance.TestAsync_WithTypedCatch(false); - await (Task)instance.TestAsync_Catch_WithTypedCatch(false); + instance.Test_WithTypedCatch(false); + instance.Test_Catch_WithTypedCatch(false); + await (Task)instance.TestAsync_WithTypedCatch(false); + await (Task)instance.TestAsync_Catch_WithTypedCatch(false); - instance.Test_WithNestedCatch(true); - instance.Test_Catch_WithNestedCatch(true); - await (Task)instance.TestAsync_WithNestedCatch(true); - await (Task)instance.TestAsync_Catch_WithNestedCatch(true); + instance.Test_WithNestedCatch(true); + instance.Test_Catch_WithNestedCatch(true); + await (Task)instance.TestAsync_WithNestedCatch(true); + await (Task)instance.TestAsync_Catch_WithNestedCatch(true); - instance.Test_WithNestedCatch(false); - instance.Test_Catch_WithNestedCatch(false); - await (Task)instance.TestAsync_WithNestedCatch(false); - await (Task)instance.TestAsync_Catch_WithNestedCatch(false); + instance.Test_WithNestedCatch(false); + instance.Test_Catch_WithNestedCatch(false); + await (Task)instance.TestAsync_WithNestedCatch(false); + await (Task)instance.TestAsync_Catch_WithNestedCatch(false); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + }, persistPrepareResultToFile: path); CoverageResult res = TestInstrumentationHelper.GetCoverageResult(path); res.Document("Instrumentation.CatchBlock.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.DoesNotReturn.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.DoesNotReturn.cs index 408ac6417..6babc6738 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.DoesNotReturn.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.DoesNotReturn.cs @@ -47,7 +47,7 @@ public void NoBranches_DoesNotReturnAttribute_InstrumentsCorrect() } } - [Fact(Skip = "xunit.v3 '(Explicit=true)' (System.Console.ReadKey, Instrumentation.DoesNotReturn.cs line 22) ")] + [Fact] public void If_DoesNotReturnAttribute_InstrumentsCorrect() { string path = Path.GetTempFileName(); @@ -78,7 +78,7 @@ public void If_DoesNotReturnAttribute_InstrumentsCorrect() } } - [Fact(Skip = "xunit.v3 '(Explicit=true)' (System.Console.ReadKey, Instrumentation.DoesNotReturn.cs line 36) ")] + [Fact] public void Switch_DoesNotReturnAttribute_InstrumentsCorrect() { string path = Path.GetTempFileName(); @@ -109,7 +109,7 @@ public void Switch_DoesNotReturnAttribute_InstrumentsCorrect() } } - [Fact(Skip = "xunit.v3 '(Explicit=true)' (System.Console.ReadKey, Instrumentation.DoesNotReturn.cs line 37) ")] + [Fact] public void Subtle_DoesNotReturnAttribute_InstrumentsCorrect() { string path = Path.GetTempFileName(); @@ -140,7 +140,7 @@ public void Subtle_DoesNotReturnAttribute_InstrumentsCorrect() } } - [Fact(Skip = "xunit.v3 '(Explicit=true)' (System.Console.ReadKey, Instrumentation.DoesNotReturn.cs line 107) ")] + [Fact] public void UnreachableBranch_DoesNotReturnAttribute_InstrumentsCorrect() { string path = Path.GetTempFileName(); diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.ExcludeFromCoverageAttribute.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.ExcludeFromCoverageAttribute.cs index 20b31495b..eaaf7a409 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.ExcludeFromCoverageAttribute.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.ExcludeFromCoverageAttribute.cs @@ -15,21 +15,15 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes() + public async Task ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.Test("test"); - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.Test("test"); + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -55,22 +49,16 @@ public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes() } [Fact] - public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes_NestedMembers() + public async Task ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes_NestedMembersAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Test(); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Test(); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path) .GenerateReport(show: true); @@ -86,22 +74,16 @@ public void ExcludeFromCodeCoverage_CompilerGeneratedMethodsAndTypes_NestedMembe } [Fact] - public void ExcludeFromCodeCoverageCompilerGeneratedMethodsAndTypes_Issue670() + public async Task ExcludeFromCodeCoverageCompilerGeneratedMethodsAndTypes_Issue670Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Test("test"); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Test("test"); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -116,21 +98,16 @@ public void ExcludeFromCodeCoverageCompilerGeneratedMethodsAndTypes_Issue670() } [Fact] - public void ExcludeFromCodeCoverageNextedTypes() + public async Task ExcludeFromCodeCoverageNextedTypesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - Assert.Equal(42, instance.Run()); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + Assert.Equal(42, instance.Run()); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .GenerateReport(show: true) @@ -145,20 +122,15 @@ public void ExcludeFromCodeCoverageNextedTypes() } [Fact] - public void ExcludeFromCodeCoverage_Issue809() + public async Task ExcludeFromCodeCoverage_Issue809Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - Assert.True(await (Task)instance.EditTask(null, 10)); - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + Assert.True(await (Task)instance.EditTask(null, 10)); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFromCoverage.Issue809.cs") @@ -180,22 +152,17 @@ public void ExcludeFromCodeCoverage_Issue809() } [Fact] - public void ExcludeFromCodeCoverageAutoGeneratedGetSet() + public async Task ExcludeFromCodeCoverageAutoGeneratedGetSetAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.SetId(10); - Assert.Equal(10, instance.Id); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.SetId(10); + Assert.Equal(10, instance.Id); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFromCoverage.cs") @@ -209,22 +176,17 @@ public void ExcludeFromCodeCoverageAutoGeneratedGetSet() } [Fact] - public void ExcludeFromCodeCoverageAutoGeneratedGet() + public async Task ExcludeFromCodeCoverageAutoGeneratedGetAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.SetId(10); - Assert.Equal(10, instance.Id); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.SetId(10); + Assert.Equal(10, instance.Id); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFromCoverage.cs") @@ -238,21 +200,16 @@ public void ExcludeFromCodeCoverageAutoGeneratedGet() } [Fact] - public void ExcludeFromCodeCoverage_Issue1302() + public async Task ExcludeFromCodeCoverage_Issue1302Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Run(); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Run(); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFromCoverage.Issue1302.cs") @@ -265,29 +222,24 @@ public void ExcludeFromCodeCoverage_Issue1302() } [Fact] - public void MethodsWithExcludeFromCodeCoverageAttr() + public async Task MethodsWithExcludeFromCodeCoverageAttrAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = - await TestInstrumentationHelper.Run(async instance => - { - instance.TestLambda(string.Empty); - instance.TestLambda(string.Empty, 1); - foreach (dynamic _ in instance.TestYield("abc")) ; - foreach (dynamic _ in instance.TestYield("abc", 1)) ; - instance.TestLocalFunction(string.Empty); - instance.TestLocalFunction(string.Empty, 1); - await (Task)instance.TestAsyncAwait(); - await (Task)instance.TestAsyncAwait(1); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = + await TestInstrumentationHelper.Run(async instance => + { + instance.TestLambda(string.Empty); + instance.TestLambda(string.Empty, 1); + foreach (dynamic _ in instance.TestYield("abc")) ; + foreach (dynamic _ in instance.TestYield("abc", 1)) ; + instance.TestLocalFunction(string.Empty); + instance.TestLocalFunction(string.Empty, 1); + await (Task)instance.TestAsyncAwait(); + await (Task)instance.TestAsyncAwait(1); + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .GenerateReport(show: true) @@ -302,29 +254,24 @@ await TestInstrumentationHelper.Run(asyn } [Fact] - public void MethodsWithExcludeFromCodeCoverageAttr2() + public async Task MethodsWithExcludeFromCodeCoverageAttr2Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = - await TestInstrumentationHelper.Run(async instance => - { - instance.TestLambda(string.Empty); - instance.TestLambda(string.Empty, 1); - foreach (dynamic _ in instance.TestYield("abc")) ; - foreach (dynamic _ in instance.TestYield("abc", 1)) ; - instance.TestLocalFunction(string.Empty); - instance.TestLocalFunction(string.Empty, 1); - await (Task)instance.TestAsyncAwait(); - await (Task)instance.TestAsyncAwait(1); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = + await TestInstrumentationHelper.Run(async instance => + { + instance.TestLambda(string.Empty); + instance.TestLambda(string.Empty, 1); + foreach (dynamic _ in instance.TestYield("abc")) ; + foreach (dynamic _ in instance.TestYield("abc", 1)) ; + instance.TestLocalFunction(string.Empty); + instance.TestLocalFunction(string.Empty, 1); + await (Task)instance.TestAsyncAwait(); + await (Task)instance.TestAsyncAwait(1); + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .GenerateReport(show: true) diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Filters.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Filters.cs index 63204b774..4acabe288 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Filters.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Filters.cs @@ -16,46 +16,41 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void ExcludeFilteredNestedAutogeneratedTypes() + public async Task ExcludeFilteredNestedAutogeneratedTypesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Run(); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Run(); - PropertyInfo stateProp = null; - foreach (Type type in ((Type)instance.GetType()).Assembly.GetTypes()) + PropertyInfo stateProp = null; + foreach (Type type in ((Type)instance.GetType()).Assembly.GetTypes()) + { + if (typeof(Issue_689).FullName == type.FullName) { - if (typeof(Issue_689).FullName == type.FullName) - { - Assert.Equal(0, (stateProp = type.GetProperty("State")).GetValue(null)); - break; - } + Assert.Equal(0, (stateProp = type.GetProperty("State")).GetValue(null)); + break; } + } - foreach (Type type in ((Type)instance.GetType()).Assembly.GetTypes()) + foreach (Type type in ((Type)instance.GetType()).Assembly.GetTypes()) + { + if (typeof(EventSource_Issue_689).FullName == type.FullName) { - if (typeof(EventSource_Issue_689).FullName == type.FullName) - { - type.GetMethod("RaiseEvent").Invoke(null, null); - break; - } + type.GetMethod("RaiseEvent").Invoke(null, null); + break; } + } - Assert.Equal(2, stateProp.GetValue(null)); - - return Task.CompletedTask; - }, - includeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterNestedAutogeneratedTypes", $"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*Issue_689"], - excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*NestedToFilterOut", $"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*Uncoverlet"], - persistPrepareResultToFile: pathSerialize[0]); + Assert.Equal(2, stateProp.GetValue(null)); - return 0; - }, [path]); + return Task.CompletedTask; + }, + includeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterNestedAutogeneratedTypes", $"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*Issue_689"], + excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*NestedToFilterOut", $"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*Uncoverlet"], + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFilter.cs") @@ -73,23 +68,18 @@ public void ExcludeFilteredNestedAutogeneratedTypes() } [Fact] - public void ExcludeFilteredTypes() + public async Task ExcludeFilteredTypesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - Assert.Equal(42, instance.Run()); - return Task.CompletedTask; - }, - excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterOuterTypes"], - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + Assert.Equal(42, instance.Run()); + return Task.CompletedTask; + }, + excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterOuterTypes"], + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFilter.cs") @@ -103,23 +93,18 @@ public void ExcludeFilteredTypes() } [Fact] - public void ExcludeFilteredNestedTypes() + public async Task ExcludeFilteredNestedTypesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - Assert.Equal(42, instance.Run()); - return Task.CompletedTask; - }, - excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterClass2"], - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + Assert.Equal(42, instance.Run()); + return Task.CompletedTask; + }, + excludeFilter: moduleFileName => [$"[{Path.GetFileNameWithoutExtension(moduleFileName)}*]*ExcludeFilterClass2"], + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.ExcludeFilter.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.GenericAsyncIterator.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.GenericAsyncIterator.cs index 436171428..96ec311c6 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.GenericAsyncIterator.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.GenericAsyncIterator.cs @@ -15,19 +15,15 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void GenericAsyncIterator() + public async Task GenericAsyncIteratorAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run>(async instance => - { - List res = await (Task>)instance.Issue1383(); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run>(async instance => + { + List res = await (Task>)instance.Issue1383(); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.GenericAsyncIterator.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Lambda.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Lambda.cs index 9071d823f..d96c7ba00 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Lambda.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Lambda.cs @@ -14,20 +14,16 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests { [Fact] - public void Lambda_Issue343() + public async Task Lambda_Issue343Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - instance.InvokeAnonymous_Test(); - await (Task)instance.InvokeAnonymousAsync_Test(); - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + instance.InvokeAnonymous_Test(); + await (Task)instance.InvokeAnonymousAsync_Test(); + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.Lambda.cs") @@ -47,21 +43,16 @@ public void Lambda_Issue343() } [Fact] - public void AsyncAwait_Issue_730() + public async Task AsyncAwait_Issue_730Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.Invoke(); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.Invoke(); + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.Lambda.cs") @@ -75,22 +66,17 @@ public void AsyncAwait_Issue_730() } [Fact] - public void Lambda_Issue760() + public async Task Lambda_Issue760Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => - { - await (Task)instance.If(); - await (Task)instance.Foreach(); - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(async instance => + { + await (Task)instance.If(); + await (Task)instance.Foreach(); + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.Lambda.cs") @@ -104,22 +90,17 @@ public void Lambda_Issue760() } [Fact] - public void Issue_1056() + public async Task Issue_1056Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.T1(); - return Task.CompletedTask; - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.T1(); + return Task.CompletedTask; + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.Lambda.cs") @@ -139,23 +120,18 @@ public void Issue_1056() } [Fact] - public void Issue_1447() + public async Task Issue_1447Async() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Query1(); - instance.Query2(); - return Task.CompletedTask; - }, - persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Query1(); + instance.Query2(); + return Task.CompletedTask; + }, + persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path).GenerateReport(show: true) .Document("Instrumentation.Lambda.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.SelectionStatements.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.SelectionStatements.cs index 194b7c4a3..ea7f72fca 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.SelectionStatements.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.SelectionStatements.cs @@ -7,7 +7,6 @@ using Coverlet.Core.CoverageSamples.Tests; using Coverlet.Core.Tests; using Coverlet.Tests.Utils; -using Tmds.Utils; using Xunit; namespace Coverlet.CoreCoverage.Tests @@ -15,7 +14,7 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests : ExternalProcessExecutionTest { [Fact] - public void SelectionStatements_If() + public async Task SelectionStatements_IfAsync() { // We need to pass file name to remote process where it save instrumentation result // Similar to msbuild input/output @@ -23,21 +22,15 @@ public void SelectionStatements_If() try { // Lambda will run in a custom process to avoid issue with statics and file locking - FunctionExecutor.Run(async (string[] pathSerialize) => - { - // Run load and call a delegate passing class as dynamic to simplify method call - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - // We call method to trigger coverage hits - instance.If(true); - - // For now we have only async Run helper - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); + // Run load and call a delegate passing class as dynamic to simplify method call + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + // We call method to trigger coverage hits + instance.If(true); - // we return 0 if we return something different assert fail - return 0; - }, [path]); + // For now we have only async Run helper + return Task.CompletedTask; + }, persistPrepareResultToFile: path); // We retrieve and load CoveragePrepareResult and run coverage calculation // Similar to msbuild coverage result task @@ -61,20 +54,16 @@ public void SelectionStatements_If() } [Fact] - public void SelectionStatements_Switch() + public async Task SelectionStatements_SwitchAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.Switch(1); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.Switch(1); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -91,20 +80,16 @@ public void SelectionStatements_Switch() } [Fact] - public void SelectionStatements_Switch_CSharp8_OneBranch() + public async Task SelectionStatements_Switch_CSharp8_OneBranchAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - instance.SwitchCsharp8(int.MaxValue); - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.SwitchCsharp8(int.MaxValue); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.SelectionStatements.cs") @@ -120,27 +105,23 @@ public void SelectionStatements_Switch_CSharp8_OneBranch() } [Fact] - public void SelectionStatements_Switch_CSharp8_AllBranches() + public async Task SelectionStatements_Switch_CSharp8_AllBranchesAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + instance.SwitchCsharp8(int.MaxValue); + instance.SwitchCsharp8(uint.MaxValue); + instance.SwitchCsharp8(short.MaxValue); + try { - instance.SwitchCsharp8(int.MaxValue); - instance.SwitchCsharp8(uint.MaxValue); - instance.SwitchCsharp8(short.MaxValue); - try - { - instance.SwitchCsharp8(""); - } - catch { } - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + instance.SwitchCsharp8(""); + } + catch { } + return Task.CompletedTask; + }, persistPrepareResultToFile: path); TestInstrumentationHelper.GetCoverageResult(path) .Document("Instrumentation.SelectionStatements.cs") diff --git a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Yield.cs b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Yield.cs index 135504666..261ae7c73 100644 --- a/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Yield.cs +++ b/test/coverlet.core.coverage.tests/Coverage/CoverageTests.Yield.cs @@ -7,7 +7,6 @@ using Coverlet.Core.CoverageSamples.Tests; using Coverlet.Core.Tests; using Coverlet.Tests.Utils; -using Tmds.Utils; using Xunit; namespace Coverlet.CoreCoverage.Tests @@ -15,22 +14,17 @@ namespace Coverlet.CoreCoverage.Tests public partial class CoverageTests : ExternalProcessExecutionTest { [Fact] - public void Yield_Single() + public async Task Yield_SingleAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - foreach (dynamic _ in instance.One()) ; + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + foreach (dynamic _ in instance.One()) ; - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - - return 0; - }, [path]); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -46,21 +40,17 @@ public void Yield_Single() } [Fact] - public void Yield_Two() + public async Task Yield_TwoAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - foreach (dynamic _ in instance.Two()) ; + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + foreach (dynamic _ in instance.Two()) ; - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -76,22 +66,17 @@ public void Yield_Two() } [Fact] - public void Yield_SingleWithSwitch() + public async Task Yield_SingleWithSwitchAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - foreach (dynamic _ in instance.OneWithSwitch(2)) ; - - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + foreach (dynamic _ in instance.OneWithSwitch(2)) ; - return 0; - }, [path]); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -107,21 +92,17 @@ public void Yield_SingleWithSwitch() } [Fact] - public void Yield_Three() + public async Task Yield_ThreeAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - foreach (dynamic _ in instance.Three()) ; + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + foreach (dynamic _ in instance.Three()) ; - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); @@ -139,21 +120,17 @@ public void Yield_Three() private static readonly string[] s_stringArray = ["one", "two", "three", "four"]; [Fact] - public void Yield_Enumerable() + public async Task Yield_EnumerableAsync() { string path = Path.GetTempFileName(); try { - FunctionExecutor.Run(async (string[] pathSerialize) => - { - CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => - { - foreach (dynamic _ in instance.Enumerable(s_stringArray)) ; - - return Task.CompletedTask; - }, persistPrepareResultToFile: pathSerialize[0]); - return 0; - }, [path]); + CoveragePrepareResult coveragePrepareResult = await TestInstrumentationHelper.Run(instance => + { + foreach (dynamic _ in instance.Enumerable(s_stringArray)) ; + + return Task.CompletedTask; + }, persistPrepareResultToFile: path); CoverageResult result = TestInstrumentationHelper.GetCoverageResult(path); diff --git a/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs b/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs index 2af885a66..42ae033f9 100644 --- a/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs +++ b/test/coverlet.core.coverage.tests/Coverage/InstrumenterHelper.cs @@ -16,6 +16,7 @@ using Microsoft.Extensions.DependencyInjection; using Moq; using Palmmedia.ReportGenerator.Core; +using Tmds.Utils; using Xunit; namespace Coverlet.Core.Tests diff --git a/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj b/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj index d1b595546..43b19b7ad 100644 --- a/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj +++ b/test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj @@ -20,6 +20,7 @@ + diff --git a/test/coverlet.tests.utils/FunctionExecutor.cs b/test/coverlet.tests.utils/FunctionExecutor.cs deleted file mode 100644 index 261f2763b..000000000 --- a/test/coverlet.tests.utils/FunctionExecutor.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Toni Solarin-Sodara -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace coverlet.tests.utils -{ - public class FunctionExecutor - { - private readonly Action _configure; - - public FunctionExecutor(Action configure) - { - _configure = configure; - } - - public Process Start(Action action, Action configure = null) - => ExecFunction.Start(action, _configure + configure); - - public Process Start(Action action, string[] args, Action configure = null) - => ExecFunction.Start(action, args, _configure + configure); - - public Process Start(Func action, Action configure = null) - => ExecFunction.Start(action, _configure + configure); - - public Process Start(Func action, string[] args, Action configure = null) - => ExecFunction.Start(action, args, _configure + configure); - - public Process Start(Func action, Action configure = null) - => ExecFunction.Start(action, _configure + configure); - - public Process Start(Func action, string[] args, Action configure = null) - => ExecFunction.Start(action, args, _configure + configure); - - public Process Start(Func> action, Action configure = null) - => ExecFunction.Start(action, _configure + configure); - - public Process Start(Func> action, string[] args, Action configure = null) - => ExecFunction.Start(action, args, _configure + configure); - - public void Run(Action action, Action configure = null) - => ExecFunction.Run(action, _configure + configure); - - public void Run(Action action, string[] args, Action configure = null) - => ExecFunction.Run(action, args, _configure + configure); - - public void Run(Func action, Action configure = null) - => ExecFunction.Run(action, _configure + configure); - - public void Run(Func action, string[] args, Action configure = null) - => ExecFunction.Run(action, args, _configure + configure); - - public void Run(Func action, Action configure = null) - => ExecFunction.Run(action, _configure + configure); - - public void Run(Func action, string[] args, Action configure = null) - => ExecFunction.Run(action, args, _configure + configure); - - public void Run(Func> action, Action configure = null) - => ExecFunction.Run(action, _configure + configure); - - public void Run(Func> action, string[] args, Action configure = null) - => ExecFunction.Run(action, args, _configure + configure); - - public Task RunAsync(Action action, Action configure = null) - => ExecFunction.RunAsync(action, _configure + configure); - - public Task RunAsync(Action action, string[] args, Action configure = null) - => ExecFunction.RunAsync(action, args, _configure + configure); - - public Task RunAsync(Func action, Action configure = null) - => ExecFunction.RunAsync(action, _configure + configure); - - public Task RunAsync(Func action, string[] args, Action configure = null) - => ExecFunction.RunAsync(action, args, _configure + configure); - - public Task RunAsync(Func action, Action configure = null) - => ExecFunction.RunAsync(action, _configure + configure); - - public Task RunAsync(Func action, string[] args, Action configure = null) - => ExecFunction.RunAsync(action, args, _configure + configure); - - public Task RunAsync(Func> action, Action configure = null) - => ExecFunction.RunAsync(action, _configure + configure); - - public Task RunAsync(Func> action, string[] args, Action configure = null) - => ExecFunction.RunAsync(action, args, _configure + configure); - } -} From 2773c2ab0c45618c0724cc53aa825a04561e5787 Mon Sep 17 00:00:00 2001 From: Bert Date: Thu, 15 May 2025 10:17:24 +0200 Subject: [PATCH 3/3] update versions --- Directory.Build.props | 6 +++--- Directory.Packages.props | 18 +++++++++--------- src/coverlet.core/coverlet.core.csproj | 14 +++++++------- .../coverlet.msbuild.tasks.csproj | 2 +- ...erlet.core.tests.samples.netstandard.csproj | 2 +- .../coverlet.msbuild.tasks.tests.csproj | 6 +++--- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0b0e187d0..c28c4fdcf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -55,9 +55,9 @@ --> - 15.9.20 - 1.6.0 - 1.5.0 + + 17.13.0 - 6.13.2 + 6.14.0 2.0.0 3.0.2 @@ -21,7 +21,7 @@ - + @@ -54,18 +54,18 @@ - + - + - - + + - + diff --git a/src/coverlet.core/coverlet.core.csproj b/src/coverlet.core/coverlet.core.csproj index f3e16e3f1..5f659912d 100644 --- a/src/coverlet.core/coverlet.core.csproj +++ b/src/coverlet.core/coverlet.core.csproj @@ -7,16 +7,16 @@ - - - - + + + + - - - + + + diff --git a/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj b/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj index c04e823b0..20fe9f592 100644 --- a/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj +++ b/src/coverlet.msbuild.tasks/coverlet.msbuild.tasks.csproj @@ -40,7 +40,7 @@ - + diff --git a/test/coverlet.core.tests.samples.netstandard/coverlet.core.tests.samples.netstandard.csproj b/test/coverlet.core.tests.samples.netstandard/coverlet.core.tests.samples.netstandard.csproj index 36bc43a36..a7ce141f5 100644 --- a/test/coverlet.core.tests.samples.netstandard/coverlet.core.tests.samples.netstandard.csproj +++ b/test/coverlet.core.tests.samples.netstandard/coverlet.core.tests.samples.netstandard.csproj @@ -8,7 +8,7 @@ - + diff --git a/test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj b/test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj index f363d52ac..3dc0954e8 100644 --- a/test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj +++ b/test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj @@ -3,8 +3,8 @@ net8.0 - enable true @@ -20,7 +20,7 @@ - +