Ejemplo n.º 1
0
        public void InstallPackageCmdletThrowsWhenSolutionIsClosed()
        {
            // Arrange
            var packageManagerFactory = new Mock<IVsPackageManagerFactory>();
            packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null);
            var cmdlet = new InstallPackageCommand(TestUtils.GetSolutionManager(isSolutionOpen: false), packageManagerFactory.Object, null, null, null, null, new Mock<IVsCommonOperations>().Object, new Mock<IDeleteOnRestartManager>().Object);

            // Act and Assert
            ExceptionAssert.Throws<InvalidOperationException>(() => cmdlet.GetResults(),
                "The current environment doesn't have a solution open.");
        }
Ejemplo n.º 2
0
        public void InstallPackageCmdletThrowsWhenSolutionIsClosed()
        {
            // Arrange
            var packageManagerFactory = new Mock <IVsPackageManagerFactory>();

            packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns((IVsPackageManager)null);
            var cmdlet = new InstallPackageCommand(TestUtils.GetSolutionManager(isSolutionOpen: false), packageManagerFactory.Object, null, null, null, null, new Mock <IVsCommonOperations>().Object);

            // Act and Assert
            ExceptionAssert.Throws <InvalidOperationException>(() => cmdlet.GetResults(),
                                                               "The current environment doesn't have a solution open.");
        }
Ejemplo n.º 3
0
        public void InstallPackageCmdletThrowsWhenSolutionIsClosed()
        {
            // Arrange
            var packageA = PackageUtility.CreatePackage("A", "1.0.0");
            var packageRepository = new MockPackageRepository { packageA };
            var packageManager = new MockVsPackageManager2(
                @"c:\solution",
                packageRepository);

            var packageManagerFactory = new Mock<IVsPackageManagerFactory>();
            packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns(packageManager);
            ((MockSolutionManager2)packageManager.SolutionManager).IsSolutionOpen = false;
            var cmdlet = new InstallPackageCommand(packageManager.SolutionManager, packageManagerFactory.Object, null, null, null, null, new Mock<IVsCommonOperations>().Object, new Mock<IDeleteOnRestartManager>().Object, true);

            // Act and Assert
            ExceptionAssert.Throws<InvalidOperationException>(() => cmdlet.GetResults(),
                "The current environment doesn't have a solution open.");
        }
Ejemplo n.º 4
0
        public void InstallPackageCmdletThrowsWhenSolutionIsClosed()
        {
            // Arrange
            var packageA          = PackageUtility.CreatePackage("A", "1.0.0");
            var packageRepository = new MockPackageRepository {
                packageA
            };
            var packageManager = new MockVsPackageManager2(
                @"c:\solution",
                packageRepository);

            var packageManagerFactory = new Mock <IVsPackageManagerFactory>();

            packageManagerFactory.Setup(m => m.CreatePackageManager()).Returns(packageManager);
            ((MockSolutionManager2)packageManager.SolutionManager).IsSolutionOpen = false;
            var cmdlet = new InstallPackageCommand(packageManager.SolutionManager, packageManagerFactory.Object, null, null, null, null, new Mock <IVsCommonOperations>().Object, new Mock <IDeleteOnRestartManager>().Object, true);

            // Act and Assert
            ExceptionAssert.Throws <InvalidOperationException>(() => cmdlet.GetResults(),
                                                               "The current environment doesn't have a solution open.");
        }