コード例 #1
0
 /// <summary>
 /// Add default installers instance to installation manager.
 /// </summary>
 /// <remarks>This method must be called after the bucket is fully initialized.</remarks>
 protected virtual void InitializeDefaultInstallers(InstallationManager installationManager, Bucket bucket, IIO io)
 {
     installationManager.AddInstaller(new InstallerLibrary(io, bucket, null));
     installationManager.AddInstaller(new InstallerLibrary(io, bucket));
     installationManager.AddInstaller(new InstallerMetaPackage(io));
     installationManager.AddInstaller(new InstallerPlugin(io, bucket));
 }
コード例 #2
0
        public void TestExecute()
        {
            var managerMock = new Mock <InstallationManager>
            {
                CallBase = true,
            };

            manager = managerMock.Object;

            var operationInstall   = new OperationInstall(package.Object);
            var operationUninstall = new OperationUninstall(package.Object);
            var operationUpdate    = new OperationUpdate(package.Object, package.Object);

            package.Setup((o) => o.GetPackageType()).Returns("foo");
            repository.SetupSequence((o) => o.HasPackage(package.Object))
            .Returns(false).Returns(true).Returns(true).Returns(false);
            manager.AddInstaller(new InstallerNoop());

            manager.Execute(repository.Object, operationInstall);
            manager.Execute(repository.Object, operationUninstall);
            manager.Execute(repository.Object, operationUpdate);

            managerMock.Protected().Verify("Install", Times.Once(), repository.Object, operationInstall);
            managerMock.Protected().Verify("Uninstall", Times.Once(), repository.Object, operationUninstall);
            managerMock.Protected().Verify("Update", Times.Once(), repository.Object, operationUpdate);
        }
コード例 #3
0
        public void TestIsPackageInstalledWithPackageAlias()
        {
            var managerMock = new Mock <InstallationManager>()
            {
                CallBase = true,
            };

            manager = managerMock.Object;
            package.Setup((o) => o.GetPackageType()).Returns("foo");
            package.Setup((o) => o.GetName()).Returns("foobar");
            var packageAlias = new PackageAlias(package.Object, "1.2.0.0", "1.2");

            repository.Setup((o) => o.HasPackage(packageAlias)).Returns(true);
            repository.Setup((o) => o.HasPackage(package.Object)).Returns(true);
            installer.Setup((o) => o.IsSupports("foo")).Returns(true);
            installer.Setup((o) => o.IsInstalled(repository.Object, package.Object))
            .Returns(true);
            manager.AddInstaller(installer.Object);

            Assert.AreEqual(true, manager.IsPackageInstalled(repository.Object, packageAlias));
            managerMock.Verify((o) => o.IsPackageInstalled(repository.Object, package.Object));
        }
コード例 #4
0
        public void TestAddGetInstaller()
        {
            installer.Setup((o) => o.IsSupports("foo")).Returns(true);
            manager.AddInstaller(installer.Object);

            Assert.AreSame(installer.Object, manager.GetInstaller("foo"));
        }