Make --no-build imply --no-restore for pack command.

This commit makes the `--no-build` option for the pack command
automatically imply `--no-restore`.

Fixes issue #7472.
This commit is contained in:
Peter Huene 2017-11-27 21:01:26 -08:00
parent de10b22bcd
commit 40b0e0fcec
18 changed files with 57 additions and 29 deletions

View file

@ -12,6 +12,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
public class GivenDotnetPackInvocation
{
const string ExpectedPrefix = "exec <msbuildpath> /m /v:m /restore /t:pack";
const string ExpectedNoBuildPrefix = "exec <msbuildpath> /m /v:m /t:pack";
[Theory]
[InlineData(new string[] { }, "")]
@ -34,9 +35,10 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
var msbuildPath = "<msbuildpath>";
var command = PackCommand.FromArgs(args, msbuildPath);
var expectedPrefix = args.FirstOrDefault() == "--no-build" ? ExpectedNoBuildPrefix : ExpectedPrefix;
command.SeparateRestoreCommand.Should().BeNull();
command.GetProcessStartInfo().Arguments.Should().Be($"{ExpectedPrefix}{expectedAdditionalArgs}");
command.GetProcessStartInfo().Arguments.Should().Be($"{expectedPrefix}{expectedAdditionalArgs}");
}
}
}