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:
Alekhya
2020-07-14 11:44:50 -07:00
committed by GitHub
parent 74412766fa
commit f59abe23c3
3 changed files with 45 additions and 12 deletions

View File

@@ -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);
}
}
}