2017-03-08 00:40:18 +00:00
|
|
|
// 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 FluentAssertions;
|
|
|
|
using Microsoft.DotNet.Cli.CommandLine;
|
|
|
|
using Xunit;
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
using Parser = Microsoft.DotNet.Cli.Parser;
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Tests.ParserTests
|
|
|
|
{
|
|
|
|
public class RestoreParserTests
|
|
|
|
{
|
|
|
|
private readonly ITestOutputHelper output;
|
|
|
|
|
|
|
|
public RestoreParserTests(ITestOutputHelper output)
|
|
|
|
{
|
|
|
|
this.output = output;
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsSpecified()
|
|
|
|
{
|
2017-03-09 17:14:55 +00:00
|
|
|
var parser = Parser.Instance;
|
2017-03-08 00:40:18 +00:00
|
|
|
|
2017-03-09 17:14:55 +00:00
|
|
|
var result = parser.Parse(@"dotnet restore .\some.csproj --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true");
|
2017-03-08 00:40:18 +00:00
|
|
|
|
2017-03-09 17:14:55 +00:00
|
|
|
result["dotnet"]["restore"]
|
2017-03-08 00:40:18 +00:00
|
|
|
.Arguments
|
|
|
|
.Should()
|
|
|
|
.BeEquivalentTo(@".\some.csproj", @"/p:SkipInvalidConfigurations=true");
|
|
|
|
}
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
public void RestoreCapturesArgumentsToForwardToMSBuildWhenTargetIsNotSpecified()
|
|
|
|
{
|
2017-03-09 17:14:55 +00:00
|
|
|
var parser = Parser.Instance;
|
2017-03-08 00:40:18 +00:00
|
|
|
|
2017-03-09 17:14:55 +00:00
|
|
|
var result = parser.Parse(@"dotnet restore --packages c:\.nuget\packages /p:SkipInvalidConfigurations=true");
|
2017-03-08 00:40:18 +00:00
|
|
|
|
2017-03-09 17:14:55 +00:00
|
|
|
result["dotnet"]["restore"]
|
2017-03-08 00:40:18 +00:00
|
|
|
.Arguments
|
|
|
|
.Should()
|
|
|
|
.BeEquivalentTo(@"/p:SkipInvalidConfigurations=true");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|