public void AutoGenInstanceProductCode()
        {
            string sourceFile = Path.Combine(InstanceTransformTests.TestDataDirectory, @"AutoGenInstanceProductCode\product.wxs");
            string msi = Builder.BuildPackage(sourceFile);

            // Verify that an instance transforms was created
            string transformName = "Instance1.mst";
            string mst = Path.Combine(Path.GetDirectoryName(msi), transformName);

            // Extract the transform
            InstanceTransformTests.ExtractTransform(msi, transformName, mst);

            // Verify that the base product code is the expected value
            Verifier.VerifyQuery(msi, "Select `Value` FROM `Property` WHERE `Property` = 'ProductCode'", "{4014E041-A968-4DE3-B43C-322DF9A19359}");

            // Verify that the transform changes the product code
            using (Database msiDatabase = new Database(msi, DatabaseOpenMode.ReadOnly))
            {
                msiDatabase.ApplyTransform(mst);
                string transformProductCode = null;
                using (View view = msiDatabase.OpenView("Select `Value` FROM `Property` WHERE `Property` = 'ProductCode'"))
                {
                    view.Execute();
                    var record = view.Fetch();

                    if (null != record)
                    {
                        transformProductCode = Convert.ToString(record.GetString(1));
                    }
                }

                Assert.False("{4014E041-A968-4DE3-B43C-322DF9A19359}".Equals(transformProductCode), "The product code was not transformed by the instance transform.");
            }
        }
        public void InstanceUpgradeCode()
        {
            string sourceFile = Path.Combine(InstanceTransformTests.TestDataDirectory, @"InstanceUpgradeCode\product.wxs");
            string msi = Builder.BuildPackage(sourceFile);

            // Verify that an instance transforms was created
            string transformName = "Instance1.mst";
            string mst = Path.Combine(Path.GetDirectoryName(msi), transformName);

            // Extract the transform
            InstanceTransformTests.ExtractTransform(msi, transformName, mst);

            // Verify that the base upgrade code is the expected value
            Verifier.VerifyQuery(msi, "Select `Value` FROM `Property` WHERE `Property` = 'UpgradeCode'", "{F907C172-70B8-4654-8D23-49FB3AE2ECB7}");

            // Verify that the transform changes the upgrade code
            using (Database msiDatabase = new Database(msi, DatabaseOpenMode.ReadOnly))
            {
                msiDatabase.ApplyTransform(mst);
                string transformUpgradeCode = null;
                using (View view = msiDatabase.OpenView("Select `Value` FROM `Property` WHERE `Property` = 'UpgradeCode'"))
                {
                    view.Execute();
                    using (var record = view.Fetch())
                    {
                        if (null != record)
                        {
                            transformUpgradeCode = Convert.ToString(record.GetString(1));
                        }
                    }
                }

                Assert.True("{E8441024-BBDA-4D08-B8B1-039C269CD374}".Equals(transformUpgradeCode), "The upgrade code was not transformed by the instance transform.");
            }
        }