diff --git a/Bullseye/Bullseye.csproj b/Bullseye/Bullseye.csproj index 0fd687c7..f06db084 100644 --- a/Bullseye/Bullseye.csproj +++ b/Bullseye/Bullseye.csproj @@ -11,6 +11,8 @@ README.md https://github.com/adamralph/bullseye/blob/main/CHANGELOG.md true + + IDE0028;IDE0301 net6.0;net8.0 diff --git a/Bullseye/Internal/NativeMethods.cs b/Bullseye/Internal/NativeMethods.cs index 85503270..6b143721 100644 --- a/Bullseye/Internal/NativeMethods.cs +++ b/Bullseye/Internal/NativeMethods.cs @@ -2,10 +2,10 @@ namespace Bullseye.Internal; -#if NET6_0 -internal static class NativeMethods -#else +#if NET8_0_OR_GREATER internal static partial class NativeMethods +#else +internal static class NativeMethods #endif { [Flags] @@ -19,35 +19,35 @@ public enum StdHandle STD_OUTPUT_HANDLE = -11, } -#if NET6_0 - [DllImport("kernel32.dll", SetLastError = true)] - [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] - public static extern IntPtr GetStdHandle(StdHandle nStdHandle); -#else +#if NET8_0_OR_GREATER [LibraryImport("kernel32.dll", SetLastError = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] public static partial nint GetStdHandle(StdHandle nStdHandle); -#endif - -#if NET6_0 +#else [DllImport("kernel32.dll", SetLastError = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] - public static extern bool GetConsoleMode(nint hConsoleHandle, out ConsoleOutputModes lpMode); -#else + public static extern IntPtr GetStdHandle(StdHandle nStdHandle); +#endif + +#if NET8_0_OR_GREATER [LibraryImport("kernel32.dll", SetLastError = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] [return: MarshalAs(UnmanagedType.Bool)] public static partial bool GetConsoleMode(nint hConsoleHandle, out ConsoleOutputModes lpMode); -#endif - -#if NET6_0 +#else [DllImport("kernel32.dll", SetLastError = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] - public static extern bool SetConsoleMode(nint hConsoleHandle, ConsoleOutputModes dwMode); -#else + public static extern bool GetConsoleMode(nint hConsoleHandle, out ConsoleOutputModes lpMode); +#endif + +#if NET8_0_OR_GREATER [LibraryImport("kernel32.dll", SetLastError = true)] [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] [return: MarshalAs(UnmanagedType.Bool)] public static partial bool SetConsoleMode(nint hConsoleHandle, ConsoleOutputModes dwMode); +#else + [DllImport("kernel32.dll", SetLastError = true)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + public static extern bool SetConsoleMode(nint hConsoleHandle, ConsoleOutputModes dwMode); #endif } diff --git a/BullseyeSmokeTester.CommandLine/BullseyeSmokeTester.CommandLine.csproj b/BullseyeSmokeTester.CommandLine/BullseyeSmokeTester.CommandLine.csproj index 61427a94..023d3d1f 100644 --- a/BullseyeSmokeTester.CommandLine/BullseyeSmokeTester.CommandLine.csproj +++ b/BullseyeSmokeTester.CommandLine/BullseyeSmokeTester.CommandLine.csproj @@ -2,6 +2,7 @@ false + default Exe major net8.0 diff --git a/BullseyeSmokeTester.CommandLine/Program.cs b/BullseyeSmokeTester.CommandLine/Program.cs index 0b4d18b7..d38b8e2f 100644 --- a/BullseyeSmokeTester.CommandLine/Program.cs +++ b/BullseyeSmokeTester.CommandLine/Program.cs @@ -12,7 +12,7 @@ #pragma warning restore IDE0028 foreach (var (aliases, description) in Options.Definitions) { - cmd.Add(new Option(aliases.ToArray(), description)); + cmd.Add(new Option([.. aliases,], description)); } cmd.SetHandler(() => diff --git a/BullseyeSmokeTester.DragonFruit/BullseyeSmokeTester.DragonFruit.csproj b/BullseyeSmokeTester.DragonFruit/BullseyeSmokeTester.DragonFruit.csproj index 1edc4426..58094dfa 100644 --- a/BullseyeSmokeTester.DragonFruit/BullseyeSmokeTester.DragonFruit.csproj +++ b/BullseyeSmokeTester.DragonFruit/BullseyeSmokeTester.DragonFruit.csproj @@ -2,6 +2,7 @@ false + default Exe major net8.0 diff --git a/BullseyeSmokeTester.McMaster/BullseyeSmokeTester.McMaster.csproj b/BullseyeSmokeTester.McMaster/BullseyeSmokeTester.McMaster.csproj index dd67395b..32918be2 100644 --- a/BullseyeSmokeTester.McMaster/BullseyeSmokeTester.McMaster.csproj +++ b/BullseyeSmokeTester.McMaster/BullseyeSmokeTester.McMaster.csproj @@ -2,6 +2,7 @@ false + default Exe major net8.0 diff --git a/BullseyeSmokeTester/BullseyeSmokeTester.csproj b/BullseyeSmokeTester/BullseyeSmokeTester.csproj index 843f05dc..29eff2e0 100644 --- a/BullseyeSmokeTester/BullseyeSmokeTester.csproj +++ b/BullseyeSmokeTester/BullseyeSmokeTester.csproj @@ -2,6 +2,7 @@ false + default Exe major net8.0 diff --git a/BullseyeTests/BullseyeTests.csproj b/BullseyeTests/BullseyeTests.csproj index e2d1e351..eeb478ec 100644 --- a/BullseyeTests/BullseyeTests.csproj +++ b/BullseyeTests/BullseyeTests.csproj @@ -1,6 +1,7 @@ + default major net6.0;net8.0 diff --git a/BullseyeTests/CaseInsensitivity.cs b/BullseyeTests/CaseInsensitivity.cs index 343ff4cd..dd18e885 100644 --- a/BullseyeTests/CaseInsensitivity.cs +++ b/BullseyeTests/CaseInsensitivity.cs @@ -15,11 +15,11 @@ public static async Task MixingCase() var targets = new TargetCollection { CreateTarget("first", () => first = true), - CreateTarget("second", new[] { "FIRST", }, () => second = true), + CreateTarget("second", ["FIRST",], () => second = true), }; // act - await targets.RunAsync(new[] { "SECOND", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["SECOND",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.True(first); diff --git a/BullseyeTests/CommandLineTests.cs b/BullseyeTests/CommandLineTests.cs index e92c86d9..736b5270 100644 --- a/BullseyeTests/CommandLineTests.cs +++ b/BullseyeTests/CommandLineTests.cs @@ -76,8 +76,8 @@ public static void ParseShortNames() Assert.True(result.Options.Verbose); Assert.True(result.ShowHelp); - Assert.Equal(new[] { "target0", "target1", }, result.Targets); - Assert.Equal(new[] { "-0", "-1", }, result.UnknownOptions); + Assert.Equal(["target0", "target1",], result.Targets); + Assert.Equal(["-0", "-1",], result.UnknownOptions); } [Fact] @@ -123,7 +123,7 @@ public static void ParseLongNames() Assert.True(result.Options.Verbose); Assert.True(result.ShowHelp); - Assert.Equal(new[] { "target0", "target1", }, result.Targets); - Assert.Equal(new[] { "--unknown0", "--unknown1", }, result.UnknownOptions); + Assert.Equal(["target0", "target1",], result.Targets); + Assert.Equal(["--unknown0", "--unknown1",], result.UnknownOptions); } } diff --git a/BullseyeTests/Dependencies.cs b/BullseyeTests/Dependencies.cs index 7bf6ef4a..708488d6 100644 --- a/BullseyeTests/Dependencies.cs +++ b/BullseyeTests/Dependencies.cs @@ -5,11 +5,7 @@ namespace BullseyeTests; -#if NET8_0_OR_GREATER public static partial class Dependencies -#else -public static class Dependencies -#endif { [Fact] public static async Task FlatDependencies() @@ -21,11 +17,11 @@ public static async Task FlatDependencies() { CreateTarget("first", () => ran.Add("first")), CreateTarget("second", () => ran.Add("second")), - CreateTarget("third", new[] { "first", "second", }, () => ran.Add("third")), + CreateTarget("third", ["first", "second",], () => ran.Add("third")), }; // act - await targets.RunAsync(new List { "third", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["third",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(3, ran.Count); @@ -43,12 +39,12 @@ public static async Task NestedDependencies() var targets = new TargetCollection { CreateTarget("first", () => ran.Add("first")), - CreateTarget("second", new[] { "first", }, () => ran.Add("second")), - CreateTarget("third", new[] { "second", }, () => ran.Add("third")), + CreateTarget("second", ["first",], () => ran.Add("second")), + CreateTarget("third", ["second",], () => ran.Add("third")), }; // act - await targets.RunAsync(new List { "third", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["third",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(3, ran.Count); @@ -66,11 +62,11 @@ public static async Task DoubleDependency() var targets = new TargetCollection { CreateTarget("first", () => ran.Add("first")), - CreateTarget("second", new[] { "first", "first", }, () => ran.Add("second")), + CreateTarget("second", ["first", "first",], () => ran.Add("second")), }; // act - await targets.RunAsync(new List { "second", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["second",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(2, ran.Count); @@ -84,11 +80,11 @@ public static async Task SelfDependency() // arrange var targets = new TargetCollection { - CreateTarget("first", new[] { "first", }), + CreateTarget("first", ["first",]), }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "first", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["first",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -101,12 +97,12 @@ public static async Task MutualDependency() // arrange var targets = new TargetCollection { - CreateTarget("first", new[] { "second", }), - CreateTarget("second", new[] { "first", }), + CreateTarget("first", ["second",]), + CreateTarget("second", ["first",]), }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "second", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["second",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -119,13 +115,13 @@ public static async Task CircularDependency() // arrange var targets = new TargetCollection { - CreateTarget("first", new[] { "third", }), - CreateTarget("second", new[] { "first", }), - CreateTarget("third", new[] { "second", }), + CreateTarget("first", ["third",]), + CreateTarget("second", ["first",]), + CreateTarget("third", ["second",]), }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "third", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["third",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -143,12 +139,12 @@ public static async Task DoubleTransitiveDependency() var targets = new TargetCollection { CreateTarget("first", () => ran.Add("first")), - CreateTarget("second", new[] { "first", }, () => ran.Add("second")), - CreateTarget("third", new[] { "first", "second", }, () => ran.Add("third")), + CreateTarget("second", ["first",], () => ran.Add("second")), + CreateTarget("third", ["first", "second",], () => ran.Add("third")), }; // act - await targets.RunAsync(new List { "third", "--no-color", "--verbose", }, _ => false, () => "", outputWriter, Console.Error, false); + await targets.RunAsync(["third", "--no-color", "--verbose",], _ => false, () => "", outputWriter, Console.Error, false); // assert var output = outputWriter.ToString(); @@ -184,12 +180,12 @@ public static async Task NotExistentDependencies() var targets = new TargetCollection { CreateTarget("first", () => anyRan = true), - CreateTarget("second", new[] { "first", "non-existing", }, () => anyRan = true), - CreateTarget("third", new[] { "second", "also-non-existing", }, () => anyRan = true), + CreateTarget("second", ["first", "non-existing",], () => anyRan = true), + CreateTarget("third", ["second", "also-non-existing",], () => anyRan = true), }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "third", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["third",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -207,11 +203,11 @@ public static async Task SkippingDependencies() var targets = new TargetCollection { CreateTarget("first", () => ran.Add("first")), - CreateTarget("second", new[] { "first", "non-existent", }, () => ran.Add("second")), + CreateTarget("second", ["first", "non-existent",], () => ran.Add("second")), }; // act - await targets.RunAsync(new List { "second", "-s", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["second", "-s",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Contains("second", ran); @@ -227,11 +223,11 @@ public static async Task DependencyOrderWhenSkipping() var targets = new TargetCollection { CreateTarget("first", () => ran.Add("first")), - CreateTarget("second", new[] { "first", }, () => ran.Add("second")), + CreateTarget("second", ["first",], () => ran.Add("second")), }; // act - await targets.RunAsync(new List { "--skip-dependencies", "second", "first", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["--skip-dependencies", "second", "first",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(2, ran.Count); @@ -255,12 +251,12 @@ public static async Task DependencyOrderWhenParallelAndSkipping() Thread.Sleep(TimeSpan.FromSeconds(1)); // a weak way to encourage the tests to run first buildStartTime = Interlocked.Increment(ref clock); }), - CreateTarget("test1", new[] { "build", }, () => test1StartTime = Interlocked.Increment(ref clock)), - CreateTarget("test2", new[] { "build", }, () => test2StartTime = Interlocked.Increment(ref clock)), + CreateTarget("test1", ["build",], () => test1StartTime = Interlocked.Increment(ref clock)), + CreateTarget("test2", ["build",], () => test2StartTime = Interlocked.Increment(ref clock)), }; // act - await targets.RunAsync(new List { "--parallel", "--skip-dependencies", "test1", "test2", "build", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["--parallel", "--skip-dependencies", "test1", "test2", "build",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(1, buildStartTime); diff --git a/BullseyeTests/EnumerableInputs.cs b/BullseyeTests/EnumerableInputs.cs index 1bac0105..fe3d236e 100644 --- a/BullseyeTests/EnumerableInputs.cs +++ b/BullseyeTests/EnumerableInputs.cs @@ -18,7 +18,7 @@ public static async Task WithInputs() }; // act - await targets.RunAsync(new List(), _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(2, inputsReceived.Count); @@ -38,7 +38,7 @@ public static async Task WithoutInputs() }; // act - await targets.RunAsync(new List(), _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.False(ran); diff --git a/BullseyeTests/Infra/Helper.cs b/BullseyeTests/Infra/Helper.cs index b573ef3d..9e43efa8 100644 --- a/BullseyeTests/Infra/Helper.cs +++ b/BullseyeTests/Infra/Helper.cs @@ -4,7 +4,7 @@ namespace BullseyeTests.Infra; internal static class Helper { - public static Target CreateTarget(string name, Action action) => CreateTarget(name, Array.Empty(), action); + public static Target CreateTarget(string name, Action action) => CreateTarget(name, [], action); public static Target CreateTarget(string name, IEnumerable dependencies, Action action) => new ActionTarget(name, "", dependencies, action.ToAsync()); @@ -13,5 +13,5 @@ public static Target CreateTarget(string name, IEnumerable dependencies) new(name, "", dependencies); public static Target CreateTarget(string name, IEnumerable forEach, Action action) => - new ActionTarget(name, "", Array.Empty(), forEach, action.ToAsync()); + new ActionTarget(name, "", [], forEach, action.ToAsync()); } diff --git a/BullseyeTests/OutputTests.cs b/BullseyeTests/OutputTests.cs index 8f9f7973..ca4baacf 100644 --- a/BullseyeTests/OutputTests.cs +++ b/BullseyeTests/OutputTests.cs @@ -18,7 +18,7 @@ public static async Task DefaultHost() // act foreach (var @bool in new[] { true, false, }) { - await Write(output, noColor: true, noExtendedChars: !@bool, host: default, hostForced: @bool, OSPlatform.Create("Unknown"), skipDependencies: @bool, dryRun: @bool, parallel: @bool, verbose: true, new[] { "arg1", "arg2", }, ordinal++); + await Write(output, noColor: true, noExtendedChars: !@bool, host: default, hostForced: @bool, OSPlatform.Create("Unknown"), skipDependencies: @bool, dryRun: @bool, parallel: @bool, verbose: true, ["arg1", "arg2",], ordinal++); } // assert @@ -50,7 +50,7 @@ public static async Task AllHosts(Host host) OSPlatform.OSX, }) { - await Write(output, noColor, noExtendedChars: false, host, hostForced: true, osPlatform, skipDependencies: true, dryRun: true, parallel: true, verbose: true, args: new List(), ordinal++); + await Write(output, noColor, noExtendedChars: false, host, hostForced: true, osPlatform, skipDependencies: true, dryRun: true, parallel: true, verbose: true, args: [], ordinal++); } } @@ -99,57 +99,56 @@ private static async Task Write( private static async Task Write(Output output, bool dryRun) { - var badInput = new Target("badInput", "", Enumerable.Empty()); + var badInput = new Target("badInput", "", []); var badInputDuration = dryRun ? TimeSpan.Zero : TimeSpan.FromMilliseconds(1.234); var badInputEx = new InvalidOperationException("badInputEx"); var badInputId = Guid.ParseExact("AA123".PadRight(32, '0'), "N"); - var badInputsTarget = new Target("badInputsTarget", "", Enumerable.Empty()); + var badInputsTarget = new Target("badInputsTarget", "", []); - var badTarget = new Target("badTarget", "", Enumerable.Empty()); + var badTarget = new Target("badTarget", "", []); var badTargetDuration = dryRun ? TimeSpan.Zero : TimeSpan.FromMilliseconds(3.456); var badTargetEx = new InvalidOperationException("badTargetEx"); var emptyTargets = Enumerable.Empty(); - var goodInput1 = new Target("goodInput1", "", Enumerable.Empty()); - var goodInput2 = new Target("goodInput2", "", Enumerable.Empty()); + var goodInput1 = new Target("goodInput1", "", []); + var goodInput2 = new Target("goodInput2", "", []); var goodInputDuration1 = dryRun ? TimeSpan.Zero : TimeSpan.FromSeconds(1.234); var goodInputDuration2 = dryRun ? TimeSpan.Zero : TimeSpan.FromSeconds(2.345); var goodInputId1 = Guid.ParseExact("BB123".PadRight(32, '0'), "N"); var goodInputId2 = Guid.ParseExact("BB234".PadRight(32, '0'), "N"); - var goodInputsTarget = new Target("goodInputsTarget", "", Enumerable.Empty()); + var goodInputsTarget = new Target("goodInputsTarget", "", []); - var goodTarget1 = new Target("goodTarget1", "", Enumerable.Empty()); - var goodTarget2 = new Target("goodTarget2", "", Enumerable.Empty()); + var goodTarget1 = new Target("goodTarget1", "", []); + var goodTarget2 = new Target("goodTarget2", "", []); var goodTargetDuration1 = TimeSpan.Zero; var goodTargetDuration2 = dryRun ? TimeSpan.Zero : TimeSpan.FromMinutes(1.234); - var looseInput = new Target("looseInput", "", Enumerable.Empty()); + var looseInput = new Target("looseInput", "", []); var looseInputDuration = TimeSpan.Zero; var looseInputId = Guid.ParseExact("CC123".PadRight(32, '0'), "N"); - var looseTarget = new Target("looseTarget", "", Enumerable.Empty()); + var looseTarget = new Target("looseTarget", "", []); - var looseTargets = new List { new("looseTarget", "", Enumerable.Empty()), }; + var looseTargets = new List { new("looseTarget", "", []), }; - var noInputsTarget = new Target("noInputsTarget", "", Enumerable.Empty()); + var noInputsTarget = new Target("noInputsTarget", "", []); var targets = new List { - new("target1", "", Enumerable.Empty()), - new("target2", "", Enumerable.Empty()), - new("target3", "", Enumerable.Empty()), + new("target1", "", []), + new("target2", "", []), + new("target3", "", []), }; var verboseTargets = new Queue( - new[] - { - new Target("verboseTarget1", "", Enumerable.Empty()), - new Target("verboseTarget2", "", Enumerable.Empty()), - new Target("verboseTarget3", "", Enumerable.Empty()), - }); + [ + new Target("verboseTarget1", "", []), + new Target("verboseTarget2", "", []), + new Target("verboseTarget3", "", []), + ]); var version = "version"; diff --git a/BullseyeTests/RunningTargets.cs b/BullseyeTests/RunningTargets.cs index cd013274..f8ec3f1d 100644 --- a/BullseyeTests/RunningTargets.cs +++ b/BullseyeTests/RunningTargets.cs @@ -19,7 +19,7 @@ public static async Task Default() }; // act - await targets.RunAsync(new List(), _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.True(@default); @@ -40,7 +40,7 @@ public static async Task Specific() }; // act - await targets.RunAsync(new List { nameof(first), nameof(second), }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([nameof(first), nameof(second),], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.True(first); @@ -61,7 +61,7 @@ public static async Task TargetNameAbbreviation() }; // act - await targets.RunAsync(new List { nameof(foo)[..1], }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([nameof(foo)[..1],], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.True(foo); @@ -81,7 +81,7 @@ public static async Task TargetNameAbbreviationWithTargetMatchingAbbreviation() }; // act - await targets.RunAsync(new List { nameof(foo), }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync([nameof(foo),], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.True(foo); @@ -99,7 +99,7 @@ public static async Task AmbiguousTargetNameAbbreviation() }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "f", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["f",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -118,7 +118,7 @@ public static async Task SingleNonExistent() }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { nameof(existing), "non-existing", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync([nameof(existing), "non-existing",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -139,7 +139,7 @@ public static async Task MultipleNonExistent() // act var exception = await Record.ExceptionAsync( - () => targets.RunAsync(new List { nameof(existing), "non-existing", "also-non-existing", }, _ => false, () => "", Console.Out, Console.Error, false)); + () => targets.RunAsync([nameof(existing), "non-existing", "also-non-existing",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -160,7 +160,7 @@ public static async Task DryRun() }; // act - await targets.RunAsync(new List { "target", "-n", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["target", "-n",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.False(ran); @@ -178,7 +178,7 @@ public static async Task UnknownOption() }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "target", "-b", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["target", "-b",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -199,7 +199,7 @@ public static async Task UnknownOptions() }; // act - var exception = await Record.ExceptionAsync(() => targets.RunAsync(new List { "target", "-b", "-z", }, _ => false, () => "", Console.Out, Console.Error, false)); + var exception = await Record.ExceptionAsync(() => targets.RunAsync(["target", "-b", "-z",], _ => false, () => "", Console.Out, Console.Error, false)); // assert Assert.NotNull(exception); @@ -219,8 +219,8 @@ public static async Task Repeated() }; // act - await targets.RunAsync(new[] { "default", }, _ => false, () => "", Console.Out, Console.Error, false); - await targets.RunAsync(new[] { "default", }, _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["default",], _ => false, () => "", Console.Out, Console.Error, false); + await targets.RunAsync(["default",], _ => false, () => "", Console.Out, Console.Error, false); // assert Assert.Equal(2, count);