33
44using FluentAssertions ;
55using Microsoft . Build . Construction ;
6+ using Microsoft . DotNet . Tools ;
67using Microsoft . DotNet . Tools . Test . Utilities ;
78using Msbuild . Tests . Utilities ;
89using System ;
@@ -50,7 +51,7 @@ public void WhenHelpOptionIsPassedItPrintsUsage(string helpArg)
5051 {
5152 var cmd = new ListReferenceCommand ( ) . Execute ( helpArg ) ;
5253 cmd . Should ( ) . Pass ( ) ;
53- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ;
54+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( HelpText ) ;
5455 }
5556
5657 [ Theory ]
@@ -61,8 +62,8 @@ public void WhenNoCommandIsPassedItPrintsError(string commandName)
6162 var cmd = new DotnetCommand ( )
6263 . ExecuteWithCapturedOutput ( $ "list { commandName } ") ;
6364 cmd . Should ( ) . Fail ( ) ;
64- cmd . StdErr . Should ( ) . Be ( "Required command was not provided." ) ;
65- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( ListCommandHelpText ) ;
65+ cmd . StdErr . Should ( ) . Be ( CommonLocalizableStrings . RequiredCommandNotPassed ) ;
66+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( ListCommandHelpText ) ;
6667 }
6768
6869 [ Fact ]
@@ -88,8 +89,8 @@ public void WhenNonExistingProjectIsPassedItPrintsErrorAndUsage(string projName)
8889 . WithProject ( projName )
8990 . Execute ( $ "\" { setup . ValidRefCsprojPath } \" ") ;
9091 cmd . ExitCode . Should ( ) . NotBe ( 0 ) ;
91- cmd . StdErr . Should ( ) . Be ( $ "Could not find project or directory ` { projName } `." ) ;
92- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ;
92+ cmd . StdErr . Should ( ) . Be ( string . Format ( CommonLocalizableStrings . CouldNotFindProjectOrDirectory , projName ) ) ;
93+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( HelpText ) ;
9394 }
9495
9596 [ Fact ]
@@ -103,8 +104,8 @@ public void WhenBrokenProjectIsPassedItPrintsErrorAndUsage()
103104 . WithProject ( projName )
104105 . Execute ( $ "\" { setup . ValidRefCsprojPath } \" ") ;
105106 cmd . ExitCode . Should ( ) . NotBe ( 0 ) ;
106- cmd . StdErr . Should ( ) . Be ( "Project ` Broken/Broken.csproj` is invalid." ) ;
107- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ;
107+ cmd . StdErr . Should ( ) . Be ( string . Format ( CommonLocalizableStrings . ProjectIsInvalid , " Broken/Broken.csproj" ) ) ;
108+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( HelpText ) ;
108109 }
109110
110111 [ Fact ]
@@ -117,8 +118,8 @@ public void WhenMoreThanOneProjectExistsInTheDirectoryItPrintsErrorAndUsage()
117118 . WithWorkingDirectory ( workingDir )
118119 . Execute ( $ "\" { setup . ValidRefCsprojRelToOtherProjPath } \" ") ;
119120 cmd . ExitCode . Should ( ) . NotBe ( 0 ) ;
120- cmd . StdErr . Should ( ) . Be ( $ "Found more than one project in ` { workingDir + Path . DirectorySeparatorChar } `. Please specify which one to use." ) ;
121- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ;
121+ cmd . StdErr . Should ( ) . Be ( string . Format ( CommonLocalizableStrings . MoreThanOneProjectInDirectory , workingDir + Path . DirectorySeparatorChar ) ) ;
122+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( HelpText ) ;
122123 }
123124
124125 [ Fact ]
@@ -130,8 +131,8 @@ public void WhenNoProjectsExistsInTheDirectoryItPrintsErrorAndUsage()
130131 . WithWorkingDirectory ( setup . TestRoot )
131132 . Execute ( $ "\" { setup . ValidRefCsprojPath } \" ") ;
132133 cmd . ExitCode . Should ( ) . NotBe ( 0 ) ;
133- cmd . StdErr . Should ( ) . Be ( $ "Could not find any project in ` { setup . TestRoot + Path . DirectorySeparatorChar } `." ) ;
134- cmd . StdOut . Should ( ) . BeVisuallyEquivalentTo ( HelpText ) ;
134+ cmd . StdErr . Should ( ) . Be ( string . Format ( CommonLocalizableStrings . CouldNotFindAnyProjectInDirectory , setup . TestRoot + Path . DirectorySeparatorChar ) ) ;
135+ cmd . StdOut . Should ( ) . BeVisuallyEquivalentToIfNotLocalized ( HelpText ) ;
135136 }
136137
137138 [ Fact ]
@@ -143,14 +144,15 @@ public void WhenNoProjectReferencesArePresentInTheProjectItPrintsError()
143144 . WithProject ( lib . CsProjPath )
144145 . Execute ( ) ;
145146 cmd . Should ( ) . Pass ( ) ;
146- 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). " ) ;
147+ cmd . StdOut . Should ( ) . Be ( string . Format ( CommonLocalizableStrings . NoReferencesFound , CommonLocalizableStrings . P2P , lib . CsProjPath ) ) ;
147148 }
148149
149150 [ Fact ]
150151 public void ItPrintsSingleReference ( )
151152 {
152- const string OutputText = @"Project reference(s)
153- --------------------
153+ string OutputText = CommonLocalizableStrings . ProjectReferenceOneOrMore ;
154+ OutputText += $@ "
155+ { new string ( '-' , OutputText . Length ) }
154156..\ref\ref.csproj" ;
155157
156158 var lib = NewLib ( "lib" ) ;
@@ -167,8 +169,9 @@ public void ItPrintsSingleReference()
167169 [ Fact ]
168170 public void ItPrintsMultipleReferences ( )
169171 {
170- const string OutputText = @"Project reference(s)
171- --------------------
172+ string OutputText = CommonLocalizableStrings . ProjectReferenceOneOrMore ;
173+ OutputText += $@ "
174+ { new string ( '-' , OutputText . Length ) }
172175..\ref1\ref1.csproj
173176..\ref2\ref2.csproj
174177..\ref3\ref3.csproj" ;
0 commit comments