dotnet remove p2p -> dotnet remove reference
This commit is contained in:
parent
3ad9b72664
commit
528d37bda5
21 changed files with 31 additions and 31 deletions
|
@ -5,9 +5,9 @@ namespace Microsoft.DotNet.Tools.Remove.ProjectToProjectReference
|
|||
{
|
||||
internal class LocalizableStrings
|
||||
{
|
||||
public const string AppFullName = ".NET Remove Project to Project (p2p) reference Command";
|
||||
public const string AppFullName = ".NET Remove Project to Project reference Command";
|
||||
|
||||
public const string AppDescription = "Command to remove project to project (p2p) reference";
|
||||
public const string AppDescription = "Command to remove project to project reference";
|
||||
|
||||
public const string AppHelpText = "Project to project references to remove";
|
||||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Tools.Remove.ProjectToProjectReference
|
|||
{
|
||||
var command = new RemoveProjectToProjectReferenceCommand()
|
||||
{
|
||||
Name = "p2p",
|
||||
Name = "reference",
|
||||
FullName = LocalizableStrings.AppFullName,
|
||||
Description = LocalizableStrings.AppDescription,
|
||||
HandleRemainingArguments = true,
|
|
@ -5,22 +5,22 @@ using Microsoft.DotNet.Cli.Utils;
|
|||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public sealed class RemoveP2PCommand : TestCommand
|
||||
public sealed class RemoveReferenceCommand : TestCommand
|
||||
{
|
||||
private string _projectName = null;
|
||||
|
||||
public RemoveP2PCommand()
|
||||
public RemoveReferenceCommand()
|
||||
: base("dotnet")
|
||||
{
|
||||
}
|
||||
|
||||
public override CommandResult Execute(string args = "")
|
||||
{
|
||||
args = $"remove {_projectName} p2p {args}";
|
||||
args = $"remove {_projectName} reference {args}";
|
||||
return base.ExecuteWithCapturedOutput(args);
|
||||
}
|
||||
|
||||
public RemoveP2PCommand WithProject(string projectName)
|
||||
public RemoveReferenceCommand WithProject(string projectName)
|
||||
{
|
||||
_projectName = projectName;
|
||||
return this;
|
|
@ -9,13 +9,13 @@ using System;
|
|||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Remove.P2P.Tests
|
||||
namespace Microsoft.DotNet.Cli.Remove.Reference.Tests
|
||||
{
|
||||
public class GivenDotnetRemoveP2P : TestBase
|
||||
public class GivenDotnetRemoveReference : TestBase
|
||||
{
|
||||
private const string HelpText = @".NET Remove Project to Project (p2p) reference Command
|
||||
private const string HelpText = @".NET Remove Project to Project reference Command
|
||||
|
||||
Usage: dotnet remove <PROJECT> p2p [options] [args]
|
||||
Usage: dotnet remove <PROJECT> reference [options] [args]
|
||||
|
||||
Arguments:
|
||||
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
|
||||
|
@ -116,7 +116,7 @@ Additional Arguments:
|
|||
[InlineData("-h")]
|
||||
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
|
||||
{
|
||||
var cmd = new RemoveP2PCommand().Execute(helpArg);
|
||||
var cmd = new RemoveReferenceCommand().Execute(helpArg);
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ Additional Arguments:
|
|||
{
|
||||
var setup = Setup();
|
||||
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
|
@ -165,7 +165,7 @@ Additional Arguments:
|
|||
string projName = "Broken/Broken.csproj";
|
||||
var setup = Setup();
|
||||
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
|
@ -180,7 +180,7 @@ Additional Arguments:
|
|||
var setup = Setup();
|
||||
|
||||
var workingDir = Path.Combine(setup.TestRoot, "MoreThanOne");
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(workingDir)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
|
@ -193,7 +193,7 @@ Additional Arguments:
|
|||
{
|
||||
var setup = Setup();
|
||||
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
|
@ -209,7 +209,7 @@ Additional Arguments:
|
|||
var libref = AddLibRef(setup, lib);
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
|
@ -228,7 +228,7 @@ Additional Arguments:
|
|||
var libref = AddLibRef(setup, lib, FrameworkNet451Arg);
|
||||
|
||||
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
||||
|
@ -248,7 +248,7 @@ Additional Arguments:
|
|||
var validref = AddValidRef(setup, lib);
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
|
@ -267,7 +267,7 @@ Additional Arguments:
|
|||
var libref = GetLibRef(setup);
|
||||
|
||||
string csprojContetntBefore = lib.CsProjContent();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
|
@ -284,7 +284,7 @@ Additional Arguments:
|
|||
var libref = GetLibRef(setup);
|
||||
|
||||
string csprojContetntBefore = lib.CsProjContent();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
||||
|
@ -304,7 +304,7 @@ Additional Arguments:
|
|||
var csprojBefore = lib.CsProj();
|
||||
int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition();
|
||||
int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{librefNoCond.CsProjPath}\"");
|
||||
|
@ -329,7 +329,7 @@ Additional Arguments:
|
|||
var csprojBefore = lib.CsProj();
|
||||
int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition();
|
||||
int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\"");
|
||||
|
@ -354,7 +354,7 @@ Additional Arguments:
|
|||
var csprojBefore = lib.CsProj();
|
||||
int condNet451Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
|
||||
int condNetCoreApp10Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNetCoreApp10);
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\"");
|
||||
|
@ -379,7 +379,7 @@ Additional Arguments:
|
|||
Project reference `{setup.LibCsprojRelPath}` removed.";
|
||||
|
||||
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(proj.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
|
@ -399,7 +399,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
var libref = AddValidRef(setup, lib);
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(lib.Path)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
|
@ -418,7 +418,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
var libref = AddValidRef(setup, lib);
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
|
@ -437,7 +437,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
var libref = AddValidRef(setup, lib);
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
|
@ -460,7 +460,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");
|
||||
|
@ -484,7 +484,7 @@ Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelP
|
|||
Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveP2PCommand()
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");
|
|
@ -4,7 +4,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-remove-p2p.Tests</AssemblyName>
|
||||
<AssemblyName>dotnet-remove-reference.Tests</AssemblyName>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
Loading…
Reference in a new issue