mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
Audit culture bugs (#7707)
* Added comments and fixed CultureInfo / StringComparison where appropriate * Addressed comments * Fixed comment
This commit is contained in:
@@ -69,8 +69,10 @@ namespace Microsoft.Plugin.Folder.UnitTests
|
||||
{
|
||||
// Setup
|
||||
var folderHelperMock = new Mock<IFolderHelper>();
|
||||
|
||||
// Using Ordinal since this is used with paths
|
||||
folderHelperMock.Setup(r => r.IsDriveOrSharedFolder(It.IsAny<string>()))
|
||||
.Returns<string>(s => s.StartsWith("C:", StringComparison.CurrentCultureIgnoreCase));
|
||||
.Returns<string>(s => s.StartsWith("C:", StringComparison.Ordinal));
|
||||
|
||||
var itemResultMock = new Mock<IItemResult>();
|
||||
|
||||
|
||||
@@ -73,15 +73,17 @@ namespace Microsoft.Plugin.Folder.UnitTests
|
||||
switch (isRecursive)
|
||||
{
|
||||
case false:
|
||||
folderSearchFunc = s => s.Equals(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
// Using Ordinal since this is internal
|
||||
folderSearchFunc = s => s.Equals(search, StringComparison.Ordinal);
|
||||
|
||||
var regexSearch = TrimDirectoryEnd(search);
|
||||
|
||||
fileSearchFunc = s => Regex.IsMatch(s, $"^{Regex.Escape(regexSearch)}[^\\\\]*$");
|
||||
break;
|
||||
case true:
|
||||
folderSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
fileSearchFunc = s => s.StartsWith(search, StringComparison.CurrentCultureIgnoreCase);
|
||||
// Using Ordinal since this is internal
|
||||
folderSearchFunc = s => s.StartsWith(search, StringComparison.Ordinal);
|
||||
fileSearchFunc = s => s.StartsWith(search, StringComparison.Ordinal);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user