Merge branch 'master' into tp-insert-0414

This commit is contained in:
Livar 2017-04-18 21:06:17 -07:00 committed by GitHub
commit 3f82e11a91
39 changed files with 315 additions and 263 deletions

View file

@ -38,9 +38,9 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
return this;
}
public PublishCommand WithTargetManifest(string target)
public PublishCommand WithTargetManifest(string manifest)
{
_targetManifests.Add( $"--target {target}");
_targetManifests.Add( $"--manifest {manifest}");
return this;
}

View file

@ -78,6 +78,24 @@ namespace Microsoft.DotNet.Cli.Build.Tests
.Should().Pass();
}
[RequiresSpecificFrameworkFact("netcoreapp1.0")] // https://github.com/dotnet/cli/issues/6087
public void ItRunsABackwardsVersionedTool()
{
var testInstance = TestAssets.Get("11TestAppWith10CLIToolReferences")
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var testProjectDirectory = testInstance.Root;
new DotnetCommand(DotnetUnderTest.WithBackwardsCompatibleRuntimes)
.WithWorkingDirectory(testInstance.Root)
.ExecuteWithCapturedOutput("outputsframeworkversion-netcoreapp1.0")
.Should()
.Pass()
.And
.HaveStdOutContaining("netcoreapp1.0");
}
void ChangeProjectTargetFramework(FileInfo projectFile, string target)
{

View file

@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--target", "<targetfiles>" }, "/p:TargetManifestFiles=<targetfiles>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "/p:TargetManifestFiles=<manifestfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "<project>" }, "<project>")]
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
[InlineData(new string[] { "-c", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--configuration", "<config>" }, "/p:Configuration=<config>")]
[InlineData(new string[] { "--version-suffix", "<versionsuffix>" }, "/p:VersionSuffix=<versionsuffix>")]
[InlineData(new string[] { "--target", "<targetfiles>" }, "/p:TargetManifestFiles=<targetfiles>")]
[InlineData(new string[] { "--manifest", "<manifestfiles>" }, "/p:TargetManifestFiles=<manifestfiles>")]
[InlineData(new string[] { "-v", "minimal" }, "/verbosity:minimal")]
[InlineData(new string[] { "--verbosity", "minimal" }, "/verbosity:minimal")]
public void OptionForwardingIsCorrect(string[] args, string expectedAdditionalArgs)

View file

@ -181,5 +181,24 @@ namespace Microsoft.DotNet.Cli.Run.Tests
.Should().Fail()
.And.HaveStdErrContaining("--framework");
}
[Fact]
public void ItCanPassArgumentsToSubjectAppByDoubleDash()
{
const string testAppName = "MSBuildTestApp";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
.WithSourceFiles()
.WithRestoreFiles();
var testProjectDirectory = testInstance.Root.FullName;
new RunCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput("-- foo bar baz")
.Should()
.Pass()
.And.HaveStdOutContaining("echo args:foo;bar;baz");
}
}
}

View file

@ -72,6 +72,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
{
var testAppName = "NewtonSoftDependentProject";
var profileProjectName = "NewtonsoftProfile";
var targetManifestFileName = "NewtonsoftFilterProfile.xml";
var testInstance = TestAssets.Get(testAppName)
.CreateInstance()
@ -80,7 +81,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
var testProjectDirectory = testInstance.Root.ToString();
var profileProjectPath = TestAssets.Get(profileProjectName).Root.FullName;
var profileFilter = Path.Combine(profileProjectPath, "NewtonsoftFilterProfile.xml");
var profileFilter = Path.Combine(profileProjectPath, targetManifestFileName);
new RestoreCommand()
.WithWorkingDirectory(testProjectDirectory)
@ -101,7 +102,7 @@ namespace Microsoft.DotNet.Cli.Publish.Tests
new DotnetCommand()
.ExecuteWithCapturedOutput(outputDll)
.Should().Fail()
.And.HaveStdErrContaining("assembly specified in the dependencies manifest was not found -- package: 'Newtonsoft.Json',");
.And.HaveStdErrContaining($"Error: assembly specified in the dependencies manifest was not found probably due to missing runtime store associated with {targetManifestFileName} -- package: 'Newtonsoft.Json',");
}
[Fact]

View file

@ -0,0 +1,29 @@
// 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.Linq;
using FluentAssertions;
using Microsoft.DotNet.Tools.Run;
using Xunit;
using Xunit.Abstractions;
using System;
namespace Microsoft.DotNet.Tests.ParserTests
{
public class RunParserTests
{
public RunParserTests(ITestOutputHelper output)
{
this.output = output;
}
private readonly ITestOutputHelper output;
[Fact]
public void RunParserCanGetArguementFromDoubleDash()
{
var runCommand = RunCommand.FromArgs(new[]{ "--", "foo" });
runCommand.Args.Single().Should().Be("foo");
}
}
}