Execute() 공개 메소드

public Execute ( ) : bool
리턴 bool
예제 #1
0
        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());
        }
예제 #2
0
        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());
        }