@@ -303,7 +303,7 @@ public void WhenGivenASolutionWithMissingHeaderVersionItThrows(string fileConten
303303 } ;
304304
305305 action . ShouldThrow < InvalidSolutionFormatException > ( )
306- . WithMessage ( $ "Invalid format in line { lineNum } : File header is missing version" ) ;
306+ . WithMessage ( FormatError ( lineNum , LocalizableStrings . FileHeaderMissingVersionError ) ) ;
307307 }
308308
309309 [ Theory ]
@@ -321,7 +321,7 @@ public void WhenGivenASolutionWithMissingHeaderItThrows(string fileContents)
321321 } ;
322322
323323 action . ShouldThrow < InvalidSolutionFormatException > ( )
324- . WithMessage ( "Expected file header not found" ) ;
324+ . WithMessage ( LocalizableStrings . FileHeaderMissingError ) ;
325325 }
326326
327327 [ Fact ]
@@ -343,7 +343,7 @@ public void WhenGivenASolutionWithMultipleGlobalSectionsItThrows()
343343 } ;
344344
345345 action . ShouldThrow < InvalidSolutionFormatException > ( )
346- . WithMessage ( "Invalid format in line 5: Global section specified more than once" ) ;
346+ . WithMessage ( FormatError ( 5 , LocalizableStrings . GlobalSectionMoreThanOnceError ) ) ;
347347 }
348348
349349 [ Fact ]
@@ -362,7 +362,7 @@ public void WhenGivenASolutionWithGlobalSectionNotClosedItThrows()
362362 } ;
363363
364364 action . ShouldThrow < InvalidSolutionFormatException > ( )
365- . WithMessage ( "Invalid format in line 3: Global section not closed" ) ;
365+ . WithMessage ( FormatError ( 3 , LocalizableStrings . GlobalSectionNotClosedError ) ) ;
366366 }
367367
368368 [ Fact ]
@@ -381,7 +381,7 @@ public void WhenGivenASolutionWithProjectSectionNotClosedItThrows()
381381 } ;
382382
383383 action . ShouldThrow < InvalidSolutionFormatException > ( )
384- . WithMessage ( "Invalid format in line 3: Project section not closed" ) ;
384+ . WithMessage ( FormatError ( 3 , LocalizableStrings . ProjectSectionNotClosedError ) ) ;
385385 }
386386
387387 [ Fact ]
@@ -402,7 +402,7 @@ public void WhenGivenASolutionWithInvalidProjectSectionItThrows()
402402 } ;
403403
404404 action . ShouldThrow < InvalidSolutionFormatException > ( )
405- . WithMessage ( "Invalid format in line 3: Project section is missing '(' when parsing the line starting at position 0" ) ;
405+ . WithMessage ( FormatError ( 3 , LocalizableStrings . ProjectParsingErrorFormatString , "(" , 0 ) ) ;
406406 }
407407
408408 [ Fact ]
@@ -424,7 +424,7 @@ public void WhenGivenASolutionWithInvalidSectionTypeItThrows()
424424 } ;
425425
426426 action . ShouldThrow < InvalidSolutionFormatException > ( )
427- . WithMessage ( "Invalid format in line 4: Invalid section type: thisIsUnknown") ;
427+ . WithMessage ( FormatError ( 4 , LocalizableStrings . InvalidSectionTypeError , " thisIsUnknown") ) ;
428428 }
429429
430430 [ Fact ]
@@ -446,7 +446,7 @@ public void WhenGivenASolutionWithMissingSectionIdTypeItThrows()
446446 } ;
447447
448448 action . ShouldThrow < InvalidSolutionFormatException > ( )
449- . WithMessage ( "Invalid format in line 4: Section id missing" ) ;
449+ . WithMessage ( FormatError ( 4 , LocalizableStrings . SectionIdMissingError ) ) ;
450450 }
451451
452452 [ Fact ]
@@ -467,7 +467,7 @@ public void WhenGivenASolutionWithSectionNotClosedItThrows()
467467 } ;
468468
469469 action . ShouldThrow < InvalidSolutionFormatException > ( )
470- . WithMessage ( "Invalid format in line 6: Closing section tag not found" ) ;
470+ . WithMessage ( FormatError ( 6 , LocalizableStrings . ClosingSectionTagNotFoundError ) ) ;
471471 }
472472
473473 [ Fact ]
@@ -496,7 +496,15 @@ public void WhenGivenASolutionWithInvalidPropertySetItThrows()
496496 } ;
497497
498498 action . ShouldThrow < InvalidSolutionFormatException > ( )
499- . WithMessage ( "Invalid format in line 7: Property set is missing '.'" ) ;
499+ . WithMessage ( FormatError ( 7 , LocalizableStrings . InvalidPropertySetFormatString , "." ) ) ;
500+ }
501+
502+ private static string FormatError ( int line , string format , params object [ ] args )
503+ {
504+ return string . Format (
505+ LocalizableStrings . ErrorMessageFormatString ,
506+ line ,
507+ string . Format ( format , args ) ) ;
500508 }
501509 }
502510}
0 commit comments