Пример #1
0
        /// <summary>
        /// Recupera la configuración del servicio de negocio.
        /// </summary>
        /// <remarks>Lee la configuración utilizando un ServiceConfigurationManager del tipo especificado en los settings de la aplicación.</remarks>
        /// <param name="providerName">Nombre del proveedor de la metadata de servicio</param>
        /// <param name="serviceName">Nombre del servicio de negocio.</param>
        /// <returns>configuración del servicio de negocio.</returns>
        /// <date>2008-04-07T00:00:00</date>
        /// <author>moviedo</author>
        public static ServiceConfiguration GetServiceConfiguration(string providerName, string serviceName)
        {
            // obtención de la configuración del servicio.
            ServiceConfiguration wResult = ServiceMetadata.GetServiceConfiguration(providerName, serviceName);

            return(wResult);
        }
Пример #2
0
        public void ServiceMetadata_Test(string providerName)
        {
            String strErrorResut = String.Empty;
            ServiceConfiguration wServiceConfigurationOriginal;
            ServiceConfiguration wServiceConfiguration;

            try
            {
                ServiceConfigurationCollection services = ServiceMetadata.GetAllServices(providerName);


                if (services.Count == 0)
                {
                    Assert.Inconclusive("No existen servicios para realizar pruevas ");
                }

                #region update
                wServiceConfigurationOriginal = ServiceMetadata.GetServiceConfiguration(providerName, services[0].Name);
                wServiceConfiguration         = wServiceConfigurationOriginal.Clone();

                wServiceConfiguration.Audit       = true;
                wServiceConfiguration.Name        = wServiceConfigurationOriginal.Name + "_test";
                wServiceConfiguration.Description = wServiceConfigurationOriginal.Description + "_test";
                wServiceConfiguration.Request     = wServiceConfigurationOriginal.Request + "_test";
                wServiceConfiguration.Response    = wServiceConfigurationOriginal.Response + "_test";
                ServiceMetadata.SetServiceConfiguration(providerName, wServiceConfigurationOriginal.Name, wServiceConfiguration);
                #endregion

                #region CHEK update
                wServiceConfiguration = null;
                wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, wServiceConfigurationOriginal.Name + "_test");

                if (!wServiceConfiguration.Name.Equals(string.Concat(wServiceConfigurationOriginal.Name, "_test")) ||
                    !wServiceConfiguration.Response.Equals(string.Concat(wServiceConfigurationOriginal.Response, "_test")) ||
                    !wServiceConfiguration.Request.Equals(string.Concat(wServiceConfigurationOriginal.Request, "_test")) ||
                    !wServiceConfiguration.Description.Equals(string.Concat(wServiceConfigurationOriginal.Description, "_test")))
                {
                    Assert.Fail("La actualizacion en el metodo SetServiceConfiguration no se realizo con exito.-");
                }
                #endregion

                #region Add new service
                wServiceConfiguration = new ServiceConfiguration();

                wServiceConfiguration.Audit       = true;
                wServiceConfiguration.Description = "desc_test";
                wServiceConfiguration.Name        = "Name_test";
                wServiceConfiguration.Handler     = "Handler_test";
                wServiceConfiguration.Request     = "Request_test";
                wServiceConfiguration.Response    = "Response_test";

                ServiceMetadata.AddServiceConfiguration(providerName, wServiceConfiguration);
                #endregion

                #region CHEK  Add new service
                wServiceConfiguration = null;

                wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, "Name_test");

                if (wServiceConfiguration == null)
                {
                    Assert.Fail("La creacion del servicio por medio  del metodo AddServiceConfiguration no se realizo con exito.-");
                }


                #endregion



                ServiceMetadata.DeleteServiceConfiguration(providerName, "Name_test");
                try
                {
                    wServiceConfiguration = ServiceMetadata.GetServiceConfiguration(providerName, "Name_test");
                }
                catch (Exceptions.TechnicalException te)
                {
                    if (te.ErrorId.Equals("7002"))
                    {
                    }
                }
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
        }