dotnet add p2p -> dotnet add reference

This commit is contained in:
Krzysztof Wicher 2017-01-06 14:08:50 -08:00
parent 5bdbe354b2
commit 3ad9b72664
23 changed files with 55 additions and 55 deletions

View file

@ -5,9 +5,9 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToProjectReference
{ {
internal class LocalizableStrings internal class LocalizableStrings
{ {
public const string AppFullName = ".NET Add Project to Project (p2p) reference Command"; public const string AppFullName = ".NET Add Project to Project reference Command";
public const string AppDescription = "Command to add project to project (p2p) reference"; public const string AppDescription = "Command to add project to project reference";
public const string AppHelpText = "Project to project references to add"; public const string AppHelpText = "Project to project references to add";

View file

@ -22,7 +22,7 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToProjectReference
{ {
var command = new AddProjectToProjectReferenceCommand() var command = new AddProjectToProjectReferenceCommand()
{ {
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 AddP2PCommand : TestCommand public sealed class AddReferenceCommand : TestCommand
{ {
private string _projectName = null; private string _projectName = null;
public AddP2PCommand() public AddReferenceCommand()
: base("dotnet") : base("dotnet")
{ {
} }
public override CommandResult Execute(string args = "") public override CommandResult Execute(string args = "")
{ {
args = $"add {_projectName} p2p {args}"; args = $"add {_projectName} reference {args}";
return base.ExecuteWithCapturedOutput(args); return base.ExecuteWithCapturedOutput(args);
} }
public AddP2PCommand WithProject(string projectName) public AddReferenceCommand WithProject(string projectName)
{ {
_projectName = projectName; _projectName = projectName;
return this; return this;

View file

@ -10,13 +10,13 @@ using System.IO;
using System.Linq; using System.Linq;
using Xunit; using Xunit;
namespace Microsoft.DotNet.Cli.Add.P2P.Tests namespace Microsoft.DotNet.Cli.Add.Reference.Tests
{ {
public class GivenDotnetAddP2P : TestBase public class GivenDotnetAddReference : TestBase
{ {
private const string HelpText = @".NET Add Project to Project (p2p) reference Command private const string HelpText = @".NET Add Project to Project reference Command
Usage: dotnet add <PROJECT> p2p [options] [args] Usage: dotnet add <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.
@ -90,7 +90,7 @@ Additional Arguments:
[InlineData("-h")] [InlineData("-h")]
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg) public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
{ {
var cmd = new AddP2PCommand().Execute(helpArg); var cmd = new AddReferenceCommand().Execute(helpArg);
cmd.Should().Pass(); cmd.Should().Pass();
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }
@ -109,7 +109,7 @@ Additional Arguments:
[Fact] [Fact]
public void WhenTooManyArgumentsArePassedItPrintsError() public void WhenTooManyArgumentsArePassedItPrintsError()
{ {
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject("one two three") .WithProject("one two three")
.Execute("proj.csproj"); .Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -124,7 +124,7 @@ Additional Arguments:
{ {
var setup = Setup(); var setup = Setup();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(projName) .WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -139,7 +139,7 @@ Additional Arguments:
string projName = "Broken/Broken.csproj"; string projName = "Broken/Broken.csproj";
var setup = Setup(); var setup = Setup();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(projName) .WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -154,7 +154,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 AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(workingDir) .WithWorkingDirectory(workingDir)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\""); .Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -167,7 +167,7 @@ Additional Arguments:
{ {
var setup = Setup(); var setup = Setup();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -182,7 +182,7 @@ Additional Arguments:
var setup = Setup(); var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -201,7 +201,7 @@ Additional Arguments:
var setup = Setup(); var setup = Setup();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -219,14 +219,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.LibCsprojPath}\"") .Execute($"\"{setup.LibCsprojPath}\"")
.Should().Pass(); .Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName) .WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -243,14 +243,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"") .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"")
.Should().Pass(); .Should().Pass();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -267,14 +267,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNetCoreApp10Arg} \"{setup.ValidRefCsprojPath}\"") .Execute($"{FrameworkNetCoreApp10Arg} \"{setup.ValidRefCsprojPath}\"")
.Should().Pass(); .Should().Pass();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -291,14 +291,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"") .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"")
.Should().Pass(); .Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -315,14 +315,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"") .Execute($"\"{setup.ValidRefCsprojPath}\"")
.Should().Pass(); .Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName) .WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -341,7 +341,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondOnItem")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondOnItem"));
string contentBefore = proj.CsProjContent(); string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path) .WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -356,14 +356,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"") .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"")
.Should().Pass(); .Should().Pass();
var csprojContentBefore = lib.CsProjContent(); var csprojContentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -379,7 +379,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondWhitespaces")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondWhitespaces"));
string contentBefore = proj.CsProjContent(); string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path) .WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName) .WithProject(proj.CsProjName)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -395,7 +395,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform"));
string contentBefore = proj.CsProjContent(); string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path) .WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName) .WithProject(proj.CsProjName)
.Execute($"\"{setup.LibCsprojRelPath}\""); .Execute($"\"{setup.LibCsprojRelPath}\"");
@ -411,7 +411,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform"));
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -429,7 +429,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform"));
string contentBefore = proj.CsProjContent(); string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path) .WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName) .WithProject(proj.CsProjName)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -445,7 +445,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform"));
int condBefore = proj.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = proj.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -463,7 +463,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "EmptyItemGroup")); var proj = new ProjDir(Path.Combine(setup.TestRoot, "EmptyItemGroup"));
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -484,7 +484,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup(); var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\"");
@ -506,7 +506,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup(); var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\""); .Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\"");
@ -525,7 +525,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup(); var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.Should().Pass(); cmd.Should().Pass();
@ -542,7 +542,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var setup = Setup(); var setup = Setup();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName) .WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\""); .Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -587,7 +587,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var lib = NewLibWithFrameworks(); var lib = NewLibWithFrameworks();
var contentBefore = lib.CsProjContent(); var contentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName) .WithProject(lib.CsProjName)
.Execute("\"IDoNotExist.csproj\""); .Execute("\"IDoNotExist.csproj\"");
@ -603,7 +603,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup(); var setup = Setup();
var contentBefore = lib.CsProjContent(); var contentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\" \"IDoNotExist.csproj\""); .Execute($"\"{setup.ValidRefCsprojPath}\" \"IDoNotExist.csproj\"");
@ -619,7 +619,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup(); var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path) .WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName) .WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath.Replace('\\', '/')}\""); .Execute($"\"{setup.ValidRefCsprojPath.Replace('\\', '/')}\"");
@ -638,7 +638,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var proj = new ProjDir(setup.LibDir); var proj = new ProjDir(setup.LibDir);
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(setup.LibCsprojPath) .WithProject(setup.LibCsprojPath)
.Execute($"\"{setup.ValidRefCsprojRelPath}\""); .Execute($"\"{setup.ValidRefCsprojRelPath}\"");
@ -658,7 +658,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib")); var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451); int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{net45lib.CsProjPath}\""); .Execute($"{FrameworkNet451Arg} \"{net45lib.CsProjPath}\"");
cmd.Should().Pass(); cmd.Should().Pass();
@ -676,7 +676,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var net452netcoreapp10lib = new ProjDir(Path.Combine(setup.TestRoot, "Net452AndNetCoreApp10Lib")); var net452netcoreapp10lib = new ProjDir(Path.Combine(setup.TestRoot, "Net452AndNetCoreApp10Lib"));
int noCondBefore = net452netcoreapp10lib.CsProj().NumberOfItemGroupsWithoutCondition(); int noCondBefore = net452netcoreapp10lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject(net452netcoreapp10lib.CsProjPath) .WithProject(net452netcoreapp10lib.CsProjPath)
.Execute($"\"{lib.CsProjPath}\""); .Execute($"\"{lib.CsProjPath}\"");
cmd.Should().Pass(); cmd.Should().Pass();
@ -698,7 +698,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib")); var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));
var csProjContent = lib.CsProjContent(); var csProjContent = lib.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject(lib.CsProjPath) .WithProject(lib.CsProjPath)
.Execute($"-f {framework} \"{net45lib.CsProjPath}\""); .Execute($"-f {framework} \"{net45lib.CsProjPath}\"");
cmd.Should().Fail(); cmd.Should().Fail();
@ -717,7 +717,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib")); var net45lib = new ProjDir(Path.Combine(setup.TestRoot, "Net45Lib"));
var csProjContent = net45lib.CsProjContent(); var csProjContent = net45lib.CsProjContent();
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject(net45lib.CsProjPath) .WithProject(net45lib.CsProjPath)
.Execute($"{frameworkArg} \"{lib.CsProjPath}\""); .Execute($"{frameworkArg} \"{lib.CsProjPath}\"");
cmd.Should().Fail(); cmd.Should().Fail();

View file

@ -52,7 +52,7 @@ Options:
[Fact] [Fact]
public void WhenTooManyArgumentsArePassedItPrintsError() public void WhenTooManyArgumentsArePassedItPrintsError()
{ {
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject("one two three") .WithProject("one two three")
.Execute("proj.csproj"); .Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);
@ -208,7 +208,7 @@ Options:
private void AddValidRef(string path, ProjDir proj) private void AddValidRef(string path, ProjDir proj)
{ {
new AddP2PCommand() new AddReferenceCommand()
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"\"{path}\"") .Execute($"\"{path}\"")
.Should().Pass(); .Should().Pass();

View file

@ -90,7 +90,7 @@ Additional Arguments:
private ProjDir AddLibRef(TestSetup setup, ProjDir proj, string additionalArgs = "") private ProjDir AddLibRef(TestSetup setup, ProjDir proj, string additionalArgs = "")
{ {
var ret = GetLibRef(setup); var ret = GetLibRef(setup);
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"{additionalArgs} \"{ret.CsProjPath}\"") .Execute($"{additionalArgs} \"{ret.CsProjPath}\"")
@ -102,7 +102,7 @@ Additional Arguments:
private ProjDir AddValidRef(TestSetup setup, ProjDir proj, string frameworkArg = "") private ProjDir AddValidRef(TestSetup setup, ProjDir proj, string frameworkArg = "")
{ {
var ret = new ProjDir(setup.ValidRefDir); var ret = new ProjDir(setup.ValidRefDir);
new AddP2PCommand() new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot) .WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath) .WithProject(proj.CsProjPath)
.Execute($"{frameworkArg} \"{ret.CsProjPath}\"") .Execute($"{frameworkArg} \"{ret.CsProjPath}\"")
@ -135,7 +135,7 @@ Additional Arguments:
[Fact] [Fact]
public void WhenTooManyArgumentsArePassedItPrintsError() public void WhenTooManyArgumentsArePassedItPrintsError()
{ {
var cmd = new AddP2PCommand() var cmd = new AddReferenceCommand()
.WithProject("one two three") .WithProject("one two three")
.Execute("proj.csproj"); .Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0); cmd.ExitCode.Should().NotBe(0);