Skip to content

Commit

Permalink
Merge pull request #2997 from TheCakeIsNaOH/finish-pin-tests
Browse files Browse the repository at this point in the history
(#2501) Complete pending Pin command tests
  • Loading branch information
gep13 authored Jan 25, 2023
2 parents f2b0590 + 2eddb5c commit c0e2f84
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ public override void Context()
configuration.Sources = ApplicationParameters.PackagesLocation;
configuration.ListCommand.LocalOnly = true;
configuration.AllVersions = true;

var packageResults = new[]
{
new PackageResult(package.Object, null),
new PackageResult(pinnedPackage.Object, null)
};
nugetService.Setup(n => n.list_run(It.IsAny<ChocolateyConfiguration>())).Returns(packageResults);
}

public new void reset()
Expand Down Expand Up @@ -428,34 +435,27 @@ public void should_call_nuget_service_list_run_when_command_is_list()
nugetService.Verify(n => n.list_run(It.IsAny<ChocolateyConfiguration>()), Times.Once);
}

[Pending("NuGet is killing me with extension methods. Need to find proper item to mock out to return the package object."), Category("Pending")]
[Fact]
public void should_set_pin_when_command_is_add()
{
reset();

configuration.PinCommand.Name = "regular";
//packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
//NuGetVersion nugetVersion = null;
//nuget woes
//localRepository.Setup(r => r.FindPackage(configuration.PinCommand.Name, nugetVersion)).Returns(package.Object);
configuration.PinCommand.Command = PinCommandType.add;

//command.set_pin(packageManager.Object, configuration);
command.set_pin(configuration);

packageInfoService.Verify(s => s.save_package_information(It.IsAny<ChocolateyPackageInformation>()), Times.Once);
}

[Pending("NuGet is killing me with extension methods. Need to find proper item to mock out to return the package object."), Category("Pending")]
[Fact]
public void should_remove_pin_when_command_is_remove()
{
reset();
configuration.PinCommand.Name = "pinned";
// packageManager.Setup(pm => pm.LocalRepository).Returns(localRepository.Object);
configuration.PinCommand.Command = PinCommandType.remove;

//command.set_pin(packageManager.Object, configuration);
command.set_pin(configuration);

packageInfoService.Verify(s => s.save_package_information(It.IsAny<ChocolateyPackageInformation>()), Times.Once);
}
Expand Down

0 comments on commit c0e2f84

Please sign in to comment.