Move all test commands to DotNetCommand base
This commit is contained in:
parent
cb52224272
commit
fac34c7b3b
18 changed files with 19 additions and 107 deletions
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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<string> _profileProject = new List<string>();
|
||||
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}");
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<string> _profileFilterProject = new List<string>();
|
||||
|
||||
public PublishCommand()
|
||||
: base("dotnet")
|
||||
{
|
||||
}
|
||||
|
||||
public PublishCommand WithFramework(string framework)
|
||||
{
|
||||
_framework = framework;
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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}";
|
||||
|
|
Loading…
Reference in a new issue