dotnet remove p2p -> dotnet remove reference

This commit is contained in:
Krzysztof Wicher 2017-01-06 14:16:55 -08:00
parent 3ad9b72664
commit 528d37bda5
21 changed files with 31 additions and 31 deletions

View file

@ -5,9 +5,9 @@ namespace Microsoft.DotNet.Tools.Remove.ProjectToProjectReference
{ {
internal class LocalizableStrings 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"; public const string AppHelpText = "Project to project references to remove";

View file

@ -16,7 +16,7 @@ namespace Microsoft.DotNet.Tools.Remove.ProjectToProjectReference
{ {
var command = new RemoveProjectToProjectReferenceCommand() var command = new RemoveProjectToProjectReferenceCommand()
{ {
Name = "p2p", Name = "reference",
FullName = LocalizableStrings.AppFullName, FullName = LocalizableStrings.AppFullName,
Description = LocalizableStrings.AppDescription, Description = LocalizableStrings.AppDescription,
HandleRemainingArguments = true, HandleRemainingArguments = true,

View file

@ -5,22 +5,22 @@ using Microsoft.DotNet.Cli.Utils;
namespace Microsoft.DotNet.Tools.Test.Utilities namespace Microsoft.DotNet.Tools.Test.Utilities
{ {
public sealed class RemoveP2PCommand : TestCommand public sealed class RemoveReferenceCommand : TestCommand
{ {
private string _projectName = null; private string _projectName = null;
public RemoveP2PCommand() public RemoveReferenceCommand()
: base("dotnet") : base("dotnet")
{ {
} }
public override CommandResult Execute(string args = "") public override CommandResult Execute(string args = "")
{ {
args = $"remove {_projectName} p2p {args}"; args = $"remove {_projectName} reference {args}";
return base.ExecuteWithCapturedOutput(args); return base.ExecuteWithCapturedOutput(args);
} }
public RemoveP2PCommand WithProject(string projectName) public RemoveReferenceCommand WithProject(string projectName)
{ {
_projectName = projectName; _projectName = projectName;
return this; return this;

View file

@ -9,13 +9,13 @@ using System;
using System.IO; using System.IO;
using Xunit; 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: Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <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")] [InlineData("-h")]
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg) public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
{ {
var cmd = new RemoveP2PCommand().Execute(helpArg); var cmd = new RemoveReferenceCommand().Execute(helpArg);
cmd.Should().Pass(); cmd.Should().Pass();
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }
@ -150,7 +150,7 @@ Additional Arguments:
{ {
var setup = Setup(); var setup = Setup();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(projName) .WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -165,7 +165,7 @@ Additional Arguments:
string projName = "Broken/Broken.csproj"; string projName = "Broken/Broken.csproj";
var setup = Setup(); var setup = Setup();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(projName) .WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -180,7 +180,7 @@ Additional Arguments:
var setup = Setup(); var setup = Setup();
var workingDir = Path.Combine(setup.TestRoot, "MoreThanOne"); var workingDir = Path.Combine(setup.TestRoot, "MoreThanOne");
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(workingDir) .WithWorkingDirectory(workingDir)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\""); .Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -193,7 +193,7 @@ Additional Arguments:
{ {
var setup = Setup(); var setup = Setup();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -209,7 +209,7 @@ Additional Arguments:
var libref = AddLibRef(setup, lib); var libref = AddLibRef(setup, lib);
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{libref.CsProjPath}\""); .Execute($"\"{libref.CsProjPath}\"");
@ -228,7 +228,7 @@ Additional Arguments:
var libref = AddLibRef(setup, lib, FrameworkNet451Arg); var libref = AddLibRef(setup, lib, FrameworkNet451Arg);
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\""); .Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
@ -248,7 +248,7 @@ Additional Arguments:
var validref = AddValidRef(setup, lib); var validref = AddValidRef(setup, lib);
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{libref.CsProjPath}\""); .Execute($"\"{libref.CsProjPath}\"");
@ -267,7 +267,7 @@ Additional Arguments:
var libref = GetLibRef(setup); var libref = GetLibRef(setup);
string csprojContetntBefore = lib.CsProjContent(); string csprojContetntBefore = lib.CsProjContent();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{libref.CsProjPath}\""); .Execute($"\"{libref.CsProjPath}\"");
@ -284,7 +284,7 @@ Additional Arguments:
var libref = GetLibRef(setup); var libref = GetLibRef(setup);
string csprojContetntBefore = lib.CsProjContent(); string csprojContetntBefore = lib.CsProjContent();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\""); .Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
@ -304,7 +304,7 @@ Additional Arguments:
var csprojBefore = lib.CsProj(); var csprojBefore = lib.CsProj();
int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition(); int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition();
int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{librefNoCond.CsProjPath}\""); .Execute($"\"{librefNoCond.CsProjPath}\"");
@ -329,7 +329,7 @@ Additional Arguments:
var csprojBefore = lib.CsProj(); var csprojBefore = lib.CsProj();
int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition(); int noCondBefore = csprojBefore.NumberOfItemGroupsWithoutCondition();
int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\""); .Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\"");
@ -354,7 +354,7 @@ Additional Arguments:
var csprojBefore = lib.CsProj(); var csprojBefore = lib.CsProj();
int condNet451Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condNet451Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
int condNetCoreApp10Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNetCoreApp10); int condNetCoreApp10Before = csprojBefore.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNetCoreApp10);
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\""); .Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\"");
@ -379,7 +379,7 @@ Additional Arguments:
Project reference `{setup.LibCsprojRelPath}` removed."; Project reference `{setup.LibCsprojRelPath}` removed.";
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"\"{libref.CsProjPath}\""); .Execute($"\"{libref.CsProjPath}\"");
@ -399,7 +399,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
var libref = AddValidRef(setup, lib); var libref = AddValidRef(setup, lib);
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\""); .Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
@ -418,7 +418,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
var libref = AddValidRef(setup, lib); var libref = AddValidRef(setup, lib);
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\""); .Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
@ -437,7 +437,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
var libref = AddValidRef(setup, lib); var libref = AddValidRef(setup, lib);
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -460,7 +460,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed."; Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{libref.CsProjPath}\" \"{validref.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."; Project reference `{Path.Combine(TestSetup.ProjectName, setup.ValidRefCsprojRelPath)}` removed.";
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new RemoveP2PCommand() var cmd = new RemoveReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\""); .Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");

View file

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework> <TargetFramework>netcoreapp1.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> <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> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
</PropertyGroup> </PropertyGroup>