Execute() публичный Метод

public Execute ( ) : bool
Результат bool
Пример #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());
        }
Пример #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"));
        }
Пример #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);
        }
Пример #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());
        }
Пример #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);
        }