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:
Bryan 2015-12-30 17:02:59 -08:00
parent 697e99ea6e
commit 18d17ce8c5
11 changed files with 486 additions and 78 deletions

View file

@ -0,0 +1,84 @@
// 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 System;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Tools.Test.Utilities;
namespace Microsoft.DotNet.Tools.Test.Utilities
{
public sealed class PackCommand : TestCommand
{
private string _projectPath;
private string _outputDirectory;
private string _tempOutputDirectory;
private string _configuration;
private string _versionSuffix;
private string OutputOption
{
get
{
return _outputDirectory == string.Empty ?
"" :
$"-o {_outputDirectory}";
}
}
private string TempOutputOption
{
get
{
return _tempOutputDirectory == string.Empty ?
"" :
$"-t {_tempOutputDirectory}";
}
}
private string ConfigurationOption
{
get
{
return _configuration == string.Empty ?
"" :
$"-c {_configuration}";
}
}
private string VersionSuffixOption
{
get
{
return _versionSuffix == string.Empty ?
"" :
$"--version-suffix {_versionSuffix}";
}
}
public PackCommand(
string projectPath,
string output="",
string tempOutput="",
string configuration="",
string versionSuffix="")
: base("dotnet")
{
_projectPath = projectPath;
_outputDirectory = output;
_tempOutputDirectory = tempOutput;
_configuration = configuration;
_versionSuffix = versionSuffix;
}
public override CommandResult Execute(string args = "")
{
args = $"pack {BuildArgs()} {args}";
return base.Execute(args);
}
private string BuildArgs()
{
return $"{_projectPath} {OutputOption} {TempOutputOption} {ConfigurationOption} {VersionSuffixOption}";
}
}
}