Skip to content

Commit

Permalink
(chocolatey#23) Add tests for install all keyword
Browse files Browse the repository at this point in the history
One test to ensure that if the source is CCR that the install fails.
One test to ensure that all packages are install from a local source.
  • Loading branch information
TheCakeIsNaOH committed Jan 9, 2024
1 parent 0a431fd commit c5217a2
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/chocolatey.tests.integration/scenarios/InstallScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace chocolatey.tests.integration.scenarios
using System.Linq;
using System.Text;
using System.Xml.XPath;
using chocolatey.infrastructure.app;
using chocolatey.infrastructure.app.commands;
using chocolatey.infrastructure.app.configuration;
using chocolatey.infrastructure.app.services;
Expand Down Expand Up @@ -4496,5 +4497,52 @@ public void Should_not_have_warning_package_result()
Results.Should().AllSatisfy(r => r.Value.Warning.Should().BeFalse());
}
}

public class when_installing_all_packages_from_ccr : ScenariosBase
{
public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "all";
Configuration.Sources = ApplicationParameters.ChocolateyCommunityFeedSource;
}

public override void Because()
{
}

[Fact]
public void should_throw_an_error_that_it_is_not_allowed()
{
Action m = () => Service.install_run(Configuration); ;

m.Should().Throw<ApplicationException>();
}
}

public class when_installing_all_packages_from_local_source : ScenariosBase
{
public override void Context()
{
base.Context();
Configuration.PackageNames = Configuration.Input = "all";

Scenario.AddPackagesToSourceLocation(Configuration, "hasdependency.1.0.0*" + NuGetConstants.PackageExtension);
Scenario.AddPackagesToSourceLocation(Configuration, "isdependency.1.0.0*" + NuGetConstants.PackageExtension);
Scenario.AddPackagesToSourceLocation(Configuration, "isexactversiondependency*" + NuGetConstants.PackageExtension);
Scenario.AddPackagesToSourceLocation(Configuration, "upgradepackage*" + NuGetConstants.PackageExtension);
}

public override void Because()
{
Results = Service.install_run(Configuration);
}

[Fact]
public void should_install_all_packages()
{
Results.Should().HaveCount(6);
}
}
}
}

0 comments on commit c5217a2

Please sign in to comment.