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"));
        }
        /// <summary>
        /// Determine the service path to attempt to use, and prepares the
        /// verification object using those parameters.
        /// </summary>
        /// <param name="settings">Unit test settings object to try and read
        /// settings from.</param>
        private void SetServicePath(UnitTestSettings settings)
        {
            bool useOverrides = (settings != null && !string.IsNullOrEmpty(settings.TestServiceHostname) && !string.IsNullOrEmpty(settings.TestServicePath));

            _webService = new ServiceVerifier
            {
                Hostname    = useOverrides ? settings.TestServiceHostname : "localhost",
                Port        = useOverrides ? settings.TestServicePort : 8000,
                ServicePath = useOverrides ? settings.TestServicePath : "/externalInterface/",
            };
        }
Beispiel #4
0
 /// <summary>
 /// Determine the service path to attempt to use, and prepares the
 /// verification object using those parameters.
 /// </summary>
 private void SetServicePath()
 {
     // CONSIDER: May want to allow test settings to provide different
     // values for the service address, for additional flexibility and
     // security.
     _webService = new ServiceVerifier
     {
         Hostname    = "localhost",
         Port        = 8000,
         ServicePath = "/externalInterface/",
     };
 }
Beispiel #5
0
 /// <summary>
 /// Pauses the initialization process to attempt a service connection.
 /// The result will alter the underlying ServiceType being used by
 /// this provider to ensure a fallback experience can be used.
 ///
 /// This verification step will block the initialization and entire
 /// test run until it continues.
 /// </summary>
 private void AttemptServiceConnection()
 {
     _webService.Verify(
         // Success
         delegate
     {
         WebService = new WebTestService(_webService.ServiceUri);
         ContinueInitialization();
     },
         // Failure, fallback to the direct mode
         delegate
     {
         _webService = null;
         ContinueInitialization();
     });
 }
        public CalculatorMessage calculateInterestPerformance(decimal amount, int termInDays, MoneyType money)
        {
            //Se genera la caja para encapsular el resultado
            CalculatorMessage result = new CalculatorMessage();

            //Se obtiene los productos
            SavingInvestementProduct product = _factory.createProduct();

            product.Amount     = amount;
            product.TermInDays = termInDays;
            product.Currency   = money;

            //Se crea el verficador para procesar el producto de inversión y ahorro
            ServiceVerifier verifier = _factory.createVerify();

            verifier.Product = product;

            //Verificar la apertura del servicio
            ProductServiceMessage verifyMessage = verifier.canServiceBeOpen();

            if (verifyMessage.CanBeOpen == true)
            {
                //Se crea la tabla de intereses para el producto de inversión y ahorro; más se le adjunta al producto
                string        tableInterest = _productType + money.ToString();
                InterestTable interestTable = InterestTableFactory.GetInterestTableFor(tableInterest);
                product.setInterestTable(interestTable);

                //Se calcula el rendimiento del producto
                product.calculateInterest();

                result.InterestEarned    = product.InterestEarned();
                result.FinalBalance      = product.getFinalBalance();
                result.TaxApplied        = product.getTax();
                result.percentegeApplied = product.getAnnualInterest();
            }
            else
            {
                result.InterestEarned = 0;
                result.FinalBalance   = 0;
                result.TaxApplied     = 0;
            }

            result.Message = verifyMessage.Message;
            return(result);
        }
 /// <summary>
 /// Pauses the initialization process to attempt a service connection. 
 /// The result will alter the underlying ServiceType being used by 
 /// this provider to ensure a fallback experience can be used.  
 /// 
 /// This verification step will block the initialization and entire 
 /// test run until it continues.
 /// </summary>
 private void AttemptServiceConnection()
 {
     _webService.Verify(
         // Success
         delegate
         {
             WebService = new WebTestService(_webService.ServiceUri);
             ContinueInitialization();
         },
         // Failure, fallback to the direct mode
         delegate
         {
             ServiceType = ServiceType.Direct;
             _webService = null;
             ContinueInitialization();
         });
 }
 /// <summary>
 /// Determine the service path to attempt to use, and prepares the 
 /// verification object using those parameters.
 /// </summary>
 /// <param name="settings">Unit test settings object to try and read
 /// settings from.</param>
 private void SetServicePath(UnitTestSettings settings)
 {
     bool useOverrides = (settings != null && !string.IsNullOrEmpty(settings.TestServiceHostname) && !string.IsNullOrEmpty(settings.TestServicePath));
     _webService = new ServiceVerifier
     {
        Hostname = useOverrides ? settings.TestServiceHostname : "localhost",
        Port = useOverrides ? settings.TestServicePort : 8000,
        ServicePath = useOverrides ? settings.TestServicePath : "/externalInterface/",
     };
 }
 /// <summary>
 /// Determine the service path to attempt to use, and prepares the 
 /// verification object using those parameters.
 /// </summary>
 private void SetServicePath()
 {
     // CONSIDER: May want to allow test settings to provide different
     // values for the service address, for additional flexibility and
     // security.
     _webService = new ServiceVerifier
     {
        Hostname = "localhost",
        Port = 8000,
        ServicePath = "/externalInterface/",
     };
 }