split parser definitions across multiple files
This commit is contained in:
parent
8b0dd3579c
commit
5f227c1c45
26 changed files with 757 additions and 602 deletions
57
test/dotnet.Tests/ParserTests/AddReferenceParserTests.cs
Normal file
57
test/dotnet.Tests/ParserTests/AddReferenceParserTests.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
// 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 System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Microsoft.DotNet.Tools.Common;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Parser = Microsoft.DotNet.Cli.Parser;
|
||||
|
||||
namespace Microsoft.DotNet.Tests.ParserTests
|
||||
{
|
||||
public class AddReferenceParserTests
|
||||
{
|
||||
private readonly ITestOutputHelper output;
|
||||
|
||||
public AddReferenceParserTests(ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddReferenceHasDefaultArgumentSetToCurrentDirectory()
|
||||
{
|
||||
var command = Parser.DotnetCommand;
|
||||
|
||||
var result = command.Parse("dotnet add reference my.csproj");
|
||||
|
||||
output.WriteLine(result.Diagram());
|
||||
|
||||
result["dotnet"]["add"]
|
||||
.Arguments
|
||||
.Should()
|
||||
.BeEquivalentTo(
|
||||
PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddReferenceWithoutArgumentResultsInAnError()
|
||||
{
|
||||
var command = Parser.DotnetCommand;
|
||||
|
||||
var result = command.Parse("dotnet add reference");
|
||||
|
||||
output.WriteLine(result.Diagram());
|
||||
|
||||
result
|
||||
.Errors
|
||||
.Select(e => e.Message)
|
||||
.Should()
|
||||
.BeEquivalentTo("Required argument missing for command: reference");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue