diff --git a/build/specifications/StrykerNet.json b/build/specifications/StrykerNet.json new file mode 100644 index 000000000..e01d9db99 --- /dev/null +++ b/build/specifications/StrykerNet.json @@ -0,0 +1,212 @@ +{ + "$schema": "https://raw.githubusercontent.com/nuke-build/nuke/master/source/Nuke.CodeGeneration/schema.json", + "references": [ + "https://github.com/stryker-mutator/stryker-net/blob/master/docs/Configuration.md", + "https://github.com/stryker-mutator/stryker-net/blob/master/docs/Reporters.md" + ], + "name": "StrykerNet", + "officialUrl": "https://stryker-mutator.io/stryker-net/", + "help": "", + "packageId": "dotnet-stryker", + "packageExecutable": "Stryker.CLI.dll", + "tasks": [ + { + "settingsClass": { + "properties": [ + { + "name": "SolutionPath", + "type": "string", + "format": "--solution-path {value}", + "help": "On .NET Framework projects Stryker needs your .sln file path." + }, + { + "name": "ProjectFile", + "type": "string", + "format": "--project-file {value}", + "help": "When Stryker finds two or more project references inside your test project, it needs to know which project should be mutated. Pass the name of this project." + }, + { + "name": "TestRunner", + "type": "StrykerNetTestRunner", + "format": "--test-runner {value}", + "help": "Stryker supports dotnet test, the commandline testrunner and VsTest, the visual studio testrunner. VsTest is the default because it offers tight integration with all test frameworks (MsTest, xUnit, NUnit etc). Dotnet test can be used if VsTest causes issues for some reason. Please also submit an issue with us if you experience difficulties with VsTest." + }, + { + "name": "Timeout", + "type": "int", + "format": "--timeout-ms {value}", + "help": "Some mutations can create endless loops inside your code. To detect and stop these loops, Stryker cancels a unit test run after a set time. Using this parameter you can increase or decrease the time before a test will time out." + }, + { + "name": "TestProjects", + "type": "List", + "format": "--test-projects {value}", + "customValue": true, + "help": "Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null" + }, + { + "name": "LogLevel", + "type": "StrykerNetLogLevel", + "format": "--log-level {value}", + "help": "To gain more insight in what Stryker does during a mutation testrun you can lower your loglevel." + }, + { + "name": "LogFile", + "type": "bool", + "format": "--log-file", + "noArgument": true, + "help": "When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace" + }, + { + "name": "MaxConcurrentTestRunners", + "type": "int", + "format": "--max-concurrent-test-runners {value}", + "help": "By default Stryker.NET will use as much CPU power as you allow it to use during a mutation testrun. You can lower this setting to lower your CPU usage. This setting can also be used to disable parallel testing. This can be useful if your test project cannot handle parallel testruns. Default: your number of logical processors / 2" + }, + { + "name": "ThresholdHigh", + "type": "int", + "format": "--threshold-high {value}", + "help": "Default: 80. If you want to decide on your own mutation score thresholds." + }, + { + "name": "ThresholdLow", + "type": "int", + "format": "--threshold-low {value}", + "help": "Default: 60. If you want to decide on your own mutation score thresholds." + }, + { + "name": "ThresholdBreak", + "type": "int", + "format": "--threshold-break {value}", + "help": "Default: 0. If you want to decide on your own mutation score thresholds." + }, + { + "name": "ExcludedMutations", + "type": "List", + "format": "--excluded-mutations {value}", + "customValue": true, + "help": "If you deem some mutations unwanted for your project you can disable mutations." + }, + { + "name": "Mutate", + "type": "List", + "format": "--mutate {value}", + "customValue": true, + "help": "To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included." + }, + { + "name": "IgnoreMethods", + "type": "List", + "format": "--ignore-methods {value}", + "customValue": true, + "help": "If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters." + }, + { + "name": "ConfigFilePath", + "type": "string", + "format": "--config-file-path {value}", + "help": "Path to configuration file. If you want to integrate these settings in your existing settings json, make sure the section is called stryker-config." + }, + { + "name": "CoverageAnalysis", + "type": "StrykerNetCoverage", + "format": "--coverage-analysis {value}", + "help": "Use coverage info to speed up execution." + }, + { + "name": "AbortTestOnFail", + "type": "bool", + "format": "--abort-test-on-fail", + "noArgument": true, + "help": "Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time." + }, + { + "name": "Diff", + "type": "bool", + "format": "--diff", + "noArgument": true, + "help": "Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default." + }, + { + "name": "GitSource", + "type": "string", + "format": "--git-source {value}", + "help": "Sets the source branch to compare with the current code on file system, used for calculating the difference when --diff is enabled." + }, + { + "name": "Reporters", + "type": "List", + "format": "--reporters {value}", + "customValue": true, + "help": "During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun." + }, + { + "name": "DashboardApiKey", + "type": "string", + "format": "--dashboard-api-key {value}", + "secret": true, + "help": "Get your api key at stryker dashboard. To keep your api key safe, store it in an encrypted variable in your pipeline." + }, + { + "name": "DashboardProject", + "type": "string", + "format": "--dashboard-project {value}", + "help": "The name registered with the dashboard. It is in the form of gitProvider/organization/repository. At the moment the dashboard backend only supports github.com as a git provider, but we will also support gitlab.com/bitbucket.org, etc in the future. It can have an indefinite number of levels. Slashes (/) in this name are not escaped. For example github.com/stryker-mutator/stryker-net." + }, + { + "name": "DashboardVersion", + "type": "string", + "format": "--dashboard-project {value}", + "help": "The version of the report. This should be filled with the branch name, git tag or git sha (although no validation is done). You can override a report of a specific version, like docker tags. Slashes in the version should not be encoded. For example, it's valid to use \"feat/logging\"." + }, + { + "name": "DashboardModule", + "type": "string", + "format": "--dashboard-module {value}", + "help": "Optional. If you want to store multiple reports for a version, you can use this value to separate them logically. For example, in a mono-repo setup where each package (or project or module) delivers a report." + } + ] + } + } + ], + "enumerations": [ + { + "name": "StrykerNetTestRunner", + "values": [ + "vstest", + "dotnettest" + ] + }, + { + "name": "StrykerNetReporter", + "values": [ + "html", + "progress", + "dashboard", + "cleartext", + "dots", + "json" + ] + }, + { + "name": "StrykerNetCoverage", + "values": [ + "off", + "perTest", + "all", + "perTestInIsolation" + ] + }, + { + "name": "StrykerNetLogLevel", + "values": [ + "error", + "warning", + "info", + "debug", + "trace" + ] + } + ] +} \ No newline at end of file diff --git a/source/Nuke.Common/Tools/StrykerNet/StrykerNet.Generated.cs b/source/Nuke.Common/Tools/StrykerNet/StrykerNet.Generated.cs new file mode 100644 index 000000000..6fb4cd4c9 --- /dev/null +++ b/source/Nuke.Common/Tools/StrykerNet/StrykerNet.Generated.cs @@ -0,0 +1,1358 @@ +// Generated from https://github.com/nuke-build/nuke/blob/master/build/specifications/StrykerNet.json + +using JetBrains.Annotations; +using Newtonsoft.Json; +using Nuke.Common; +using Nuke.Common.Execution; +using Nuke.Common.Tooling; +using Nuke.Common.Tools; +using Nuke.Common.Utilities.Collections; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using System.Text; + +namespace Nuke.Common.Tools.StrykerNet +{ + /// + ///

+ ///

For more details, visit the official website.

+ ///
+ [PublicAPI] + [ExcludeFromCodeCoverage] + public static partial class StrykerNetTasks + { + /// + /// Path to the StrykerNet executable. + /// + public static string StrykerNetPath => + ToolPathResolver.TryGetEnvironmentExecutable("STRYKERNET_EXE") ?? + ToolPathResolver.GetPackageExecutable("dotnet-stryker", "Stryker.CLI.dll"); + public static Action StrykerNetLogger { get; set; } = ProcessTasks.DefaultLogger; + /// + ///

+ ///

For more details, visit the official website.

+ ///
+ public static IReadOnlyCollection StrykerNet(string arguments, string workingDirectory = null, IReadOnlyDictionary environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Func outputFilter = null) + { + var process = ProcessTasks.StartProcess(StrykerNetPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, StrykerNetLogger, outputFilter); + process.AssertZeroExitCode(); + return process.Output; + } + /// + ///

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • --abort-test-on-fail via
  • + ///
  • --config-file-path via
  • + ///
  • --coverage-analysis via
  • + ///
  • --dashboard-api-key via
  • + ///
  • --dashboard-module via
  • + ///
  • --dashboard-project via
  • + ///
  • --dashboard-project via
  • + ///
  • --diff via
  • + ///
  • --excluded-mutations via
  • + ///
  • --git-source via
  • + ///
  • --ignore-methods via
  • + ///
  • --log-file via
  • + ///
  • --log-level via
  • + ///
  • --max-concurrent-test-runners via
  • + ///
  • --mutate via
  • + ///
  • --project-file via
  • + ///
  • --reporters via
  • + ///
  • --solution-path via
  • + ///
  • --test-projects via
  • + ///
  • --test-runner via
  • + ///
  • --threshold-break via
  • + ///
  • --threshold-high via
  • + ///
  • --threshold-low via
  • + ///
  • --timeout-ms via
  • + ///
+ ///
+ public static IReadOnlyCollection StrykerNet(StrykerNetSettings toolSettings = null) + { + toolSettings = toolSettings ?? new StrykerNetSettings(); + var process = ProcessTasks.StartProcess(toolSettings); + process.AssertZeroExitCode(); + return process.Output; + } + /// + ///

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • --abort-test-on-fail via
  • + ///
  • --config-file-path via
  • + ///
  • --coverage-analysis via
  • + ///
  • --dashboard-api-key via
  • + ///
  • --dashboard-module via
  • + ///
  • --dashboard-project via
  • + ///
  • --dashboard-project via
  • + ///
  • --diff via
  • + ///
  • --excluded-mutations via
  • + ///
  • --git-source via
  • + ///
  • --ignore-methods via
  • + ///
  • --log-file via
  • + ///
  • --log-level via
  • + ///
  • --max-concurrent-test-runners via
  • + ///
  • --mutate via
  • + ///
  • --project-file via
  • + ///
  • --reporters via
  • + ///
  • --solution-path via
  • + ///
  • --test-projects via
  • + ///
  • --test-runner via
  • + ///
  • --threshold-break via
  • + ///
  • --threshold-high via
  • + ///
  • --threshold-low via
  • + ///
  • --timeout-ms via
  • + ///
+ ///
+ public static IReadOnlyCollection StrykerNet(Configure configurator) + { + return StrykerNet(configurator(new StrykerNetSettings())); + } + /// + ///

+ ///

For more details, visit the official website.

+ ///
+ /// + ///

This is a CLI wrapper with fluent API that allows to modify the following arguments:

+ ///
    + ///
  • --abort-test-on-fail via
  • + ///
  • --config-file-path via
  • + ///
  • --coverage-analysis via
  • + ///
  • --dashboard-api-key via
  • + ///
  • --dashboard-module via
  • + ///
  • --dashboard-project via
  • + ///
  • --dashboard-project via
  • + ///
  • --diff via
  • + ///
  • --excluded-mutations via
  • + ///
  • --git-source via
  • + ///
  • --ignore-methods via
  • + ///
  • --log-file via
  • + ///
  • --log-level via
  • + ///
  • --max-concurrent-test-runners via
  • + ///
  • --mutate via
  • + ///
  • --project-file via
  • + ///
  • --reporters via
  • + ///
  • --solution-path via
  • + ///
  • --test-projects via
  • + ///
  • --test-runner via
  • + ///
  • --threshold-break via
  • + ///
  • --threshold-high via
  • + ///
  • --threshold-low via
  • + ///
  • --timeout-ms via
  • + ///
+ ///
+ public static IEnumerable<(StrykerNetSettings Settings, IReadOnlyCollection Output)> StrykerNet(CombinatorialConfigure configurator, int degreeOfParallelism = 1, bool completeOnFailure = false) + { + return configurator.Invoke(StrykerNet, StrykerNetLogger, degreeOfParallelism, completeOnFailure); + } + } + #region StrykerNetSettings + /// + /// Used within . + /// + [PublicAPI] + [ExcludeFromCodeCoverage] + [Serializable] + public partial class StrykerNetSettings : ToolSettings + { + /// + /// Path to the StrykerNet executable. + /// + public override string ToolPath => base.ToolPath ?? StrykerNetTasks.StrykerNetPath; + public override Action CustomLogger => StrykerNetTasks.StrykerNetLogger; + /// + /// On .NET Framework projects Stryker needs your .sln file path. + /// + public virtual string SolutionPath { get; internal set; } + /// + /// When Stryker finds two or more project references inside your test project, it needs to know which project should be mutated. Pass the name of this project. + /// + public virtual string ProjectFile { get; internal set; } + /// + /// Stryker supports dotnet test, the commandline testrunner and VsTest, the visual studio testrunner. VsTest is the default because it offers tight integration with all test frameworks (MsTest, xUnit, NUnit etc). Dotnet test can be used if VsTest causes issues for some reason. Please also submit an issue with us if you experience difficulties with VsTest. + /// + public virtual StrykerNetTestRunner TestRunner { get; internal set; } + /// + /// Some mutations can create endless loops inside your code. To detect and stop these loops, Stryker cancels a unit test run after a set time. Using this parameter you can increase or decrease the time before a test will time out. + /// + public virtual int? Timeout { get; internal set; } + /// + /// Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null + /// + public virtual IReadOnlyList TestProjects => TestProjectsInternal.AsReadOnly(); + internal List TestProjectsInternal { get; set; } = new List(); + /// + /// To gain more insight in what Stryker does during a mutation testrun you can lower your loglevel. + /// + public virtual StrykerNetLogLevel LogLevel { get; internal set; } + /// + /// When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace + /// + public virtual bool? LogFile { get; internal set; } + /// + /// By default Stryker.NET will use as much CPU power as you allow it to use during a mutation testrun. You can lower this setting to lower your CPU usage. This setting can also be used to disable parallel testing. This can be useful if your test project cannot handle parallel testruns. Default: your number of logical processors / 2 + /// + public virtual int? MaxConcurrentTestRunners { get; internal set; } + /// + /// Default: 80. If you want to decide on your own mutation score thresholds. + /// + public virtual int? ThresholdHigh { get; internal set; } + /// + /// Default: 60. If you want to decide on your own mutation score thresholds. + /// + public virtual int? ThresholdLow { get; internal set; } + /// + /// Default: 0. If you want to decide on your own mutation score thresholds. + /// + public virtual int? ThresholdBreak { get; internal set; } + /// + /// If you deem some mutations unwanted for your project you can disable mutations. + /// + public virtual IReadOnlyList ExcludedMutations => ExcludedMutationsInternal.AsReadOnly(); + internal List ExcludedMutationsInternal { get; set; } = new List(); + /// + /// To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included. + /// + public virtual IReadOnlyList Mutate => MutateInternal.AsReadOnly(); + internal List MutateInternal { get; set; } = new List(); + /// + /// If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters. + /// + public virtual IReadOnlyList IgnoreMethods => IgnoreMethodsInternal.AsReadOnly(); + internal List IgnoreMethodsInternal { get; set; } = new List(); + /// + /// Path to configuration file. If you want to integrate these settings in your existing settings json, make sure the section is called stryker-config. + /// + public virtual string ConfigFilePath { get; internal set; } + /// + /// Use coverage info to speed up execution. + /// + public virtual StrykerNetCoverage CoverageAnalysis { get; internal set; } + /// + /// Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time. + /// + public virtual bool? AbortTestOnFail { get; internal set; } + /// + /// Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default. + /// + public virtual bool? Diff { get; internal set; } + /// + /// Sets the source branch to compare with the current code on file system, used for calculating the difference when --diff is enabled. + /// + public virtual string GitSource { get; internal set; } + /// + /// During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun. + /// + public virtual IReadOnlyList Reporters => ReportersInternal.AsReadOnly(); + internal List ReportersInternal { get; set; } = new List(); + /// + /// Get your api key at stryker dashboard. To keep your api key safe, store it in an encrypted variable in your pipeline. + /// + public virtual string DashboardApiKey { get; internal set; } + /// + /// The name registered with the dashboard. It is in the form of gitProvider/organization/repository. At the moment the dashboard backend only supports github.com as a git provider, but we will also support gitlab.com/bitbucket.org, etc in the future. It can have an indefinite number of levels. Slashes (/) in this name are not escaped. For example github.com/stryker-mutator/stryker-net. + /// + public virtual string DashboardProject { get; internal set; } + /// + /// The version of the report. This should be filled with the branch name, git tag or git sha (although no validation is done). You can override a report of a specific version, like docker tags. Slashes in the version should not be encoded. For example, it's valid to use "feat/logging". + /// + public virtual string DashboardVersion { get; internal set; } + /// + /// Optional. If you want to store multiple reports for a version, you can use this value to separate them logically. For example, in a mono-repo setup where each package (or project or module) delivers a report. + /// + public virtual string DashboardModule { get; internal set; } + protected override Arguments ConfigureArguments(Arguments arguments) + { + arguments + .Add("--solution-path {value}", SolutionPath) + .Add("--project-file {value}", ProjectFile) + .Add("--test-runner {value}", TestRunner) + .Add("--timeout-ms {value}", Timeout) + .Add("--test-projects {value}", GetTestProjects(), customValue: true) + .Add("--log-level {value}", LogLevel) + .Add("--log-file", LogFile) + .Add("--max-concurrent-test-runners {value}", MaxConcurrentTestRunners) + .Add("--threshold-high {value}", ThresholdHigh) + .Add("--threshold-low {value}", ThresholdLow) + .Add("--threshold-break {value}", ThresholdBreak) + .Add("--excluded-mutations {value}", GetExcludedMutations(), customValue: true) + .Add("--mutate {value}", GetMutate(), customValue: true) + .Add("--ignore-methods {value}", GetIgnoreMethods(), customValue: true) + .Add("--config-file-path {value}", ConfigFilePath) + .Add("--coverage-analysis {value}", CoverageAnalysis) + .Add("--abort-test-on-fail", AbortTestOnFail) + .Add("--diff", Diff) + .Add("--git-source {value}", GitSource) + .Add("--reporters {value}", GetReporters(), customValue: true) + .Add("--dashboard-api-key {value}", DashboardApiKey, secret: true) + .Add("--dashboard-project {value}", DashboardProject) + .Add("--dashboard-project {value}", DashboardVersion) + .Add("--dashboard-module {value}", DashboardModule); + return base.ConfigureArguments(arguments); + } + } + #endregion + #region StrykerNetSettingsExtensions + /// + /// Used within . + /// + [PublicAPI] + [ExcludeFromCodeCoverage] + public static partial class StrykerNetSettingsExtensions + { + #region SolutionPath + /// + ///

Sets

+ ///

On .NET Framework projects Stryker needs your .sln file path.

+ ///
+ [Pure] + public static T SetSolutionPath(this T toolSettings, string solutionPath) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SolutionPath = solutionPath; + return toolSettings; + } + /// + ///

Resets

+ ///

On .NET Framework projects Stryker needs your .sln file path.

+ ///
+ [Pure] + public static T ResetSolutionPath(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.SolutionPath = null; + return toolSettings; + } + #endregion + #region ProjectFile + /// + ///

Sets

+ ///

When Stryker finds two or more project references inside your test project, it needs to know which project should be mutated. Pass the name of this project.

+ ///
+ [Pure] + public static T SetProjectFile(this T toolSettings, string projectFile) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ProjectFile = projectFile; + return toolSettings; + } + /// + ///

Resets

+ ///

When Stryker finds two or more project references inside your test project, it needs to know which project should be mutated. Pass the name of this project.

+ ///
+ [Pure] + public static T ResetProjectFile(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ProjectFile = null; + return toolSettings; + } + #endregion + #region TestRunner + /// + ///

Sets

+ ///

Stryker supports dotnet test, the commandline testrunner and VsTest, the visual studio testrunner. VsTest is the default because it offers tight integration with all test frameworks (MsTest, xUnit, NUnit etc). Dotnet test can be used if VsTest causes issues for some reason. Please also submit an issue with us if you experience difficulties with VsTest.

+ ///
+ [Pure] + public static T SetTestRunner(this T toolSettings, StrykerNetTestRunner testRunner) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestRunner = testRunner; + return toolSettings; + } + /// + ///

Resets

+ ///

Stryker supports dotnet test, the commandline testrunner and VsTest, the visual studio testrunner. VsTest is the default because it offers tight integration with all test frameworks (MsTest, xUnit, NUnit etc). Dotnet test can be used if VsTest causes issues for some reason. Please also submit an issue with us if you experience difficulties with VsTest.

+ ///
+ [Pure] + public static T ResetTestRunner(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestRunner = null; + return toolSettings; + } + #endregion + #region Timeout + /// + ///

Sets

+ ///

Some mutations can create endless loops inside your code. To detect and stop these loops, Stryker cancels a unit test run after a set time. Using this parameter you can increase or decrease the time before a test will time out.

+ ///
+ [Pure] + public static T SetTimeout(this T toolSettings, int? timeout) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Timeout = timeout; + return toolSettings; + } + /// + ///

Resets

+ ///

Some mutations can create endless loops inside your code. To detect and stop these loops, Stryker cancels a unit test run after a set time. Using this parameter you can increase or decrease the time before a test will time out.

+ ///
+ [Pure] + public static T ResetTimeout(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Timeout = null; + return toolSettings; + } + #endregion + #region TestProjects + /// + ///

Sets to a new list

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T SetTestProjects(this T toolSettings, params string[] testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestProjectsInternal = testProjects.ToList(); + return toolSettings; + } + /// + ///

Sets to a new list

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T SetTestProjects(this T toolSettings, IEnumerable testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestProjectsInternal = testProjects.ToList(); + return toolSettings; + } + /// + ///

Adds values to

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T AddTestProjects(this T toolSettings, params string[] testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestProjectsInternal.AddRange(testProjects); + return toolSettings; + } + /// + ///

Adds values to

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T AddTestProjects(this T toolSettings, IEnumerable testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestProjectsInternal.AddRange(testProjects); + return toolSettings; + } + /// + ///

Clears

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T ClearTestProjects(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.TestProjectsInternal.Clear(); + return toolSettings; + } + /// + ///

Removes values from

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T RemoveTestProjects(this T toolSettings, params string[] testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(testProjects); + toolSettings.TestProjectsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

Removes values from

+ ///

Stryker can also be run from the directory containing the project under test. If you pass a list of test projects that reference the project under test, the tests of all projects will be run while testing the mutants. When running from a test project directory this option is not required. Default: null

+ ///
+ [Pure] + public static T RemoveTestProjects(this T toolSettings, IEnumerable testProjects) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(testProjects); + toolSettings.TestProjectsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region LogLevel + /// + ///

Sets

+ ///

To gain more insight in what Stryker does during a mutation testrun you can lower your loglevel.

+ ///
+ [Pure] + public static T SetLogLevel(this T toolSettings, StrykerNetLogLevel logLevel) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogLevel = logLevel; + return toolSettings; + } + /// + ///

Resets

+ ///

To gain more insight in what Stryker does during a mutation testrun you can lower your loglevel.

+ ///
+ [Pure] + public static T ResetLogLevel(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogLevel = null; + return toolSettings; + } + #endregion + #region LogFile + /// + ///

Sets

+ ///

When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace

+ ///
+ [Pure] + public static T SetLogFile(this T toolSettings, bool? logFile) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogFile = logFile; + return toolSettings; + } + /// + ///

Resets

+ ///

When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace

+ ///
+ [Pure] + public static T ResetLogFile(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogFile = null; + return toolSettings; + } + /// + ///

Enables

+ ///

When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace

+ ///
+ [Pure] + public static T EnableLogFile(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogFile = true; + return toolSettings; + } + /// + ///

Disables

+ ///

When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace

+ ///
+ [Pure] + public static T DisableLogFile(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogFile = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

When creating an issue for Stryker.NET on github you can include a logfile. File logging always uses loglevel trace

+ ///
+ [Pure] + public static T ToggleLogFile(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.LogFile = !toolSettings.LogFile; + return toolSettings; + } + #endregion + #region MaxConcurrentTestRunners + /// + ///

Sets

+ ///

By default Stryker.NET will use as much CPU power as you allow it to use during a mutation testrun. You can lower this setting to lower your CPU usage. This setting can also be used to disable parallel testing. This can be useful if your test project cannot handle parallel testruns. Default: your number of logical processors / 2

+ ///
+ [Pure] + public static T SetMaxConcurrentTestRunners(this T toolSettings, int? maxConcurrentTestRunners) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MaxConcurrentTestRunners = maxConcurrentTestRunners; + return toolSettings; + } + /// + ///

Resets

+ ///

By default Stryker.NET will use as much CPU power as you allow it to use during a mutation testrun. You can lower this setting to lower your CPU usage. This setting can also be used to disable parallel testing. This can be useful if your test project cannot handle parallel testruns. Default: your number of logical processors / 2

+ ///
+ [Pure] + public static T ResetMaxConcurrentTestRunners(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MaxConcurrentTestRunners = null; + return toolSettings; + } + #endregion + #region ThresholdHigh + /// + ///

Sets

+ ///

Default: 80. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T SetThresholdHigh(this T toolSettings, int? thresholdHigh) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdHigh = thresholdHigh; + return toolSettings; + } + /// + ///

Resets

+ ///

Default: 80. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T ResetThresholdHigh(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdHigh = null; + return toolSettings; + } + #endregion + #region ThresholdLow + /// + ///

Sets

+ ///

Default: 60. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T SetThresholdLow(this T toolSettings, int? thresholdLow) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdLow = thresholdLow; + return toolSettings; + } + /// + ///

Resets

+ ///

Default: 60. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T ResetThresholdLow(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdLow = null; + return toolSettings; + } + #endregion + #region ThresholdBreak + /// + ///

Sets

+ ///

Default: 0. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T SetThresholdBreak(this T toolSettings, int? thresholdBreak) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdBreak = thresholdBreak; + return toolSettings; + } + /// + ///

Resets

+ ///

Default: 0. If you want to decide on your own mutation score thresholds.

+ ///
+ [Pure] + public static T ResetThresholdBreak(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ThresholdBreak = null; + return toolSettings; + } + #endregion + #region ExcludedMutations + /// + ///

Sets to a new list

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T SetExcludedMutations(this T toolSettings, params string[] excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExcludedMutationsInternal = excludedMutations.ToList(); + return toolSettings; + } + /// + ///

Sets to a new list

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T SetExcludedMutations(this T toolSettings, IEnumerable excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExcludedMutationsInternal = excludedMutations.ToList(); + return toolSettings; + } + /// + ///

Adds values to

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T AddExcludedMutations(this T toolSettings, params string[] excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExcludedMutationsInternal.AddRange(excludedMutations); + return toolSettings; + } + /// + ///

Adds values to

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T AddExcludedMutations(this T toolSettings, IEnumerable excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExcludedMutationsInternal.AddRange(excludedMutations); + return toolSettings; + } + /// + ///

Clears

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T ClearExcludedMutations(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ExcludedMutationsInternal.Clear(); + return toolSettings; + } + /// + ///

Removes values from

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T RemoveExcludedMutations(this T toolSettings, params string[] excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(excludedMutations); + toolSettings.ExcludedMutationsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

Removes values from

+ ///

If you deem some mutations unwanted for your project you can disable mutations.

+ ///
+ [Pure] + public static T RemoveExcludedMutations(this T toolSettings, IEnumerable excludedMutations) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(excludedMutations); + toolSettings.ExcludedMutationsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region Mutate + /// + ///

Sets to a new list

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T SetMutate(this T toolSettings, params string[] mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MutateInternal = mutate.ToList(); + return toolSettings; + } + /// + ///

Sets to a new list

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T SetMutate(this T toolSettings, IEnumerable mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MutateInternal = mutate.ToList(); + return toolSettings; + } + /// + ///

Adds values to

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T AddMutate(this T toolSettings, params string[] mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MutateInternal.AddRange(mutate); + return toolSettings; + } + /// + ///

Adds values to

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T AddMutate(this T toolSettings, IEnumerable mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MutateInternal.AddRange(mutate); + return toolSettings; + } + /// + ///

Clears

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T ClearMutate(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.MutateInternal.Clear(); + return toolSettings; + } + /// + ///

Removes values from

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T RemoveMutate(this T toolSettings, params string[] mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(mutate); + toolSettings.MutateInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

Removes values from

+ ///

To specify which files should be mutated you can use file pattern to in- or excluded files or even only parts of a files. By default all files are included.

+ ///
+ [Pure] + public static T RemoveMutate(this T toolSettings, IEnumerable mutate) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(mutate); + toolSettings.MutateInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region IgnoreMethods + /// + ///

Sets to a new list

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T SetIgnoreMethods(this T toolSettings, params string[] ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.IgnoreMethodsInternal = ignoreMethods.ToList(); + return toolSettings; + } + /// + ///

Sets to a new list

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T SetIgnoreMethods(this T toolSettings, IEnumerable ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.IgnoreMethodsInternal = ignoreMethods.ToList(); + return toolSettings; + } + /// + ///

Adds values to

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T AddIgnoreMethods(this T toolSettings, params string[] ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.IgnoreMethodsInternal.AddRange(ignoreMethods); + return toolSettings; + } + /// + ///

Adds values to

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T AddIgnoreMethods(this T toolSettings, IEnumerable ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.IgnoreMethodsInternal.AddRange(ignoreMethods); + return toolSettings; + } + /// + ///

Clears

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T ClearIgnoreMethods(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.IgnoreMethodsInternal.Clear(); + return toolSettings; + } + /// + ///

Removes values from

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T RemoveIgnoreMethods(this T toolSettings, params string[] ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(ignoreMethods); + toolSettings.IgnoreMethodsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

Removes values from

+ ///

If you would like to ignore some mutations that are passed as method parameters, you can do so by specifying which methods to ignore. Ignore methods will only affect mutations in directly passed parameters.

+ ///
+ [Pure] + public static T RemoveIgnoreMethods(this T toolSettings, IEnumerable ignoreMethods) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(ignoreMethods); + toolSettings.IgnoreMethodsInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region ConfigFilePath + /// + ///

Sets

+ ///

Path to configuration file. If you want to integrate these settings in your existing settings json, make sure the section is called stryker-config.

+ ///
+ [Pure] + public static T SetConfigFilePath(this T toolSettings, string configFilePath) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFilePath = configFilePath; + return toolSettings; + } + /// + ///

Resets

+ ///

Path to configuration file. If you want to integrate these settings in your existing settings json, make sure the section is called stryker-config.

+ ///
+ [Pure] + public static T ResetConfigFilePath(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ConfigFilePath = null; + return toolSettings; + } + #endregion + #region CoverageAnalysis + /// + ///

Sets

+ ///

Use coverage info to speed up execution.

+ ///
+ [Pure] + public static T SetCoverageAnalysis(this T toolSettings, StrykerNetCoverage coverageAnalysis) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CoverageAnalysis = coverageAnalysis; + return toolSettings; + } + /// + ///

Resets

+ ///

Use coverage info to speed up execution.

+ ///
+ [Pure] + public static T ResetCoverageAnalysis(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.CoverageAnalysis = null; + return toolSettings; + } + #endregion + #region AbortTestOnFail + /// + ///

Sets

+ ///

Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time.

+ ///
+ [Pure] + public static T SetAbortTestOnFail(this T toolSettings, bool? abortTestOnFail) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.AbortTestOnFail = abortTestOnFail; + return toolSettings; + } + /// + ///

Resets

+ ///

Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time.

+ ///
+ [Pure] + public static T ResetAbortTestOnFail(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.AbortTestOnFail = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time.

+ ///
+ [Pure] + public static T EnableAbortTestOnFail(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.AbortTestOnFail = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time.

+ ///
+ [Pure] + public static T DisableAbortTestOnFail(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.AbortTestOnFail = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Abort unit testrun as soon as any one unit test fails. This can reduce the overall running time.

+ ///
+ [Pure] + public static T ToggleAbortTestOnFail(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.AbortTestOnFail = !toolSettings.AbortTestOnFail; + return toolSettings; + } + #endregion + #region Diff + /// + ///

Sets

+ ///

Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default.

+ ///
+ [Pure] + public static T SetDiff(this T toolSettings, bool? diff) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Diff = diff; + return toolSettings; + } + /// + ///

Resets

+ ///

Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default.

+ ///
+ [Pure] + public static T ResetDiff(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Diff = null; + return toolSettings; + } + /// + ///

Enables

+ ///

Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default.

+ ///
+ [Pure] + public static T EnableDiff(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Diff = true; + return toolSettings; + } + /// + ///

Disables

+ ///

Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default.

+ ///
+ [Pure] + public static T DisableDiff(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Diff = false; + return toolSettings; + } + /// + ///

Toggles

+ ///

Enables the diff feature. It makes sure to only mutate changed files. Gets the diff from git by default.

+ ///
+ [Pure] + public static T ToggleDiff(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.Diff = !toolSettings.Diff; + return toolSettings; + } + #endregion + #region GitSource + /// + ///

Sets

+ ///

Sets the source branch to compare with the current code on file system, used for calculating the difference when --diff is enabled.

+ ///
+ [Pure] + public static T SetGitSource(this T toolSettings, string gitSource) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.GitSource = gitSource; + return toolSettings; + } + /// + ///

Resets

+ ///

Sets the source branch to compare with the current code on file system, used for calculating the difference when --diff is enabled.

+ ///
+ [Pure] + public static T ResetGitSource(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.GitSource = null; + return toolSettings; + } + #endregion + #region Reporters + /// + ///

Sets to a new list

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T SetReporters(this T toolSettings, params StrykerNetReporter[] reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ReportersInternal = reporters.ToList(); + return toolSettings; + } + /// + ///

Sets to a new list

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T SetReporters(this T toolSettings, IEnumerable reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ReportersInternal = reporters.ToList(); + return toolSettings; + } + /// + ///

Adds values to

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T AddReporters(this T toolSettings, params StrykerNetReporter[] reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ReportersInternal.AddRange(reporters); + return toolSettings; + } + /// + ///

Adds values to

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T AddReporters(this T toolSettings, IEnumerable reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ReportersInternal.AddRange(reporters); + return toolSettings; + } + /// + ///

Clears

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T ClearReporters(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.ReportersInternal.Clear(); + return toolSettings; + } + /// + ///

Removes values from

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T RemoveReporters(this T toolSettings, params StrykerNetReporter[] reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(reporters); + toolSettings.ReportersInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + /// + ///

Removes values from

+ ///

During a mutation testrun one or more reporters can be enabled. A reporter will produce some kind of output during or after the mutation testrun.

+ ///
+ [Pure] + public static T RemoveReporters(this T toolSettings, IEnumerable reporters) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + var hashSet = new HashSet(reporters); + toolSettings.ReportersInternal.RemoveAll(x => hashSet.Contains(x)); + return toolSettings; + } + #endregion + #region DashboardApiKey + /// + ///

Sets

+ ///

Get your api key at stryker dashboard. To keep your api key safe, store it in an encrypted variable in your pipeline.

+ ///
+ [Pure] + public static T SetDashboardApiKey(this T toolSettings, string dashboardApiKey) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardApiKey = dashboardApiKey; + return toolSettings; + } + /// + ///

Resets

+ ///

Get your api key at stryker dashboard. To keep your api key safe, store it in an encrypted variable in your pipeline.

+ ///
+ [Pure] + public static T ResetDashboardApiKey(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardApiKey = null; + return toolSettings; + } + #endregion + #region DashboardProject + /// + ///

Sets

+ ///

The name registered with the dashboard. It is in the form of gitProvider/organization/repository. At the moment the dashboard backend only supports github.com as a git provider, but we will also support gitlab.com/bitbucket.org, etc in the future. It can have an indefinite number of levels. Slashes (/) in this name are not escaped. For example github.com/stryker-mutator/stryker-net.

+ ///
+ [Pure] + public static T SetDashboardProject(this T toolSettings, string dashboardProject) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardProject = dashboardProject; + return toolSettings; + } + /// + ///

Resets

+ ///

The name registered with the dashboard. It is in the form of gitProvider/organization/repository. At the moment the dashboard backend only supports github.com as a git provider, but we will also support gitlab.com/bitbucket.org, etc in the future. It can have an indefinite number of levels. Slashes (/) in this name are not escaped. For example github.com/stryker-mutator/stryker-net.

+ ///
+ [Pure] + public static T ResetDashboardProject(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardProject = null; + return toolSettings; + } + #endregion + #region DashboardVersion + /// + ///

Sets

+ ///

The version of the report. This should be filled with the branch name, git tag or git sha (although no validation is done). You can override a report of a specific version, like docker tags. Slashes in the version should not be encoded. For example, it's valid to use "feat/logging".

+ ///
+ [Pure] + public static T SetDashboardVersion(this T toolSettings, string dashboardVersion) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardVersion = dashboardVersion; + return toolSettings; + } + /// + ///

Resets

+ ///

The version of the report. This should be filled with the branch name, git tag or git sha (although no validation is done). You can override a report of a specific version, like docker tags. Slashes in the version should not be encoded. For example, it's valid to use "feat/logging".

+ ///
+ [Pure] + public static T ResetDashboardVersion(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardVersion = null; + return toolSettings; + } + #endregion + #region DashboardModule + /// + ///

Sets

+ ///

Optional. If you want to store multiple reports for a version, you can use this value to separate them logically. For example, in a mono-repo setup where each package (or project or module) delivers a report.

+ ///
+ [Pure] + public static T SetDashboardModule(this T toolSettings, string dashboardModule) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardModule = dashboardModule; + return toolSettings; + } + /// + ///

Resets

+ ///

Optional. If you want to store multiple reports for a version, you can use this value to separate them logically. For example, in a mono-repo setup where each package (or project or module) delivers a report.

+ ///
+ [Pure] + public static T ResetDashboardModule(this T toolSettings) where T : StrykerNetSettings + { + toolSettings = toolSettings.NewInstance(); + toolSettings.DashboardModule = null; + return toolSettings; + } + #endregion + } + #endregion + #region StrykerNetTestRunner + /// + /// Used within . + /// + [PublicAPI] + [Serializable] + [ExcludeFromCodeCoverage] + [TypeConverter(typeof(TypeConverter))] + public partial class StrykerNetTestRunner : Enumeration + { + public static StrykerNetTestRunner vstest = (StrykerNetTestRunner) "vstest"; + public static StrykerNetTestRunner dotnettest = (StrykerNetTestRunner) "dotnettest"; + public static explicit operator StrykerNetTestRunner(string value) + { + return new StrykerNetTestRunner { Value = value }; + } + } + #endregion + #region StrykerNetReporter + /// + /// Used within . + /// + [PublicAPI] + [Serializable] + [ExcludeFromCodeCoverage] + [TypeConverter(typeof(TypeConverter))] + public partial class StrykerNetReporter : Enumeration + { + public static StrykerNetReporter html = (StrykerNetReporter) "html"; + public static StrykerNetReporter progress = (StrykerNetReporter) "progress"; + public static StrykerNetReporter dashboard = (StrykerNetReporter) "dashboard"; + public static StrykerNetReporter cleartext = (StrykerNetReporter) "cleartext"; + public static StrykerNetReporter dots = (StrykerNetReporter) "dots"; + public static StrykerNetReporter json = (StrykerNetReporter) "json"; + public static explicit operator StrykerNetReporter(string value) + { + return new StrykerNetReporter { Value = value }; + } + } + #endregion + #region StrykerNetCoverage + /// + /// Used within . + /// + [PublicAPI] + [Serializable] + [ExcludeFromCodeCoverage] + [TypeConverter(typeof(TypeConverter))] + public partial class StrykerNetCoverage : Enumeration + { + public static StrykerNetCoverage off = (StrykerNetCoverage) "off"; + public static StrykerNetCoverage perTest = (StrykerNetCoverage) "perTest"; + public static StrykerNetCoverage all = (StrykerNetCoverage) "all"; + public static StrykerNetCoverage perTestInIsolation = (StrykerNetCoverage) "perTestInIsolation"; + public static explicit operator StrykerNetCoverage(string value) + { + return new StrykerNetCoverage { Value = value }; + } + } + #endregion + #region StrykerNetLogLevel + /// + /// Used within . + /// + [PublicAPI] + [Serializable] + [ExcludeFromCodeCoverage] + [TypeConverter(typeof(TypeConverter))] + public partial class StrykerNetLogLevel : Enumeration + { + public static StrykerNetLogLevel error = (StrykerNetLogLevel) "error"; + public static StrykerNetLogLevel warning = (StrykerNetLogLevel) "warning"; + public static StrykerNetLogLevel info = (StrykerNetLogLevel) "info"; + public static StrykerNetLogLevel debug = (StrykerNetLogLevel) "debug"; + public static StrykerNetLogLevel trace = (StrykerNetLogLevel) "trace"; + public static explicit operator StrykerNetLogLevel(string value) + { + return new StrykerNetLogLevel { Value = value }; + } + } + #endregion +} diff --git a/source/Nuke.Common/Tools/StrykerNet/StrykerNetSettings.cs b/source/Nuke.Common/Tools/StrykerNet/StrykerNetSettings.cs new file mode 100644 index 000000000..c217c6d90 --- /dev/null +++ b/source/Nuke.Common/Tools/StrykerNet/StrykerNetSettings.cs @@ -0,0 +1,41 @@ +using System.Linq; + +namespace Nuke.Common.Tools.StrykerNet +{ + public partial class StrykerNetSettings { + private string GetTestProjects() + { + if (!TestProjectsInternal.Any()) + return null; + return $"\"['{string.Join("', '", TestProjectsInternal)}']\""; + } + + private string GetExcludedMutations() + { + if (!ExcludedMutationsInternal.Any()) + return null; + return $"\"['{string.Join("', '", ExcludedMutationsInternal)}']\""; + } + + private string GetMutate() + { + if (!MutateInternal.Any()) + return null; + return $"\"['{string.Join("', '", MutateInternal)}']\""; + } + + private string GetIgnoreMethods() + { + if (!IgnoreMethodsInternal.Any()) + return null; + return $"\"['{string.Join("', '", IgnoreMethodsInternal)}']\""; + } + + private string GetReporters() + { + if (!ReportersInternal.Any()) + return null; + return $"\"['{string.Join("', '", ReportersInternal)}']\""; + } + } +} \ No newline at end of file