diff --git a/src/Microsoft.DotNet.Cli.Sln.Internal/Properties/AssemblyInfo.cs b/src/Microsoft.DotNet.Cli.Sln.Internal/Properties/AssemblyInfo.cs index 0178c5cfb..8a1f4b3fb 100644 --- a/src/Microsoft.DotNet.Cli.Sln.Internal/Properties/AssemblyInfo.cs +++ b/src/Microsoft.DotNet.Cli.Sln.Internal/Properties/AssemblyInfo.cs @@ -5,3 +5,5 @@ using System.Reflection; using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Sln.Internal.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")] +[assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] + diff --git a/src/dotnet/Properties/AssemblyInfo.cs b/src/dotnet/Properties/AssemblyInfo.cs index ed811a3b5..09f76128b 100644 --- a/src/dotnet/Properties/AssemblyInfo.cs +++ b/src/dotnet/Properties/AssemblyInfo.cs @@ -7,4 +7,5 @@ using System.Runtime.CompilerServices; [assembly: AssemblyMetadataAttribute("Serviceable", "True")] [assembly: InternalsVisibleTo("dotnet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet-help.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("dotnet-msbuild.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs b/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs index 858b89780..f0d190fbb 100644 --- a/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs +++ b/test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs @@ -3,6 +3,7 @@ using FluentAssertions; using Microsoft.DotNet.Cli.Sln.Internal; +using Microsoft.DotNet.Tools; using Microsoft.DotNet.Tools.Test.Utilities; using System; using System.IO; @@ -182,7 +183,7 @@ EndGlobal var cmd = new DotnetCommand() .ExecuteWithCapturedOutput($"sln remove {helpArg}"); cmd.Should().Pass(); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -191,7 +192,7 @@ EndGlobal var cmd = new DotnetCommand() .ExecuteWithCapturedOutput("sln one.sln two.sln three.sln remove"); cmd.Should().Fail(); - cmd.StdErr.Should().BeVisuallyEquivalentTo("Unrecognized command or argument 'two.sln'\r\nUnrecognized command or argument 'three.sln'\r\nYou must specify at least one project to remove."); + cmd.StdErr.Should().BeVisuallyEquivalentTo($"Unrecognized command or argument 'two.sln'\r\nUnrecognized command or argument 'three.sln'\r\n{CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove}"); } [Theory] @@ -202,8 +203,8 @@ EndGlobal var cmd = new DotnetCommand() .ExecuteWithCapturedOutput($"sln {commandName}"); cmd.Should().Fail(); - cmd.StdErr.Should().Be("Required command was not provided."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(SlnCommandHelpText); + cmd.StdErr.Should().Be(CommonLocalizableStrings.RequiredCommandNotPassed); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(SlnCommandHelpText); } [Theory] @@ -217,8 +218,8 @@ EndGlobal var cmd = new DotnetCommand() .ExecuteWithCapturedOutput($"sln {solutionName} remove p.csproj"); cmd.Should().Fail(); - cmd.StdErr.Should().Be($"Could not find solution or directory `{solutionName}`."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.CouldNotFindSolutionOrDirectory, solutionName)); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -236,8 +237,8 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput($"sln InvalidSolution.sln remove {projectToRemove}"); cmd.Should().Fail(); - cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Expected file header not found."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.InvalidSolutionFormatString, "InvalidSolution.sln", LocalizableStrings.FileHeaderMissingError)); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -256,8 +257,8 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput($"sln remove {projectToRemove}"); cmd.Should().Fail(); - cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Expected file header not found."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.InvalidSolutionFormatString, solutionPath, LocalizableStrings.FileHeaderMissingError)); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -274,8 +275,8 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput(@"sln App.sln remove"); cmd.Should().Fail(); - cmd.StdErr.Should().Be("You must specify at least one project to remove."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -293,8 +294,8 @@ EndGlobal .WithWorkingDirectory(solutionPath) .ExecuteWithCapturedOutput(@"sln remove App.csproj"); cmd.Should().Fail(); - cmd.StdErr.Should().Be($"Specified solution file {solutionPath + Path.DirectorySeparatorChar} does not exist, or there is no solution file in the directory."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.SolutionDoesNotExist, solutionPath + Path.DirectorySeparatorChar)); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -312,8 +313,8 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput($"sln remove {projectToRemove}"); cmd.Should().Fail(); - cmd.StdErr.Should().Be($"Found more than one solution file in {projectDirectory + Path.DirectorySeparatorChar}. Please specify which one to use."); - cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); + cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.MoreThanOneSolutionInDirectory, projectDirectory + Path.DirectorySeparatorChar)); + cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText); } [Fact] @@ -332,7 +333,7 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput("sln remove referenceDoesNotExistInSln.csproj"); cmd.Should().Pass(); - cmd.StdOut.Should().Be("Project reference `referenceDoesNotExistInSln.csproj` could not be found."); + cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, "referenceDoesNotExistInSln.csproj")); File.ReadAllText(solutionPath) .Should().BeVisuallyEquivalentTo(contentBefore); } @@ -356,7 +357,7 @@ EndGlobal .WithWorkingDirectory(projectDirectory) .ExecuteWithCapturedOutput($"sln remove {projectToRemove}"); cmd.Should().Pass(); - cmd.StdOut.Should().Be($"Project reference `{projectToRemove}` removed."); + cmd.StdOut.Should().Be(string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, projectToRemove)); slnFile = SlnFile.Read(solutionPath); slnFile.Projects.Count.Should().Be(1); @@ -383,8 +384,8 @@ EndGlobal .ExecuteWithCapturedOutput($"sln remove {projectToRemove}"); cmd.Should().Pass(); - string outputText = $@"Project reference `{projectToRemove}` removed. -Project reference `{projectToRemove}` removed."; + string outputText = string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, projectToRemove); + outputText += Environment.NewLine + outputText; cmd.StdOut.Should().BeVisuallyEquivalentTo(outputText); slnFile = SlnFile.Read(solutionPath); @@ -412,9 +413,10 @@ Project reference `{projectToRemove}` removed."; .ExecuteWithCapturedOutput($"sln remove idontexist.csproj {projectToRemove} idontexisteither.csproj"); cmd.Should().Pass(); - string outputText = $@"Project reference `idontexist.csproj` could not be found. -Project reference `{projectToRemove}` removed. -Project reference `idontexisteither.csproj` could not be found."; + string outputText = $@"{string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, "idontexist.csproj")} +{string.Format(CommonLocalizableStrings.ProjectReferenceRemoved, projectToRemove)} +{string.Format(CommonLocalizableStrings.ProjectReferenceCouldNotBeFound, "idontexisteither.csproj")}"; + cmd.StdOut.Should().BeVisuallyEquivalentTo(outputText); slnFile = SlnFile.Read(solutionPath); diff --git a/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj b/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj index 77ec8a398..682d91afa 100644 --- a/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj +++ b/test/dotnet-sln-remove.Tests/dotnet-sln-remove.Tests.csproj @@ -6,6 +6,9 @@ $(CLI_SharedFrameworkVersion) true dotnet-sln-remove.Tests + ../../tools/Key.snk + true + true $(PackageTargetFallback);dotnet5.4;portable-net451+win8 @@ -15,6 +18,7 @@ +