private void test_installertype(IInstaller installer, bool useInstallerDefaultArgs) { reset(); registryKeys.Add(new RegistryApplicationKey { InstallLocation = @"C:\Program Files (x86)\WinDirStat", UninstallString = "{0} {1}".format_with(originalUninstallString, registryUninstallArgs), HasQuietUninstall = false, KeyPath = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat", InstallerType = installer.InstallerType, }); packageInformation.RegistrySnapshot = new Registry("123", registryKeys); because(); var uninstallArgs = useInstallerDefaultArgs ? installer.build_uninstall_command_arguments().trim_safe() : registryUninstallArgs.trim_safe(); commandExecutor.Verify(c => c.execute(expectedUninstallString, uninstallArgs, It.IsAny <int>(), It.IsAny <Action <object, DataReceivedEventArgs> >(), It.IsAny <Action <object, DataReceivedEventArgs> >()), Times.Never); }
private void test_installertype(IInstaller installer, bool hasQuietUninstallString) { reset(); registryKeys.Add(new RegistryApplicationKey { InstallLocation = @"C:\Program Files (x86)\WinDirStat", UninstallString = "{0} {1}".format_with(originalUninstallString, registryUninstallArgs), HasQuietUninstall = hasQuietUninstallString, KeyPath = @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinDirStat", InstallerType = installer.InstallerType, }); packageInformation.RegistrySnapshot = new Registry("123", registryKeys); fileSystem.Setup(x => x.combine_paths(config.CacheLocation, "chocolatey", It.IsAny<string>(), It.IsAny<string>())).Returns(logLocation); because(); var installerTypeArgs = installer.build_uninstall_command_arguments().trim_safe().Replace(InstallTokens.PACKAGE_LOCATION, logLocation); var uninstallArgs = !hasQuietUninstallString ? registryUninstallArgs.trim_safe() + " " + installerTypeArgs : registryUninstallArgs.trim_safe(); commandExecutor.Verify(c => c.execute(expectedUninstallString, uninstallArgs.trim_safe(), It.IsAny<int>(), It.IsAny<Action<object, DataReceivedEventArgs>>(), It.IsAny<Action<object, DataReceivedEventArgs>>(), It.IsAny<bool>()), Times.Once); }