diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs index a89025016..838597d86 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/AddReferenceCommand.cs @@ -5,15 +5,10 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class AddReferenceCommand : TestCommand + public sealed class AddReferenceCommand : DotnetCommand { private string _projectName = null; - public AddReferenceCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"add {_projectName} reference {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildCommand.cs index 48b411471..86d22bbb1 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/BuildCommand.cs @@ -7,7 +7,7 @@ using NuGet.Frameworks; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class BuildCommand : TestCommand + public sealed class BuildCommand : DotnetCommand { private bool _captureOutput; @@ -26,11 +26,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities private DirectoryInfo _workingDirectory; - public BuildCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"build {GetNoDependencies()} {GetProjectFile()} {GetOutputPath()} {GetConfiguration()} {GetFramework()} {GetRuntime()} {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs index 08209f911..b6374b260 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CacheCommand.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class CacheCommand : TestCommand + public sealed class CacheCommand : DotnetCommand { private List _profileProject = new List(); private string _framework; @@ -16,11 +16,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities private string _frameworkVersion; private string _intermediateWorkingDirectory; - public CacheCommand() - : base("dotnet") - { - } - public CacheCommand WithEntries(string profileProject) { _profileProject.Add($"--entries {profileProject}"); diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs index 86e40f694..61d44dbf5 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/CleanCommand.cs @@ -7,13 +7,8 @@ using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class CleanCommand : TestCommand + public sealed class CleanCommand : DotnetCommand { - public CleanCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"clean {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs index 029538177..a045c8ae6 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DependencyToolInvokerCommand.cs @@ -7,13 +7,8 @@ using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { - public class DependencyToolInvokerCommand : TestCommand + public class DependencyToolInvokerCommand : DotnetCommand { - public DependencyToolInvokerCommand() - : base("dotnet") - { - } - public CommandResult Execute(string commandName, string framework, string additionalArgs) { var args = $"dependency-tool-invoker {commandName} --framework {framework} {additionalArgs}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs index 48dc47926..97bb41ab4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetCommand.cs @@ -5,7 +5,7 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class DotnetCommand : TestCommand + public class DotnetCommand : TestCommand { public DotnetCommand() : base(DotnetUnderTest.FullName) diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetTestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetTestCommand.cs index 8b67d2d6e..129080b8e 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetTestCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/DotnetTestCommand.cs @@ -5,14 +5,10 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public class DotnetTestCommand : TestCommand + public class DotnetTestCommand : DotnetCommand { private string _runtime; - public DotnetTestCommand() : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"test {GetRuntime()} {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs index d7d78a7d4..ce3948e61 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/HelpCommand.cs @@ -5,13 +5,8 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class HelpCommand : TestCommand + public sealed class HelpCommand : DotnetCommand { - public HelpCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"help {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs index 0dc5b5df3..4d7cb5b35 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/ListReferenceCommand.cs @@ -5,15 +5,10 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class ListReferenceCommand : TestCommand + public sealed class ListReferenceCommand : DotnetCommand { private string _projectName = null; - public ListReferenceCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"list {_projectName} reference {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MSBuildCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MSBuildCommand.cs index d24ec36f0..5f6a184bf 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MSBuildCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MSBuildCommand.cs @@ -5,13 +5,8 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class MSBuildCommand : TestCommand + public sealed class MSBuildCommand : DotnetCommand { - public MSBuildCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"msbuild {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MigrateCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MigrateCommand.cs index e3e87fd0e..63398ce7b 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MigrateCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/MigrateCommand.cs @@ -5,14 +5,8 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class MigrateCommand : TestCommand + public sealed class MigrateCommand : DotnetCommand { - public MigrateCommand() - : base("dotnet") - { - - } - public override CommandResult Execute(string args="") { args = $"migrate {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommand.cs index 951982dde..3e0e4d89f 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommand.cs @@ -5,14 +5,8 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class NewCommand : TestCommand + public sealed class NewCommand : DotnetCommand { - public NewCommand() - : base("dotnet") - { - - } - public override CommandResult Execute(string args = "") { args = $"new {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs index ff7b0bc15..8a6e28dcb 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/NewCommandShim.cs @@ -6,14 +6,8 @@ using Xunit; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class NewCommandShim : TestCommand + public sealed class NewCommandShim : DotnetCommand { - public NewCommandShim() - : base("dotnet") - { - - } - public override CommandResult Execute(string args = "") { args = $"new {args} --debug:ephemeral-hive"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs index 8a91d3780..f18af106a 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PackCommand.cs @@ -6,7 +6,7 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class PackCommand : TestCommand + public sealed class PackCommand : DotnetCommand { private string _projectPath; private string _outputDirectory; @@ -90,7 +90,6 @@ namespace Microsoft.DotNet.Tools.Test.Utilities string configuration="", string versionSuffix="", bool serviceable = false) - : base("dotnet") { _projectPath = projectPath; _outputDirectory = output; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs index 5bb0d01a6..e411e83f2 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/PublishCommand.cs @@ -7,18 +7,13 @@ using System.Collections.Generic; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class PublishCommand : TestCommand + public sealed class PublishCommand : DotnetCommand { private string _framework; private string _output; private string _runtime; private List _profileFilterProject = new List(); - - public PublishCommand() - : base("dotnet") - { - } - + public PublishCommand WithFramework(string framework) { _framework = framework; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs index 68107fce0..66c7b9bc4 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RemoveReferenceCommand.cs @@ -5,15 +5,10 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class RemoveReferenceCommand : TestCommand + public sealed class RemoveReferenceCommand : DotnetCommand { private string _projectName = null; - public RemoveReferenceCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"remove {_projectName} reference {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs index c0096101f..cc5804a1a 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RestoreCommand.cs @@ -5,15 +5,10 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class RestoreCommand : TestCommand + public sealed class RestoreCommand : DotnetCommand { private string _runtime; - public RestoreCommand() - : base("dotnet") - { - } - public RestoreCommand WithRuntime(string runtime) { _runtime = runtime; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs index d5596dc0e..81349a6c6 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/RunCommand.cs @@ -7,13 +7,8 @@ using System.Runtime.InteropServices; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class RunCommand : TestCommand + public sealed class RunCommand : DotnetCommand { - public RunCommand() - : base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"run {args}"; diff --git a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/VSTestCommand.cs b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/VSTestCommand.cs index b191a4231..38c340ee1 100644 --- a/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/VSTestCommand.cs +++ b/test/Microsoft.DotNet.Tools.Tests.Utilities/Commands/VSTestCommand.cs @@ -5,13 +5,8 @@ using Microsoft.DotNet.Cli.Utils; namespace Microsoft.DotNet.Tools.Test.Utilities { - public sealed class VSTestCommand: TestCommand + public sealed class VSTestCommand: DotnetCommand { - public VSTestCommand() - :base("dotnet") - { - } - public override CommandResult Execute(string args = "") { args = $"vstest {args}"; diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 256c92609..9f3b7f050 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -134,7 +134,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests // Call test with logger enable CommandResult result = new DotnetTestCommand() .WithWorkingDirectory(testProjectDirectory) - .ExecuteWithCapturedOutput("--logger:trx"); + .ExecuteWithCapturedOutput("--logger trx"); // Verify String[] trxFiles = Directory.GetFiles(trxLoggerDirectory, "*.trx");