mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[PT Run] Improve the Win32 Program Indexing speed (#11364)
This commit is contained in:
@@ -50,6 +50,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
Name = "Microsoft Azure Command Prompt - v2.9",
|
||||
ExecutableName = "cmd.exe",
|
||||
FullPath = "c:\\windows\\system32\\cmd.exe",
|
||||
Arguments = @"/E:ON /V:ON /K ""C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.9\\bin\setenv.cmd""",
|
||||
LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\microsoft azure\\microsoft azure sdk for .net\\v2.9\\microsoft azure command prompt - v2.9.lnk",
|
||||
AppType = Win32Program.ApplicationType.Win32Application,
|
||||
};
|
||||
@@ -59,6 +60,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
Name = "x64 Native Tools Command Prompt for VS 2019",
|
||||
ExecutableName = "cmd.exe",
|
||||
FullPath = "c:\\windows\\system32\\cmd.exe",
|
||||
Arguments = @"/k ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat""",
|
||||
LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\visual studio 2019\\visual studio tools\\vc\\x64 native tools command prompt for vs 2019.lnk",
|
||||
AppType = Win32Program.ApplicationType.Win32Application,
|
||||
};
|
||||
@@ -262,10 +264,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
};
|
||||
|
||||
// Act
|
||||
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
List<Win32Program> apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, apps.Length);
|
||||
Assert.AreEqual(1, apps.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -279,10 +281,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
};
|
||||
|
||||
// Act
|
||||
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
List<Win32Program> apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, apps.Length);
|
||||
Assert.AreEqual(1, apps.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -295,10 +297,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
};
|
||||
|
||||
// Act
|
||||
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
List<Win32Program> apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, apps.Length);
|
||||
Assert.AreEqual(1, apps.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -312,10 +314,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
};
|
||||
|
||||
// Act
|
||||
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
List<Win32Program> apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, apps.Length);
|
||||
Assert.AreEqual(1, apps.Count);
|
||||
Assert.IsTrue(!string.IsNullOrEmpty(apps[0].LnkResolvedPath));
|
||||
}
|
||||
|
||||
@@ -331,10 +333,10 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
};
|
||||
|
||||
// Act
|
||||
Win32Program[] apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
List<Win32Program> apps = Win32Program.DeduplicatePrograms(prgms.AsParallel());
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(3, apps.Length);
|
||||
Assert.AreEqual(3, apps.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
|
||||
// File.ReadAllLines must be mocked for url applications
|
||||
var mockFile = new Mock<IFile>();
|
||||
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
Win32Program.FileWrapper = mockFile.Object;
|
||||
|
||||
string fullPath = directory + "\\" + path;
|
||||
@@ -281,7 +281,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
|
||||
|
||||
// File.ReadAllLines must be mocked for url applications
|
||||
var mockFile = new Mock<IFile>();
|
||||
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
|
||||
Win32Program.FileWrapper = mockFile.Object;
|
||||
|
||||
string oldFullPath = directory + "\\" + oldpath;
|
||||
|
||||
Reference in New Issue
Block a user