Make Sln.Internal.Tests pass on localized setup
This commit is contained in:
parent
981e3ae19c
commit
38e5b7123a
2 changed files with 25 additions and 10 deletions
|
@ -0,0 +1,7 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.DotNet.Cli.Sln.Internal.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100039ac461fa5c82c7dd2557400c4fd4e9dcdf7ac47e3d572548c04cd4673e004916610f4ea5cbf86f2b1ca1cb824f2a7b3976afecfcf4eb72d9a899aa6786effa10c30399e6580ed848231fec48374e41b3acf8811931343fc2f73acf72dae745adbcb7063cc4b50550618383202875223fc75401351cd89c44bf9b50e7fa3796")]
|
|
@ -303,7 +303,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage($"Invalid format in line {lineNum}: File header is missing version");
|
||||
.WithMessage(FormatError(lineNum, LocalizableStrings.FileHeaderMissingVersionError));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
@ -321,7 +321,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Expected file header not found");
|
||||
.WithMessage(LocalizableStrings.FileHeaderMissingError);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -343,7 +343,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 5: Global section specified more than once");
|
||||
.WithMessage(FormatError(5, LocalizableStrings.GlobalSectionMoreThanOnceError));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -362,7 +362,7 @@ Global
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 3: Global section not closed");
|
||||
.WithMessage(FormatError(3, LocalizableStrings.GlobalSectionNotClosedError));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -381,7 +381,7 @@ Project(""{9A19103F-16F7-4668-BE54-9A1E7A4F7556}"") = ""App"", ""App\App.csproj"
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 3: Project section not closed");
|
||||
.WithMessage(FormatError(3, LocalizableStrings.ProjectSectionNotClosedError));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -402,7 +402,7 @@ EndProject
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 3: Project section is missing '(' when parsing the line starting at position 0");
|
||||
.WithMessage(FormatError(3, LocalizableStrings.ProjectParsingErrorFormatString, "(", 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -424,7 +424,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 4: Invalid section type: thisIsUnknown");
|
||||
.WithMessage(FormatError(4, LocalizableStrings.InvalidSectionTypeError, "thisIsUnknown"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -446,7 +446,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 4: Section id missing");
|
||||
.WithMessage(FormatError(4, LocalizableStrings.SectionIdMissingError));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -467,7 +467,7 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 6: Closing section tag not found");
|
||||
.WithMessage(FormatError(6, LocalizableStrings.ClosingSectionTagNotFoundError));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -496,7 +496,15 @@ EndGlobal
|
|||
};
|
||||
|
||||
action.ShouldThrow<InvalidSolutionFormatException>()
|
||||
.WithMessage("Invalid format in line 7: Property set is missing '.'");
|
||||
.WithMessage(FormatError(7, LocalizableStrings.InvalidPropertySetFormatString, "."));
|
||||
}
|
||||
|
||||
private static string FormatError(int line, string format, params object[] args)
|
||||
{
|
||||
return string.Format(
|
||||
LocalizableStrings.ErrorMessageFormatString,
|
||||
line,
|
||||
string.Format(format, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue