public override void Context() { CommandExecutor.initialize_with(new Lazy<IFileSystem>(() => fileSystem.Object), () => process.Object); service = new AutomaticUninstallerService(packageInfoService.Object, fileSystem.Object, registryService.Object, commandExecutor.Object); service.WaitForCleanup = false; config.Features.AutoUninstaller = true; config.PromptForConfirmation = false; package.Setup(p => p.Id).Returns("regular"); package.Setup(p => p.Version).Returns(new SemanticVersion("1.2.0")); packageResult = new PackageResult(package.Object, null); packageInformation = new ChocolateyPackageInformation(package.Object); registryKeys.Add(new RegistryApplicationKey { InstallLocation = @"C:\Program Files (x86)\WinDirStat", UninstallString = originalUninstallString, HasQuietUninstall = true, KeyPath = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat", InstallerType = installerType.InstallerType, }); packageInformation.RegistrySnapshot = new Registry("123", registryKeys); packageInfoService.Setup(s => s.get_package_information(package.Object)).Returns(packageInformation); packageResults.GetOrAdd("regular", packageResult); fileSystem.Setup(f => f.directory_exists(registryKeys.FirstOrDefault().InstallLocation)).Returns(true); registryService.Setup(r => r.installer_value_exists(registryKeys.FirstOrDefault().KeyPath, ApplicationParameters.RegistryValueInstallLocation)).Returns(true); fileSystem.Setup(f => f.get_full_path(expectedUninstallString)).Returns(expectedUninstallString); }
public override void Context() { base.Context(); package.Setup(x => x.Id).Returns("bob"); packageInfo = new ChocolateyPackageInformation(package.Object); packageInfo.FilesSnapshot = new PackageFiles(); packageFiles = new PackageFiles(); fileSystem.Setup(x => x.directory_exists(It.IsAny<string>())).Returns(true); }