Merge pull request #6961 from nguerrera/loc-tests
Make remaining tests pass on localized setup
This commit is contained in:
commit
1661fd0975
7 changed files with 106 additions and 85 deletions
|
@ -7,7 +7,10 @@ using System.Runtime.CompilerServices;
|
|||
[assembly: AssemblyMetadataAttribute("Serviceable", "True")]
|
||||
[assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-add-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-add-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-help.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-list-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-remove-reference.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-remove-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-add.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-list.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using FluentAssertions;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.Tools;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Msbuild.Tests.Utilities;
|
||||
using System;
|
||||
|
@ -46,8 +47,8 @@ Commands:
|
|||
const string ConditionFrameworkNet451 = "== 'net451'";
|
||||
const string FrameworkNetCoreApp10Arg = "-f netcoreapp1.0";
|
||||
const string ConditionFrameworkNetCoreApp10 = "== 'netcoreapp1.0'";
|
||||
const string ProjectNotCompatibleErrorMessageRegEx = "Project `[^`]*` cannot be added due to incompatible targeted frameworks between the two projects\\. Please review the project you are trying to add and verify that is compatible with the following targets\\:";
|
||||
const string ProjectDoesNotTargetFrameworkErrorMessageRegEx = "Project `[^`]*` does not target framework `[^`]*`.";
|
||||
static readonly string ProjectNotCompatibleErrorMessageRegEx = string.Format(CommonLocalizableStrings.ProjectNotCompatibleWithFrameworks, "[^`]*");
|
||||
static readonly string ProjectDoesNotTargetFrameworkErrorMessageRegEx = string.Format(CommonLocalizableStrings.ProjectDoesNotTargetFramework, "[^`]*", "[^`]*");
|
||||
static readonly string[] DefaultFrameworks = new string[] { "netcoreapp1.0", "net451" };
|
||||
|
||||
private TestSetup Setup([System.Runtime.CompilerServices.CallerMemberName] string callingMethod = nameof(Setup), string identifier = "")
|
||||
|
@ -106,7 +107,7 @@ Commands:
|
|||
{
|
||||
var cmd = new AddReferenceCommand().Execute(helpArg);
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -117,8 +118,8 @@ Commands:
|
|||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput($"add {commandName}");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("Required command was not provided.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(AddCommandHelpText);
|
||||
cmd.StdErr.Should().Be(CommonLocalizableStrings.RequiredCommandNotPassed);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(AddCommandHelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -144,8 +145,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find project or directory `{projName}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindProjectOrDirectory, projName));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -159,8 +160,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be("Project `Broken/Broken.csproj` is invalid.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ProjectIsInvalid, "Broken/Broken.csproj"));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -173,8 +174,8 @@ Commands:
|
|||
.WithWorkingDirectory(workingDir)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Found more than one project in `{workingDir + Path.DirectorySeparatorChar}`. Please specify which one to use.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.MoreThanOneProjectInDirectory, workingDir + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -186,8 +187,8 @@ Commands:
|
|||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find any project in `{setup.TestRoot + Path.DirectorySeparatorChar}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindAnyProjectInDirectory, setup.TestRoot + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -202,7 +203,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
|
@ -221,7 +222,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore + 1);
|
||||
|
@ -246,7 +247,7 @@ Commands:
|
|||
.WithProject(lib.CsProjName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(setup.ValidRefCsprojName).Should().Be(1);
|
||||
|
@ -270,7 +271,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj")); ;
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(setup.ValidRefCsprojName, ConditionFrameworkNet451).Should().Be(1);
|
||||
|
@ -294,7 +295,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(setup.ValidRefCsprojName, ConditionFrameworkNet451).Should().Be(1);
|
||||
|
@ -318,7 +319,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(setup.ValidRefCsprojName).Should().Be(1);
|
||||
|
@ -342,7 +343,7 @@ Commands:
|
|||
.WithProject(lib.CsProjName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `ValidRef\\ValidRef.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"ValidRef\ValidRef.csproj"));
|
||||
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||
|
@ -361,7 +362,7 @@ Commands:
|
|||
.WithProject(proj.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `..\\Lib\\Lib.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"..\Lib\Lib.csproj"));
|
||||
proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -383,7 +384,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `ValidRef\\ValidRef.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"ValidRef\ValidRef.csproj"));
|
||||
lib.CsProjContent().Should().BeEquivalentTo(csprojContentBefore);
|
||||
}
|
||||
|
||||
|
@ -399,7 +400,7 @@ Commands:
|
|||
.WithProject(proj.CsProjName)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `..\\Lib\\Lib.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"..\Lib\Lib.csproj"));
|
||||
proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -415,7 +416,7 @@ Commands:
|
|||
.WithProject(proj.CsProjName)
|
||||
.Execute($"\"{setup.LibCsprojRelPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `..\\Lib\\Lib.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"..\Lib\Lib.csproj"));
|
||||
proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -431,7 +432,7 @@ Commands:
|
|||
.WithProject(proj.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"..\ValidRef\ValidRef.csproj"));
|
||||
var csproj = proj.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(setup.ValidRefCsprojName).Should().Be(1);
|
||||
|
@ -449,7 +450,7 @@ Commands:
|
|||
.WithProject(proj.CsProjName)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.LibCsprojRelPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Project already has a reference to `..\\Lib\\Lib.csproj`.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectAlreadyHasAreference, @"..\Lib\Lib.csproj"));
|
||||
proj.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -465,7 +466,7 @@ Commands:
|
|||
.WithProject(proj.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, "..\\ValidRef\\ValidRef.csproj"));
|
||||
var csproj = proj.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(setup.ValidRefCsprojName, ConditionFrameworkNet451).Should().Be(1);
|
||||
|
@ -483,7 +484,7 @@ Commands:
|
|||
.WithProject(proj.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"..\ValidRef\ValidRef.csproj"));
|
||||
var csproj = proj.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(setup.ValidRefCsprojName).Should().Be(1);
|
||||
|
@ -492,8 +493,8 @@ Commands:
|
|||
[Fact]
|
||||
public void ItAddsMultipleRefsNoCondToTheSameItemGroup()
|
||||
{
|
||||
const string OutputText = @"Reference `Lib\Lib.csproj` added to the project.
|
||||
Reference `ValidRef\ValidRef.csproj` added to the project.";
|
||||
string OutputText = $@"{string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"Lib\Lib.csproj")}
|
||||
{string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj")}";
|
||||
|
||||
var setup = Setup();
|
||||
var lib = NewLibWithFrameworks(dir: setup.TestRoot);
|
||||
|
@ -514,8 +515,8 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
[Fact]
|
||||
public void ItAddsMultipleRefsWithCondToTheSameItemGroup()
|
||||
{
|
||||
const string OutputText = @"Reference `Lib\Lib.csproj` added to the project.
|
||||
Reference `ValidRef\ValidRef.csproj` added to the project.";
|
||||
string OutputText = $@"{string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"Lib\Lib.csproj")}
|
||||
{string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj")}";
|
||||
|
||||
var setup = Setup();
|
||||
var lib = NewLibWithFrameworks(dir: setup.TestRoot);
|
||||
|
@ -544,7 +545,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithWorkingDirectory(lib.Path)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
|
@ -562,7 +563,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(lib.CsProjName)
|
||||
.Execute("\"IDoNotExist.csproj\"");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("Reference IDoNotExist.csproj does not exist.");
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ReferenceDoesNotExist, "IDoNotExist.csproj"));
|
||||
lib.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -578,7 +579,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\" \"IDoNotExist.csproj\"");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("Reference IDoNotExist.csproj does not exist.");
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ReferenceDoesNotExist, "IDoNotExist.csproj"));
|
||||
lib.CsProjContent().Should().BeEquivalentTo(contentBefore);
|
||||
}
|
||||
|
||||
|
@ -594,7 +595,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(lib.CsProjName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath.Replace('\\', '/')}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"ValidRef\ValidRef.csproj"));
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
|
@ -613,7 +614,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(setup.LibCsprojPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\ValidRef\\ValidRef.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"..\ValidRef\ValidRef.csproj"));
|
||||
cmd.StdErr.Should().BeEmpty();
|
||||
var csproj = proj.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
|
@ -632,7 +633,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{net45lib.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\Net45Lib\\Net45Lib.csproj` added to the project.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"..\Net45Lib\Net45Lib.csproj"));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(net45lib.CsProjName, ConditionFrameworkNet451).Should().Be(1);
|
||||
|
@ -650,7 +651,8 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(net452netcoreapp10lib.CsProjPath)
|
||||
.Execute($"\"{lib.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("Reference `..\\Lib\\Lib.csproj` added to the project.");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ReferenceAddedToTheProject, @"..\Lib\Lib.csproj"));
|
||||
var csproj = net452netcoreapp10lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore + 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(lib.CsProjName).Should().Be(1);
|
||||
|
@ -672,7 +674,7 @@ Reference `ValidRef\ValidRef.csproj` added to the project.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"-f {framework} \"{net45lib.CsProjPath}\"");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be($"Project `{setup.LibCsprojPath}` does not target framework `{framework}`.");
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ProjectDoesNotTargetFramework, setup.LibCsprojPath, framework));
|
||||
|
||||
lib.CsProjContent().Should().BeEquivalentTo(csProjContent);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-add-reference.Tests</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -13,6 +16,7 @@
|
|||
<ProjectReference Include="..\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Sln.Internal\Microsoft.DotNet.Cli.Sln.Internal.csproj" />
|
||||
<ProjectReference Include="..\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using FluentAssertions;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.Tools;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Msbuild.Tests.Utilities;
|
||||
using System;
|
||||
|
@ -50,7 +51,7 @@ Commands:
|
|||
{
|
||||
var cmd = new ListReferenceCommand().Execute(helpArg);
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -61,8 +62,8 @@ Commands:
|
|||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput($"list {commandName}");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("Required command was not provided.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(ListCommandHelpText);
|
||||
cmd.StdErr.Should().Be(CommonLocalizableStrings.RequiredCommandNotPassed);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(ListCommandHelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -88,8 +89,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find project or directory `{projName}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindProjectOrDirectory, projName));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -103,8 +104,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be("Project `Broken/Broken.csproj` is invalid.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ProjectIsInvalid, "Broken/Broken.csproj"));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -117,8 +118,8 @@ Commands:
|
|||
.WithWorkingDirectory(workingDir)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Found more than one project in `{workingDir + Path.DirectorySeparatorChar}`. Please specify which one to use.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.MoreThanOneProjectInDirectory, workingDir + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -130,8 +131,8 @@ Commands:
|
|||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find any project in `{setup.TestRoot + Path.DirectorySeparatorChar}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindAnyProjectInDirectory, setup.TestRoot + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -143,14 +144,15 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute();
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"There are no Project to Project references in project {lib.CsProjPath}. ;; Project to Project is the type of the item being requested (project, package, p2p) and {lib.CsProjPath} is the object operated on (a project file or a solution file). ");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.NoReferencesFound, CommonLocalizableStrings.P2P, lib.CsProjPath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ItPrintsSingleReference()
|
||||
{
|
||||
const string OutputText = @"Project reference(s)
|
||||
--------------------
|
||||
string OutputText = CommonLocalizableStrings.ProjectReferenceOneOrMore;
|
||||
OutputText += $@"
|
||||
{new string('-', OutputText.Length)}
|
||||
..\ref\ref.csproj";
|
||||
|
||||
var lib = NewLib("lib");
|
||||
|
@ -167,8 +169,9 @@ Commands:
|
|||
[Fact]
|
||||
public void ItPrintsMultipleReferences()
|
||||
{
|
||||
const string OutputText = @"Project reference(s)
|
||||
--------------------
|
||||
string OutputText = CommonLocalizableStrings.ProjectReferenceOneOrMore;
|
||||
OutputText += $@"
|
||||
{new string('-', OutputText.Length)}
|
||||
..\ref1\ref1.csproj
|
||||
..\ref2\ref2.csproj
|
||||
..\ref3\ref3.csproj";
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-list-reference.Tests</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Sln.Internal\Microsoft.DotNet.Cli.Sln.Internal.csproj" />
|
||||
<ProjectReference Include="..\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using FluentAssertions;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.Tools;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Msbuild.Tests.Utilities;
|
||||
using System;
|
||||
|
@ -132,7 +133,7 @@ Commands:
|
|||
{
|
||||
var cmd = new RemoveReferenceCommand().Execute(helpArg);
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -143,8 +144,8 @@ Commands:
|
|||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput($"remove {commandName}");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be("Required command was not provided.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(RemoveCommandHelpText);
|
||||
cmd.StdErr.Should().Be(CommonLocalizableStrings.RequiredCommandNotPassed);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(RemoveCommandHelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -169,8 +170,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find project or directory `{projName}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindProjectOrDirectory, projName));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -184,8 +185,8 @@ Commands:
|
|||
.WithProject(projName)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be("Project `Broken/Broken.csproj` is invalid.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.ProjectIsInvalid, "Broken/Broken.csproj"));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -198,8 +199,8 @@ Commands:
|
|||
.WithWorkingDirectory(workingDir)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Found more than one project in `{workingDir + Path.DirectorySeparatorChar}`. Please specify which one to use.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.MoreThanOneProjectInDirectory, workingDir + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -211,8 +212,8 @@ Commands:
|
|||
.WithWorkingDirectory(setup.TestRoot)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.ExitCode.Should().NotBe(0);
|
||||
cmd.StdErr.Should().Be($"Could not find any project in `{setup.TestRoot + Path.DirectorySeparatorChar}`.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindAnyProjectInDirectory, setup.TestRoot + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -228,7 +229,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||
|
@ -247,7 +248,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(libref.Name, ConditionFrameworkNet451).Should().Be(0);
|
||||
|
@ -267,7 +268,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||
|
@ -286,7 +287,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{libref.CsProjPath}` could not be found.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, libref.CsProjPath));
|
||||
lib.CsProjContent().Should().BeEquivalentTo(csprojContetntBefore);
|
||||
}
|
||||
|
||||
|
@ -303,7 +304,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{libref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{libref.CsProjPath}` could not be found.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, libref.CsProjPath));
|
||||
lib.CsProjContent().Should().BeEquivalentTo(csprojContetntBefore);
|
||||
}
|
||||
|
||||
|
@ -323,7 +324,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{librefNoCond.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(0);
|
||||
|
@ -348,7 +349,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{librefCond.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(librefNoCond.Name).Should().Be(1);
|
||||
|
@ -373,7 +374,7 @@ Commands:
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"{FrameworkNet451Arg} \"{librefCondNet451.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName)));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithConditionContaining(ConditionFrameworkNet451).Should().Be(condNet451Before - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeAndConditionContaining(librefCondNet451.Name, ConditionFrameworkNet451).Should().Be(0);
|
||||
|
@ -389,8 +390,8 @@ Commands:
|
|||
var proj = new ProjDir(Path.Combine(setup.TestRoot, "WithDoubledRef"));
|
||||
var libref = GetLibRef(setup);
|
||||
|
||||
string removedText = $@"Project reference `{setup.LibCsprojRelPath}` removed.
|
||||
Project reference `{setup.LibCsprojRelPath}` removed.";
|
||||
string removedText = $@"{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, setup.LibCsprojRelPath)}
|
||||
{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, setup.LibCsprojRelPath)}";
|
||||
|
||||
int noCondBefore = proj.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
|
@ -418,7 +419,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, setup.ValidRefCsprojRelToOtherProjPath));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||
|
@ -437,7 +438,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojRelToOtherProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, setup.ValidRefCsprojRelToOtherProjPath));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||
|
@ -456,7 +457,7 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{setup.ValidRefCsprojPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be($"Project reference `{setup.ValidRefCsprojRelToOtherProjPath}` removed.");
|
||||
cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, setup.ValidRefCsprojRelToOtherProjPath));
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(libref.Name).Should().Be(0);
|
||||
|
@ -470,8 +471,8 @@ Project reference `{setup.LibCsprojRelPath}` removed.";
|
|||
var libref = AddLibRef(setup, lib);
|
||||
var validref = AddValidRef(setup, lib);
|
||||
|
||||
string outputText = $@"Project reference `{Path.Combine("Lib", setup.LibCsprojName)}` removed.
|
||||
Project reference `{Path.Combine(setup.ValidRefCsprojRelPath)}` removed.";
|
||||
string outputText = $@"{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine("Lib", setup.LibCsprojName))}
|
||||
{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine(setup.ValidRefCsprojRelPath))}";
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
|
@ -494,8 +495,8 @@ Project reference `{Path.Combine(setup.ValidRefCsprojRelPath)}` removed.";
|
|||
var libref = GetLibRef(setup);
|
||||
var validref = AddValidRef(setup, lib);
|
||||
|
||||
string OutputText = $@"Project reference `{setup.LibCsprojPath}` could not be found.
|
||||
Project reference `{Path.Combine(setup.ValidRefCsprojRelPath)}` removed.";
|
||||
string outputText = $@"{string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, setup.LibCsprojPath)}
|
||||
{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, Path.Combine(setup.ValidRefCsprojRelPath))}";
|
||||
|
||||
int noCondBefore = lib.CsProj().NumberOfItemGroupsWithoutCondition();
|
||||
var cmd = new RemoveReferenceCommand()
|
||||
|
@ -503,7 +504,7 @@ Project reference `{Path.Combine(setup.ValidRefCsprojRelPath)}` removed.";
|
|||
.WithProject(lib.CsProjPath)
|
||||
.Execute($"\"{libref.CsProjPath}\" \"{validref.CsProjPath}\"");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(OutputText);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(outputText);
|
||||
var csproj = lib.CsProj();
|
||||
csproj.NumberOfItemGroupsWithoutCondition().Should().Be(noCondBefore - 1);
|
||||
csproj.NumberOfProjectReferencesWithIncludeContaining(validref.Name).Should().Be(0);
|
||||
|
|
|
@ -6,12 +6,16 @@
|
|||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-remove-reference.Tests</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
<AssetTargetFallback>$(AssetTargetFallback);dotnet5.4;portable-net451+win8</AssetTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Sln.Internal\Microsoft.DotNet.Cli.Sln.Internal.csproj" />
|
||||
<ProjectReference Include="..\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue