dotnet-installer/test/dotnet.Tests/ParserTests/ListToolParserTests.cs
Peter Huene 60d71618be
Implement the --tool-path option for the list tool command.
This commit implements the missing `--tool-path` option for the list tool
command.  This enables the command to list locally installed tools.

Fixes #8803.
2018-03-20 16:54:50 -07:00

42 lines
1.3 KiB
C#

// 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.Cli;
using Microsoft.DotNet.Cli.CommandLine;
using Xunit;
using Xunit.Abstractions;
using Parser = Microsoft.DotNet.Cli.Parser;
namespace Microsoft.DotNet.Tests.ParserTests
{
public class ListToolParserTests
{
private readonly ITestOutputHelper output;
public ListToolParserTests(ITestOutputHelper output)
{
this.output = output;
}
[Fact]
public void ListToolParserCanGetGlobalOption()
{
var result = Parser.Instance.Parse("dotnet list tool -g");
var appliedOptions = result["dotnet"]["list"]["tool"];
appliedOptions.ValueOrDefault<bool>("global").Should().Be(true);
}
[Fact]
public void ListToolParserCanParseToolPathOption()
{
var result =
Parser.Instance.Parse(@"dotnet list tool --tool-path C:\Tools ");
var appliedOptions = result["dotnet"]["list"]["tool"];
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\Tools");
}
}
}