mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
Fix for File Not Found exception while indexing invalid Package App (#4971)
* Catching file not found exception * removed unnecessary header files * Added a string.empty check for installed location * reusing package wrapper instead of package installing event args
This commit is contained in:
@@ -72,5 +72,23 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
Assert.AreEqual(applications.Length, 1);
|
||||
Assert.IsTrue(applications.FindAll(x => x.Name == "PackagedApp").Length > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PowerToysRun_ShouldNotAddInvalidApp_WhenIndexingUWPApplications()
|
||||
{
|
||||
// Arrange
|
||||
PackageWrapper invalidPackagedApp = new PackageWrapper();
|
||||
Main._settings = new Settings();
|
||||
List<IPackage> packages = new List<IPackage>() {invalidPackagedApp };
|
||||
var mock = new Mock<IPackageManager>();
|
||||
mock.Setup(x => x.FindPackagesForCurrentUser()).Returns(packages);
|
||||
UWP.PackageManagerWrapper = mock.Object;
|
||||
|
||||
// Act
|
||||
var applications = UWP.All();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(applications.Length, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user