use missing package test to verify correct package feed parsing
This commit is contained in:
parent
667f1cf018
commit
905db127a6
3 changed files with 33 additions and 8 deletions
|
@ -0,0 +1,11 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard1.5</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Something.Nonexistent" Version="1.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -42,7 +42,6 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
||||||
Type loggerType = typeof(MSBuildLogger);
|
Type loggerType = typeof(MSBuildLogger);
|
||||||
|
|
||||||
argsToForward = argsToForward
|
argsToForward = argsToForward
|
||||||
.Select(Escape)
|
|
||||||
.Concat(new[]
|
.Concat(new[]
|
||||||
{
|
{
|
||||||
$"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}"
|
$"/Logger:{loggerType.FullName},{loggerType.GetTypeInfo().Assembly.Location}"
|
||||||
|
@ -56,7 +55,7 @@ namespace Microsoft.DotNet.Tools.MSBuild
|
||||||
|
|
||||||
_forwardingApp = new ForwardingApp(
|
_forwardingApp = new ForwardingApp(
|
||||||
GetMSBuildExePath(),
|
GetMSBuildExePath(),
|
||||||
_msbuildRequiredParameters.Concat(argsToForward),
|
_msbuildRequiredParameters.Concat(argsToForward.Select(Escape)),
|
||||||
environmentVariables: _msbuildRequiredEnvironmentVariables);
|
environmentVariables: _msbuildRequiredEnvironmentVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,20 @@ using Microsoft.DotNet.Tools.MSBuild;
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
using NuGet.Protocol;
|
using NuGet.Protocol;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand;
|
using MSBuildCommand = Microsoft.DotNet.Tools.Test.Utilities.MSBuildCommand;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
||||||
{
|
{
|
||||||
public class GivenDotnetMSBuildBuildsProjects : TestBase
|
public class GivenDotnetMSBuildBuildsProjects : TestBase
|
||||||
{
|
{
|
||||||
|
private readonly ITestOutputHelper _output;
|
||||||
|
|
||||||
|
public GivenDotnetMSBuildBuildsProjects(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
_output = output;
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ItRunsSpecifiedTargetsWithPropertiesCorrectly()
|
public void ItRunsSpecifiedTargetsWithPropertiesCorrectly()
|
||||||
{
|
{
|
||||||
|
@ -86,19 +94,26 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
|
// this is a workaround for https://github.com/Microsoft/msbuild/issues/1622
|
||||||
var testInstance = TestAssets.Get("MSBuildTestApp")
|
var testInstance = TestAssets.Get("LibraryWithUnresolvablePackageReference")
|
||||||
.CreateInstance()
|
.CreateInstance()
|
||||||
.WithSourceFiles()
|
.WithSourceFiles();
|
||||||
.WithRestoreFiles();
|
|
||||||
|
|
||||||
var root = testInstance.Root;
|
var root = testInstance.Root;
|
||||||
var somePathThatExists = "/usr/local/bin";
|
var somePathThatExists = "/usr/local/bin";
|
||||||
|
|
||||||
var result = new DotnetCommand()
|
var result = new DotnetCommand()
|
||||||
.WithWorkingDirectory(root)
|
.WithWorkingDirectory(root)
|
||||||
.Execute($"msbuild /p:RestoreSources={somePathThatExists};https://api.nuget.org/v3/index.json /t:restore MSBuildTestApp.csproj");
|
.Execute($"msbuild /p:RestoreSources={somePathThatExists};https://api.nuget.org/v3/index.json /t:restore LibraryWithUnresolvablePackageReference.csproj");
|
||||||
|
|
||||||
result.Should().Pass();
|
_output.WriteLine($"[STDOUT]\n{result.StdOut}\n[STDERR]\n{result.StdErr}");
|
||||||
|
|
||||||
|
result.Should().Fail();
|
||||||
|
|
||||||
|
result.StdOut.Should()
|
||||||
|
.ContainVisuallySameFragment(
|
||||||
|
@"Feeds used:
|
||||||
|
/usr/local/bin
|
||||||
|
https://api.nuget.org/v3/index.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue