Пример #1
0
        public void TestCommandLineArgs()
        {
            var data = new InstallCommandActionData();

            data.ParseCommandLine(new string[] { "PROPERTY=VALUE", "REINSTALL=ALL" });

            Assert.AreEqual("PROPERTY=VALUE REINSTALL=ALL", data.CommandLine);
            Assert.AreEqual <long>(PackageInfo.DefaultWeight, data.Weight);
        }
Пример #2
0
        public void TestEmptyCommandLineArgs()
        {
            var data = new InstallCommandActionData();

            data.ParseCommandLine(new string[] { });

            Assert.IsNull(data.CommandLine);
            Assert.AreEqual <long>(PackageInfo.DefaultWeight, data.Weight);
        }
Пример #3
0
        public void ExtractPathFromPSPath()
        {
            using (var p = CreatePipeline("get-item example.msi"))
            {
                var file = p.Invoke().SingleOrDefault();
                Assert.IsNotNull(file);

                var    data = InstallCommandActionData.CreateActionData <InstallCommandActionData>(TestRunspace.SessionStateProxy.Path, file);
                string path = Path.Combine(this.TestContext.DeploymentDirectory, "example.msi");
                Assert.AreEqual(path, data.Path);

                data.UpdateWeight();
                Assert.AreEqual <long>(1419, data.Weight);
            }
        }
Пример #4
0
        /// <summary>
        /// Queues products for installation.
        /// </summary>
        protected override void QueueActions()
        {
            if (ParameterSet.Product == this.ParameterSetName)
            {
                foreach (string productCode in this.ProductCode)
                {
                    var data = new T()
                    {
                        ProductCode = productCode,
                    };

                    data.ParseCommandLine(this.Properties);
                    this.UpdateAction(data);

                    this.Actions.Enqueue(data);
                }
            }
            else if (ParameterSet.Installation == this.ParameterSetName)
            {
                foreach (var product in this.Product)
                {
                    var data = new T()
                    {
                        ProductCode = product.ProductCode,
                    };

                    data.ParseCommandLine(this.Properties);
                    this.UpdateAction(data);

                    this.Actions.Enqueue(data);
                }
            }
            else
            {
                var paths = this.InvokeProvider.Item.Get(this.Path, true, ParameterSet.LiteralPath == this.ParameterSetName);
                foreach (var path in paths)
                {
                    var data = InstallCommandActionData.CreateActionData <T>(this.SessionState.Path, path);

                    data.SetProductCode();
                    data.ParseCommandLine(this.Properties);
                    this.UpdateAction(data);

                    this.Actions.Enqueue(data);
                }
            }
        }
Пример #5
0
        public void SetProductCodeFromTxt()
        {
            using (var p = CreatePipeline(@"get-item example.txt"))
            {
                var file = p.Invoke().SingleOrDefault();
                Assert.IsNotNull(file, "The file item is null.");

                // Suppress any Windows Installer dialogs.
                var internalUI = Installer.SetInternalUI(InstallUIOptions.Silent);
                try
                {
                    var data = InstallCommandActionData.CreateActionData <InstallProductActionData>(TestRunspace.SessionStateProxy.Path, file);
                    data.SetProductCode();
                }
                finally
                {
                    Installer.SetInternalUI(internalUI);
                }
            }
        }
Пример #6
0
        public void SetProductCodeFromMsi()
        {
            using (var p = CreatePipeline(@"get-item example.msi"))
            {
                var file = p.Invoke().SingleOrDefault();
                Assert.IsNotNull(file, "The file item is null.");

                // Suppress any Windows Installer dialogs.
                var internalUI = Installer.SetInternalUI(InstallUIOptions.Silent);
                try
                {
                    var data = InstallCommandActionData.CreateActionData <InstallProductActionData>(TestRunspace.SessionStateProxy.Path, file);
                    data.SetProductCode();
                    Assert.AreEqual("{877EF582-78AF-4D84-888B-167FDC3BCC11}", data.ProductCode, "The ProductCode is incorrect.");
                }
                finally
                {
                    Installer.SetInternalUI(internalUI);
                }
            }
        }
Пример #7
0
 public void TestNullFile()
 {
     var data = InstallCommandActionData.CreateActionData <InstallCommandActionData>(TestRunspace.SessionStateProxy.Path, null);
 }
Пример #8
0
 public void TestNullResolver()
 {
     var data = InstallCommandActionData.CreateActionData <InstallCommandActionData>(null, null);
 }