public void Execute_NoValidPackageIdIsSupplied_GenealCleanupIsCalled(string packageId) { // Arrange var userInterface = new Mock<IUserInterface>(); var cleanupService = new Mock<ICleanupService>(); cleanupService.Setup(c => c.Cleanup()).Returns(new SuccessResult()); var cleanupCommand = new CleanupCommand(userInterface.Object, cleanupService.Object); cleanupCommand.Arguments.Add(CleanupCommand.ArgumentNameNugetPackageId, packageId); // Act cleanupCommand.Execute(); // Assert cleanupService.Verify(c => c.Cleanup(), Times.Once()); }
public void Execute_PackageIdIsSupplied_PackageSpecificCleanupIsCalled() { // Arrange string packageId = "Package.A"; var userInterface = new Mock<IUserInterface>(); var cleanupService = new Mock<ICleanupService>(); cleanupService.Setup(c => c.Cleanup(It.IsAny<string>())).Returns(new SuccessResult()); var cleanupCommand = new CleanupCommand(userInterface.Object, cleanupService.Object); cleanupCommand.Arguments.Add(CleanupCommand.ArgumentNameNugetPackageId, packageId); // Act cleanupCommand.Execute(); // Assert cleanupService.Verify(c => c.Cleanup(packageId), Times.Once()); }