Skip to content

Commit

Permalink
desperate try
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed Sep 1, 2023
1 parent 0a56e28 commit 5d7b3fb
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/AppInstallerCLIE2ETests/Interop/CheckInstalledStatusInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,43 +253,6 @@ public async Task CheckInstalledStatusArpVersionMatchedFileHashMisMatch()
Assert.AreEqual(Constants.ErrorCode.INSTALLED_STATUS_FILE_FOUND_WITHOUT_HASH_CHECK, GetHResultFromInstalledStatus(installerInstalledStatus.InstallerInstalledStatus[3]));
}

/// <summary>
/// Test arp entries default install location not found.
/// </summary>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
[Test]
public async Task CheckInstalledStatusArpNotFoundDefaultInstallLocationFound()
{
// Add the data file listed in the manifest to default install location.
Directory.CreateDirectory(this.defaultInstallDir);
File.WriteAllText(Path.Combine(this.defaultInstallDir, "data.txt"), "Test");

// Search from composite source without installation
var options = this.TestFactory.CreateCreateCompositePackageCatalogOptions();
options.Catalogs.Add(this.testSource);
options.CompositeSearchBehavior = CompositeSearchBehavior.AllCatalogs;
var compositeSource = this.packageManager.CreateCompositePackageCatalog(options);
var searchResult = this.FindOnePackage(compositeSource, PackageMatchField.Id, PackageFieldMatchOption.Equals, "AppInstallerTest.TestCheckInstalledStatus");

// Check installed status
var checkResult = await searchResult.CatalogPackage.CheckInstalledStatusAsync();
Assert.AreEqual(CheckInstalledStatusResultStatus.Ok, checkResult.Status);
Assert.AreEqual(1, checkResult.PackageInstalledStatus.Count);

var installerInstalledStatus = checkResult.PackageInstalledStatus[0];
Assert.AreEqual(InstalledStatusType.AppsAndFeaturesEntry, installerInstalledStatus.InstallerInstalledStatus[0].Type);
Assert.AreEqual(Constants.ErrorCode.INSTALLED_STATUS_ARP_ENTRY_NOT_FOUND, GetHResultFromInstalledStatus(installerInstalledStatus.InstallerInstalledStatus[0]));
Assert.AreEqual(InstalledStatusType.DefaultInstallLocation, installerInstalledStatus.InstallerInstalledStatus[1].Type);
Assert.AreEqual(this.defaultInstallDir, Path.GetFullPath(installerInstalledStatus.InstallerInstalledStatus[1].Path));
Assert.AreEqual(Constants.ErrorCode.S_OK, GetHResultFromInstalledStatus(installerInstalledStatus.InstallerInstalledStatus[1]));
Assert.AreEqual(InstalledStatusType.DefaultInstallLocationFile, installerInstalledStatus.InstallerInstalledStatus[2].Type);
Assert.AreEqual(Path.Combine(this.defaultInstallDir, "data.txt"), Path.GetFullPath(installerInstalledStatus.InstallerInstalledStatus[2].Path));
Assert.AreEqual(Constants.ErrorCode.INSTALLED_STATUS_FILE_FOUND_WITHOUT_HASH_CHECK, GetHResultFromInstalledStatus(installerInstalledStatus.InstallerInstalledStatus[2]));
Assert.AreEqual(InstalledStatusType.DefaultInstallLocationFile, installerInstalledStatus.InstallerInstalledStatus[3].Type);
Assert.AreEqual(Path.Combine(this.defaultInstallDir, "TestExeInstalled.txt"), Path.GetFullPath(installerInstalledStatus.InstallerInstalledStatus[3].Path));
Assert.AreEqual(Constants.ErrorCode.INSTALLED_STATUS_FILE_NOT_FOUND, GetHResultFromInstalledStatus(installerInstalledStatus.InstallerInstalledStatus[3]));
}

// CsWinrt maps success error codes(e.g. INSTALLED_STATUS_INSTALL_LOCATION_NOT_APPLICABLE) to null exception.
// In this case we cannot get the exact hresult by calling winrt projection api.
// This method is created to directly get hresult from the InstalledStatus object for the tests to compare.
Expand Down

0 comments on commit 5d7b3fb

Please sign in to comment.