Execute() public method

public Execute ( ) : bool
return bool
Exemplo n.º 1
1
        public void Execute_NoPackageIdIsSupplied_InstallIsNotExecuted()
        {
            // Arrange
            var packageUninstaller = new Mock<IPackageUninstaller>();

            var uninstallCommand = new UninstallCommand(this.loggingUserInterface.UserInterface, packageUninstaller.Object);

            // prepare arguments
            uninstallCommand.Arguments = new Dictionary<string, string>();

            // Act
            uninstallCommand.Execute();

            // Assert
            packageUninstaller.Verify(p => p.Uninstall(It.IsAny<string>(), It.IsAny<SemanticVersion>()), Times.Never());
        }
Exemplo n.º 2
0
        public void Execute_UninstallSucceeds_MessageIsWrittenToUserInterface()
        {
            // Arrange
            string packageId = "Package.A";

            var packageUninstaller = new Mock<IPackageUninstaller>();
            packageUninstaller.Setup(p => p.Uninstall(packageId, It.IsAny<SemanticVersion>())).Returns(new SuccessResult());

            var uninstallCommand = new UninstallCommand(this.loggingUserInterface.UserInterface, packageUninstaller.Object);

            // prepare arguments
            uninstallCommand.Arguments.Add(UninstallCommand.ArgumentNameNugetPackageId, packageId);

            // Act
            uninstallCommand.Execute();

            // Assert
            Assert.IsTrue(this.loggingUserInterface.UserInterfaceOutput.Contains("succeeded") || this.loggingUserInterface.UserInterfaceOutput.Contains("success"));
        }
Exemplo n.º 3
0
        public void Execute_NoValidPackageIdIsSupplied_MessageIsWrittenToUserInterface(string packageId)
        {
            // Arrange
            var packageUninstaller = new Mock<IPackageUninstaller>();

            var uninstallCommand = new UninstallCommand(this.loggingUserInterface.UserInterface, packageUninstaller.Object);

            // prepare arguments
            uninstallCommand.Arguments.Add(UninstallCommand.ArgumentNameNugetPackageId, packageId);

            // Act
            uninstallCommand.Execute();

            // Assert
            Assert.IsNotNullOrEmpty(this.loggingUserInterface.UserInterfaceOutput);
        }
Exemplo n.º 4
0
        public void Execute_PackageIdIsValid_UninstallIsExecuted()
        {
            // Arrange
            var packageUninstaller = new Mock<IPackageUninstaller>();
            packageUninstaller.Setup(p => p.Uninstall(It.IsAny<string>(), It.IsAny<SemanticVersion>())).Returns(new SuccessResult());

            var uninstallCommand = new UninstallCommand(this.loggingUserInterface.UserInterface, packageUninstaller.Object);

            // prepare arguments
            string packageId = "Package.A";
            uninstallCommand.Arguments.Add(UninstallCommand.ArgumentNameNugetPackageId, packageId);

            // Act
            uninstallCommand.Execute();

            // Assert
            packageUninstaller.Verify(p => p.Uninstall(packageId, It.IsAny<SemanticVersion>()), Times.Once());
        }
Exemplo n.º 5
0
        public void Execute_NoPackageIdIsSupplied_MessageIsWrittenToUserInterface()
        {
            // Arrange
            var packageUninstaller = new Mock<IPackageUninstaller>();

            var uninstallCommand = new UninstallCommand(this.loggingUserInterface.UserInterface, packageUninstaller.Object);

            // prepare arguments
            uninstallCommand.Arguments = new Dictionary<string, string>();

            // Act
            uninstallCommand.Execute();

            // Assert
            Assert.IsNotNullOrEmpty(this.loggingUserInterface.UserInterfaceOutput);
        }