Merge pull request #5237 from krwq/5103

Rename (dotnet add|list|remove) p2p(s?) ->$1 reference
This commit is contained in:
Krzysztof Wicher 2017-01-06 16:12:12 -08:00 committed by GitHub
commit 5044c76be4
63 changed files with 105 additions and 105 deletions

View file

@ -5,9 +5,9 @@ namespace Microsoft.DotNet.Tools.Add.ProjectToProjectReference
{
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";

View file

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

View file

@ -7,7 +7,7 @@ namespace Microsoft.DotNet.Tools.List.ProjectToProjectReferences
{
public const string AppFullName = ".NET Core Project-to-Project dependency viewer";
public const string AppDescription = "Command to list project to project (p2p) references";
public const string AppDescription = "Command to list project to project references";
public const string NoReferencesFound = "There are no {0} references in project {1}.\n{0} is the type of the item being requested (project, package, p2p) and {1} is the object operated on (a project file or a solution file). ";
}

View file

@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.List.ProjectToProjectReferences
{
var command = new ListProjectToProjectReferencesCommand()
{
Name = "p2ps",
Name = "reference",
FullName = LocalizableStrings.AppFullName,
Description = LocalizableStrings.AppDescription,
};

View file

@ -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";

View file

@ -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,

View file

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

View file

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

View file

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

View file

@ -10,13 +10,13 @@ using System.IO;
using System.Linq;
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:
<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")]
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
{
var cmd = new AddP2PCommand().Execute(helpArg);
var cmd = new AddReferenceCommand().Execute(helpArg);
cmd.Should().Pass();
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
}
@ -109,7 +109,7 @@ Additional Arguments:
[Fact]
public void WhenTooManyArgumentsArePassedItPrintsError()
{
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject("one two three")
.Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0);
@ -124,7 +124,7 @@ Additional Arguments:
{
var setup = Setup();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -139,7 +139,7 @@ Additional Arguments:
string projName = "Broken/Broken.csproj";
var setup = Setup();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -154,7 +154,7 @@ Additional Arguments:
var setup = Setup();
var workingDir = Path.Combine(setup.TestRoot, "MoreThanOne");
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(workingDir)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
cmd.ExitCode.Should().NotBe(0);
@ -167,7 +167,7 @@ Additional Arguments:
{
var setup = Setup();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.ExitCode.Should().NotBe(0);
@ -182,7 +182,7 @@ Additional Arguments:
var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -201,7 +201,7 @@ Additional Arguments:
var setup = Setup();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -219,14 +219,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.LibCsprojPath}\"")
.Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -243,14 +243,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"")
.Should().Pass();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -267,14 +267,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNetCoreApp10Arg} \"{setup.ValidRefCsprojPath}\"")
.Should().Pass();
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -291,14 +291,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\"")
.Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -315,14 +315,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"")
.Should().Pass();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -341,7 +341,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondOnItem"));
string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -356,14 +356,14 @@ Additional Arguments:
var lib = NewLibWithFrameworks();
var setup = Setup();
new AddP2PCommand()
new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"")
.Should().Pass();
var csprojContentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -379,7 +379,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithExistingRefCondWhitespaces"));
string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -395,7 +395,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform"));
string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName)
.Execute($"\"{setup.LibCsprojRelPath}\"");
@ -411,7 +411,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefNoCondNonUniform"));
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -429,7 +429,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform"));
string contentBefore = proj.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(proj.Path)
.WithProject(proj.CsProjName)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
@ -445,7 +445,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithRefCondNonUniform"));
int condBefore = proj.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
@ -463,7 +463,7 @@ Additional Arguments:
var proj = new ProjDir(Path.Combine(setup.TestRoot, "EmptyItemGroup"));
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(proj.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -484,7 +484,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\"");
@ -506,7 +506,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojPath}\" \"{setup.ValidRefCsprojPath}\"");
@ -525,7 +525,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.Should().Pass();
@ -542,7 +542,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var lib = NewLibWithFrameworks();
var setup = Setup();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -587,7 +587,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var lib = NewLibWithFrameworks();
var contentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName)
.Execute("\"IDoNotExist.csproj\"");
@ -603,7 +603,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup();
var contentBefore = lib.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(lib.CsProjPath)
.Execute($"\"{setup.ValidRefCsprojPath}\" \"IDoNotExist.csproj\"");
@ -619,7 +619,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var setup = Setup();
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(lib.Path)
.WithProject(lib.CsProjName)
.Execute($"\"{setup.ValidRefCsprojPath.Replace('\\', '/')}\"");
@ -638,7 +638,7 @@ Reference `DotnetAddP2PProjects\ValidRef\ValidRef.csproj` added to the project."
var proj = new ProjDir(setup.LibDir);
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(setup.LibCsprojPath)
.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"));
int condBefore = lib.CsProj().NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451);
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject(lib.CsProjPath)
.Execute($"{FrameworkNet451Arg} \"{net45lib.CsProjPath}\"");
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"));
int noCondBefore = net452netcoreapp10lib.CsProj().NumberOfItemGroupsWithoutCondition();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject(net452netcoreapp10lib.CsProjPath)
.Execute($"\"{lib.CsProjPath}\"");
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 csProjContent = lib.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject(lib.CsProjPath)
.Execute($"-f {framework} \"{net45lib.CsProjPath}\"");
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 csProjContent = net45lib.CsProjContent();
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject(net45lib.CsProjPath)
.Execute($"{frameworkArg} \"{lib.CsProjPath}\"");
cmd.Should().Fail();

View file

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-add-p2p.Tests</AssemblyName>
<AssemblyName>dotnet-add-reference.Tests</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
</PropertyGroup>

View file

@ -9,13 +9,13 @@ using System;
using System.IO;
using Xunit;
namespace Microsoft.DotNet.Cli.List.P2P.Tests
namespace Microsoft.DotNet.Cli.List.Reference.Tests
{
public class GivenDotnetListP2Ps : TestBase
public class GivenDotnetListReference : TestBase
{
private const string HelpText = @".NET Core Project-to-Project dependency viewer
Usage: dotnet list <PROJECT> p2ps [options]
Usage: dotnet list <PROJECT> reference [options]
Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
@ -33,7 +33,7 @@ Options:
[InlineData("-h")]
public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
{
var cmd = new ListP2PsCommand().Execute(helpArg);
var cmd = new ListReferenceCommand().Execute(helpArg);
cmd.Should().Pass();
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
}
@ -52,7 +52,7 @@ Options:
[Fact]
public void WhenTooManyArgumentsArePassedItPrintsError()
{
var cmd = new AddP2PCommand()
var cmd = new AddReferenceCommand()
.WithProject("one two three")
.Execute("proj.csproj");
cmd.ExitCode.Should().NotBe(0);
@ -66,7 +66,7 @@ Options:
{
var setup = Setup();
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -81,7 +81,7 @@ Options:
string projName = "Broken/Broken.csproj";
var setup = Setup();
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.WithProject(projName)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
@ -96,7 +96,7 @@ Options:
var setup = Setup();
var workingDir = Path.Combine(setup.TestRoot, "MoreThanOne");
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithWorkingDirectory(workingDir)
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
cmd.ExitCode.Should().NotBe(0);
@ -109,7 +109,7 @@ Options:
{
var setup = Setup();
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithWorkingDirectory(setup.TestRoot)
.Execute($"\"{setup.ValidRefCsprojPath}\"");
cmd.ExitCode.Should().NotBe(0);
@ -122,7 +122,7 @@ Options:
{
var lib = NewLib();
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithProject(lib.CsProjPath)
.Execute();
cmd.Should().Pass();
@ -140,7 +140,7 @@ Options:
string ref1 = NewLib("ItPrintsSingleReference", "ref").CsProjPath;
AddValidRef(ref1, lib);
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithProject(lib.CsProjPath)
.Execute();
cmd.Should().Pass();
@ -165,7 +165,7 @@ Options:
AddValidRef(ref2, lib);
AddValidRef(ref3, lib);
var cmd = new ListP2PsCommand()
var cmd = new ListReferenceCommand()
.WithProject(lib.CsProjPath)
.Execute();
cmd.Should().Pass();
@ -208,7 +208,7 @@ Options:
private void AddValidRef(string path, ProjDir proj)
{
new AddP2PCommand()
new AddReferenceCommand()
.WithProject(proj.CsProjPath)
.Execute($"\"{path}\"")
.Should().Pass();

View file

@ -4,7 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AssemblyName>dotnet-list-p2ps.Tests</AssemblyName>
<AssemblyName>dotnet-list-reference.Tests</AssemblyName>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
</PropertyGroup>

View file

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

View file

@ -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>