diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 2d9515031e..3ef31c147a 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -123,12 +123,12 @@ public ChocolateyPackageService(INugetService nugetService, IPowershellService p _configTransformService = configTransformService; } - public void ensure_source_app_installed(ChocolateyConfiguration config) + public virtual void ensure_source_app_installed(ChocolateyConfiguration config) { perform_source_runner_action(config, r => r.ensure_source_app_installed(config, (packageResult) => handle_package_result(packageResult, config, CommandNameType.install))); } - public int count_run(ChocolateyConfiguration config) + public virtual int count_run(ChocolateyConfiguration config) { return perform_source_runner_function(config, r => r.count_run(config)); } @@ -164,7 +164,7 @@ public void list_noop(ChocolateyConfiguration config) randomly_notify_about_pro_business(config, PRO_BUSINESS_LIST_MESSAGE); } - public IEnumerable list_run(ChocolateyConfiguration config) + public virtual IEnumerable list_run(ChocolateyConfiguration config) { if (string.IsNullOrWhiteSpace(config.Sources) && !config.ListCommand.LocalOnly) { @@ -251,7 +251,7 @@ public void pack_noop(ChocolateyConfiguration config) randomly_notify_about_pro_business(config); } - public void pack_run(ChocolateyConfiguration config) + public virtual void pack_run(ChocolateyConfiguration config) { if (config.SourceType != SourceType.normal) { @@ -275,7 +275,7 @@ public void push_noop(ChocolateyConfiguration config) randomly_notify_about_pro_business(config); } - public void push_run(ChocolateyConfiguration config) + public virtual void push_run(ChocolateyConfiguration config) { if (config.SourceType != SourceType.normal) { @@ -333,7 +333,7 @@ public void randomly_notify_about_pro_business(ChocolateyConfiguration config, s } } - public void handle_package_result(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName) + public virtual void handle_package_result(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName) { EnvironmentSettings.reset_environment_variables(config); set_pending(packageResult, config); @@ -558,7 +558,7 @@ private string capture_arguments(ChocolateyConfiguration config, PackageResult p return NugetEncryptionUtility.EncryptString(arguments.to_string()); } - public ConcurrentDictionary install_run(ChocolateyConfiguration config) + public virtual ConcurrentDictionary install_run(ChocolateyConfiguration config) { this.Log().Info(is_packages_config_file(config.PackageNames) ? @"Installing from config file:" : @"Installing the following packages:"); this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames)); @@ -616,7 +616,7 @@ Would have determined packages that are out of date based on what is installed and what versions are available for upgrade."); } - public void outdated_run(ChocolateyConfiguration config) + public virtual void outdated_run(ChocolateyConfiguration config) { if (config.SourceType != SourceType.normal) { @@ -742,7 +742,7 @@ public void upgrade_noop(ChocolateyConfiguration config) randomly_notify_about_pro_business(config); } - public ConcurrentDictionary upgrade_run(ChocolateyConfiguration config) + public virtual ConcurrentDictionary upgrade_run(ChocolateyConfiguration config) { this.Log().Info(@"Upgrading the following packages:"); this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames)); @@ -820,7 +820,7 @@ public void uninstall_noop(ChocolateyConfiguration config) randomly_notify_about_pro_business(config); } - public ConcurrentDictionary uninstall_run(ChocolateyConfiguration config) + public virtual ConcurrentDictionary uninstall_run(ChocolateyConfiguration config) { this.Log().Info(@"Uninstalling the following packages:"); this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames)); @@ -959,7 +959,7 @@ The recent package changes indicate a reboot is necessary. return failures; } - public void handle_package_uninstall(PackageResult packageResult, ChocolateyConfiguration config) + public virtual void handle_package_uninstall(PackageResult packageResult, ChocolateyConfiguration config) { if (!_fileSystem.directory_exists(packageResult.InstallLocation)) { @@ -1290,7 +1290,7 @@ private void remove_rollback_if_exists(PackageResult packageResult) _nugetService.remove_rollback_directory_if_exists(packageResult.Name); } - public void set_pending(PackageResult packageResult, ChocolateyConfiguration config) + public virtual void set_pending(PackageResult packageResult, ChocolateyConfiguration config) { var packageDirectory = packageResult.InstallLocation; if (string.IsNullOrWhiteSpace(packageDirectory)) return; @@ -1314,7 +1314,7 @@ public void set_pending(PackageResult packageResult, ChocolateyConfiguration con } } - public void remove_pending(PackageResult packageResult, ChocolateyConfiguration config) + public virtual void remove_pending(PackageResult packageResult, ChocolateyConfiguration config) { var packageDirectory = packageResult.InstallLocation; if (string.IsNullOrWhiteSpace(packageDirectory)) return; diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 5682a22540..63159fd59d 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -872,7 +872,7 @@ public virtual ConcurrentDictionary upgrade_run(Chocolate return packageInstalls; } - public ConcurrentDictionary get_outdated(ChocolateyConfiguration config) + public virtual ConcurrentDictionary get_outdated(ChocolateyConfiguration config) { var packageManager = NugetCommon.GetPackageManager( config,