Make dotnet-sln-list.Tests pass on localized setup
This commit is contained in:
parent
0a4e05b0bb
commit
5da3bfdd6a
4 changed files with 25 additions and 16 deletions
|
@ -5,5 +5,7 @@ using System.Reflection;
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Sln.Internal.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-list.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
||||
|
||||
|
|
|
@ -9,5 +9,6 @@ using System.Runtime.CompilerServices;
|
|||
[assembly: InternalsVisibleTo("dotnet-add-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-help.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-remove-package.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-list.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-sln-remove.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("dotnet-msbuild.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
|
|
|
@ -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;
|
||||
|
@ -48,7 +49,7 @@ Commands:
|
|||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput($"sln list {helpArg}");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -59,8 +60,8 @@ Commands:
|
|||
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);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -83,8 +84,8 @@ Commands:
|
|||
var cmd = new DotnetCommand()
|
||||
.ExecuteWithCapturedOutput($"sln {solutionName} list");
|
||||
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]
|
||||
|
@ -101,8 +102,8 @@ Commands:
|
|||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("sln InvalidSolution.sln list");
|
||||
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]
|
||||
|
@ -120,8 +121,8 @@ Commands:
|
|||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("sln list");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be($"Invalid solution `{solutionFullPath}`. Expected file header not found.");
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
|
||||
cmd.StdErr.Should().Be(string.Format(CommonLocalizableStrings.InvalidSolutionFormatString, solutionFullPath, LocalizableStrings.FileHeaderMissingError));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -139,8 +140,8 @@ Commands:
|
|||
.WithWorkingDirectory(solutionDir)
|
||||
.ExecuteWithCapturedOutput("sln list");
|
||||
cmd.Should().Fail();
|
||||
cmd.StdErr.Should().Be($"Specified solution file {solutionDir + 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, solutionDir + Path.DirectorySeparatorChar));
|
||||
cmd.StdOut.Should().BeVisuallyEquivalentToIfNotLocalized(HelpText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -157,8 +158,8 @@ Commands:
|
|||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("sln list");
|
||||
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]
|
||||
|
@ -175,14 +176,15 @@ Commands:
|
|||
.WithWorkingDirectory(projectDirectory)
|
||||
.ExecuteWithCapturedOutput("sln list");
|
||||
cmd.Should().Pass();
|
||||
cmd.StdOut.Should().Be("No projects found in the solution.");
|
||||
cmd.StdOut.Should().Be(CommonLocalizableStrings.NoProjectsFound);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenProjectReferencesArePresentInTheSolutionItListsThem()
|
||||
{
|
||||
string OutputText = $@"Project reference(s)
|
||||
--------------------
|
||||
string OutputText = CommonLocalizableStrings.ProjectReferenceOneOrMore;
|
||||
OutputText += $@"
|
||||
{new string('-', OutputText.Length)}
|
||||
{Path.Combine("App", "App.csproj")}
|
||||
{Path.Combine("Lib", "Lib.csproj")}";
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<RuntimeFrameworkVersion>$(CLI_SharedFrameworkVersion)</RuntimeFrameworkVersion>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-sln-list.Tests</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -15,6 +18,7 @@
|
|||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj" />
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue