End to End Test Refactoring. Build upon Publish Test Infrastructure and add
capability for further testing.s enter the commit message for your changes. Lines starting
This commit is contained in:
parent
697e99ea6e
commit
18d17ce8c5
11 changed files with 486 additions and 78 deletions
|
@ -0,0 +1,88 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class RunCommand : TestCommand
|
||||
{
|
||||
private string _projectPath;
|
||||
private string _framework;
|
||||
private string _configuration;
|
||||
private bool _preserveTemporary;
|
||||
private string _appArgs;
|
||||
|
||||
private string ProjectPathOption
|
||||
{
|
||||
get
|
||||
{
|
||||
return _projectPath == string.Empty ?
|
||||
"" :
|
||||
$"-p {_projectPath}";
|
||||
}
|
||||
}
|
||||
|
||||
private string FrameworkOption
|
||||
{
|
||||
get
|
||||
{
|
||||
return _framework == string.Empty ?
|
||||
"" :
|
||||
$"-f {_framework}";
|
||||
}
|
||||
}
|
||||
|
||||
private string ConfigurationOption
|
||||
{
|
||||
get
|
||||
{
|
||||
return _configuration == string.Empty ?
|
||||
"" :
|
||||
$"-c {_configuration}";
|
||||
}
|
||||
}
|
||||
|
||||
private string PreserveTemporaryOption
|
||||
{
|
||||
get
|
||||
{
|
||||
return _preserveTemporary ?
|
||||
$"-t {_projectPath}" :
|
||||
"";
|
||||
}
|
||||
}
|
||||
|
||||
private string AppArgsArgument
|
||||
{
|
||||
get { return _appArgs; }
|
||||
}
|
||||
|
||||
public RunCommand(
|
||||
string projectPath,
|
||||
string framework="",
|
||||
string configuration="",
|
||||
bool preserveTemporary=false,
|
||||
string appArgs="")
|
||||
: base("dotnet")
|
||||
{
|
||||
_projectPath = projectPath;
|
||||
_framework = framework;
|
||||
_configuration = configuration;
|
||||
_preserveTemporary = preserveTemporary;
|
||||
_appArgs = appArgs;
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"run {BuildArgs()} {args}";
|
||||
return base.Execute(args);
|
||||
}
|
||||
|
||||
private string BuildArgs()
|
||||
{
|
||||
return $"{ProjectPathOption} {FrameworkOption} {ConfigurationOption} {PreserveTemporaryOption} {AppArgsArgument}";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue