예제 #1
0
        public void PackagePayloads()
        {
            string sourceFile      = Path.Combine(PackageTests.TestDataDirectory, @"PackagePayloads\Product.wxs");
            string outputDirectory = this.TestDirectory;
            string PayloadFile1    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile1.txt");
            string PayloadFile2    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile2.txt");
            string PayloadFile3    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile3.txt");
            string PayloadFile4    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile4.txt");
            string PayloadFile5    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile5.txt");

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the burnManifest has the correct information
            PackageTests.VerifyMsiPackageInformation(outputDirectory, "MsiPackage1.msi", "MsiPackage1", null, BundleTests.MsiPackageProductCode, false, false, string.Format("{0}v0.1.0.0", BundleTests.MsiPackageProductCode), null, BundleTests.MsiPackageFile);
            PackageTests.VerifyMsuPackageInformation(outputDirectory, "MsuPackage2.msu", "MsuPackage2", null, false, false, null, BundleTests.MsuPackageFile);
            PackageTests.VerifyMspPackageInformation(outputDirectory, "MspPackage3.msp", "MspPackage3", null, BundleTests.MspPackagePatchCode, false, false, BundleTests.MspPackagePatchCode, null, BundleTests.MspPackageFile);
            PackageTests.VerifyExePackageInformation(outputDirectory, "ExePackage4.exe", "ExePackage4", null, false, false, string.Empty, string.Empty, string.Empty, @"file://wixbuild/releases/wix/", BundleTests.ExePackageFile);

            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage1.msi", "MsiPackage1", "PayloadFile1.txt", null, PayloadFile1);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSU, "MsuPackage2.msu", "MsuPackage2", "PayloadFile2.txt", null, PayloadFile2);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSP, "MspPackage3.msp", "MspPackage3", "PayloadFile3.txt", null, PayloadFile3);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSP, "MspPackage3.msp", "MspPackage3", "PayloadFile4.txt", "http://go.microsoft.com/fwlink/?linkid=164202", PayloadFile4);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.EXE, "ExePackage4.exe", "ExePackage4", "PayloadFile5.txt", null, PayloadFile5);
        }
예제 #2
0
        public void ValidPayloadDownloadURL()
        {
            string sourceFile      = Path.Combine(PayloadTests.TestDataDirectory, @"ValidPayloadDownloadURL\Product.wxs");
            string PayloadFile1    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile1.txt");
            string PayloadFile2    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile2.txt");
            string PayloadFile3    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile3.txt");
            string PayloadFile4    = Path.Combine(BundleTests.BundleSharedFilesDirectory, @"UXPayload\PayloadFile4.txt");
            string outputDirectory = this.TestContext.TestDirectory;

            // build the bootstrapper
            string bootstrapper = Builder.BuildBundlePackage(outputDirectory, sourceFile);

            // verify the ParameterInfo and burnManifest has the correct information
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile1.txt", @"http://go.microsoft.com/fwlink/?linkid=164202", PayloadFile1);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile2.txt", @"http://localhost/testPayload", PayloadFile2);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile3.txt", @"ftp://192.168.0.1/testPayload.exe", PayloadFile3);
            PackageTests.VerifyPackagePayloadInformation(outputDirectory, PackageTests.PackageType.MSI, "MsiPackage.msi", "MsiPackage", "PayloadFile4.txt", @"file://wixbuild/releases/wix/", PayloadFile4);
        }
예제 #3
0
        /// <summary>
        /// Verifies Package information in Burn-Manifest.xml and Burn-UxManifest.xml.
        /// </summary>
        /// <param name="embededResourcesDirectoryPath">Output folder where all the embeded resources are.</param>
        /// <param name="expectedPackageName">Package name; this is the attribute used to locate the package.</param>
        /// <param name="expectedPackageType">Package type MSI, MSP, MSU or EXE.</param>
        /// <param name="expectedId">Expected Package @Id value.</param>
        /// <param name="expectedInstallCondition">Expected Package @InstallCondition value.</param>
        /// <param name="expectedProductCode">Expected Package @ProductCode value.</param>
        /// <param name="expecteVital">Package is viatal or not.</param>
        /// <param name="expectedPermanent">Expected Package @Permanent value.</param>
        /// <param name="expectedCacheId">Expected Package @CacheId value.</param>
        /// <param name="expectedInstallCommmand">Expected @InstallCommand value.</param>
        /// <param name="expectedUninstallCommmand">Expected @UninstallCommand value.</param>
        /// <param name="expectedRepairCommand">Expected @RepairCommand value.</param>
        /// <param name="expectedDownloadURL">Expected Package @DownloadURL value.</param>
        /// <param name="acctualFilePath">Path to the acctual file for comparison.</param>
        private static void VerifyPackageInformation(string embededResourcesDirectoryPath, string expectedPackageName, PackageType expectedPackageType, string expectedId,
                                                     string expectedInstallCondition, string expectedProductCode, bool expecteVital, bool expectedPermanent, string expectedCacheId,
                                                     string expectedInstallCommmand, string expectedUninstallCommmand, string expectedRepairCommand, string expectedDownloadURL,
                                                     string acctualFilePath)
        {
            string expectedFileSize    = new FileInfo(acctualFilePath).Length.ToString();
            string expectedHash        = FileVerifier.ComputeFileSHA1Hash(acctualFilePath);
            string expectedProductSize = expectedFileSize;

            // verify the Burn_Manifest has the correct information
            string      burnManifestXPath = string.Format(@"//burn:{0}[@Id='{1}']", GetPackageElementName(expectedPackageType), expectedId);
            XmlNodeList burnManifestNodes = BundleTests.QueryBurnManifest(embededResourcesDirectoryPath, burnManifestXPath);

            Assert.AreEqual(1, burnManifestNodes.Count, "No MsiPackage with the Id: '{0}' was found in Burn_Manifest.xml.", expectedId);
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallCondition", expectedInstallCondition);
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Permanent", expectedPermanent ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnManifestNodes[0], "Vital", expecteVital ? "yes" : "no");

            if (expectedPackageType == PackageType.MSI)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "ProductCode", expectedProductCode);
            }

            if (expectedPackageType == PackageType.EXE)
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "InstallArguments", expectedInstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "UninstallArguments", expectedUninstallCommmand);
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "RepairArguments", expectedRepairCommand);
            }

            if (!String.IsNullOrEmpty(expectedCacheId))
            {
                BundleTests.VerifyAttributeValue(burnManifestNodes[0], "CacheId", expectedCacheId);
            }

            // verify payload information
            PackageTests.VerifyPackagePayloadInformation(embededResourcesDirectoryPath, expectedPackageType, expectedPackageName, expectedId, expectedPackageName, expectedDownloadURL, acctualFilePath);

            // verify the Burn-UxManifest has the correct information
            string expectedProductName = null;
            string expectedDiscription = null;

            if (expectedPackageType == PackageType.EXE)
            {
                FileVersionInfo fileInfo = FileVersionInfo.GetVersionInfo(acctualFilePath);
                expectedProductName = string.IsNullOrEmpty(fileInfo.ProductName) ? null : fileInfo.ProductName;
                expectedDiscription = string.IsNullOrEmpty(fileInfo.FileDescription) ? null : fileInfo.FileDescription;
            }
            else if (expectedPackageType == PackageType.MSI)
            {
                string subject = Verifier.GetMsiSummaryInformationProperty(acctualFilePath, Verifier.MsiSummaryInformationProperty.Subject);
                expectedProductName = string.IsNullOrEmpty(subject) ? null : subject;
            }

            string      burnUxManifestXPath = string.Format(@"//burnUx:WixPackageProperties[@Package='{0}']", expectedId);
            XmlNodeList burnUxManifestNodes = BundleTests.QueryBurnUxManifest(embededResourcesDirectoryPath, burnUxManifestXPath);

            Assert.AreEqual(1, burnUxManifestNodes.Count, "No WixPackageProperties for Package: '{0}' was found in Burn-UxManifest.xml.", expectedId);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Vital", expecteVital ? "yes" : "no");
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DownloadSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "PackageSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "InstalledSize", expectedFileSize);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "DisplayName", expectedProductName);
            BundleTests.VerifyAttributeValue(burnUxManifestNodes[0], "Description", expectedDiscription);
        }