public void ServiceConfig_Repair()
        {
            string sourceFile = Path.Combine(ServiceConfigTests.TestDataDirectory, @"product.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension");

            MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            // Change the service details
            ServiceFailureActionType[] expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService, ServiceFailureActionType.RestartService };
            ServiceVerifier.SetServiceInformation("MynewService", 4, expectedFailureActions);

            MSIExec.RepairProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            // Validate Existing Service Information.
            expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RestartService, ServiceFailureActionType.RebootComputer, ServiceFailureActionType.None };
            ServiceVerifier.VerifyServiceInformation("W32Time", 1, expectedFailureActions);

            // Validate New Service Information.
            expectedFailureActions = new ServiceFailureActionType[] { ServiceFailureActionType.RebootComputer, ServiceFailureActionType.RestartService, ServiceFailureActionType.None };
            ServiceVerifier.VerifyServiceInformation("MynewService", 3, expectedFailureActions);

            MSIExec.UninstallProduct(msiFile, MSIExec.MSIExecReturnCode.SUCCESS);

            // Validate New Service Does NOT exist any more.
            Assert.False(ServiceVerifier.ServiceExists("MynewService"), String.Format("Service '{0}' was NOT removed on Uninstall.", "MynewService"));
        }
        public void ServiceConfig_NonExistingService()
        {
            string sourceFile = Path.Combine(ServiceConfigTests.TestDataDirectory, @"NonExistingService.wxs");
            string msiFile    = Builder.BuildPackage(sourceFile, "test.msi", "WixUtilExtension");

            MSIExec.InstallProduct(msiFile, MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);

            Assert.False(ServiceVerifier.ServiceExists("NonExistingService"), String.Format("Service '{0}' was created on Rollback.", "NonExistingService"));
        }