Ejemplo n.º 1
0
        public void ChangeProperty_Group_File()
        {
            String strErrorResut = String.Empty;
            String providerName  = "localFile";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01_ChangeProperty";
            Fwk.Configuration.Common.Key k;

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K01_ChangeProperty";
            k.Value.Text = "Value_Key_01";


            g.Keys.Add(k);


            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);


                Fwk.Configuration.ConfigurationManager_CRUD.ChangeGroupName(providerName, g.Name, string.Concat("NEW" + g.Name));
                k            = new Fwk.Configuration.Common.Key();
                k.Name       = "Value_Key_01_Updated";
                k.Value.Text = "Value_Key_01";
                Fwk.Configuration.ConfigurationManager_CRUD.ChangeProperty(providerName, string.Concat("NEW" + g.Name), k, "K01_ChangeProperty");
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, string.Concat("NEW" + g.Name));
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
        }
Ejemplo n.º 2
0
        bool CheckFile(string fileName)
        {
            if (!System.IO.File.Exists(fileName))
            {
                base.ExceptionViewer.Show(new Exception("File not exist"));
                return(false);
            }
            Fwk.Configuration.Common.ConfigurationFile file = new Fwk.Configuration.Common.ConfigurationFile();
            try
            {
                file.SetXml(Fwk.HelperFunctions.FileFunctions.OpenTextFile(fileName));
            }
            catch
            {
                base.ExceptionViewer.Show(new Exception("Incorrect configuration file"));
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public void ConfigurationMannager_Database()
        {
            String strErrorResut = String.Empty;
            String providerName  = "database";

            Fwk.Configuration.Common.Group g = new Fwk.Configuration.Common.Group();
            g.Name = "Test01";
            Fwk.Configuration.Common.Key k;

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K01";
            k.Value.Text = "Value_Key_01";
            g.Keys.Add(k);

            k            = new Fwk.Configuration.Common.Key();
            k.Name       = "K02";
            k.Value.Text = "Value_Key_02";
            g.Keys.Add(k);


            try
            {
                Fwk.Configuration.Common.ConfigurationFile wConfigurationFile = Fwk.Configuration.ConfigurationManager.GetConfigurationFile(providerName);
                Fwk.Configuration.ConfigurationManager_CRUD.AddGroup(providerName, g);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

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

            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }

            k = new Fwk.Configuration.Common.Key();

            k.Name       = "K03";
            k.Value.Text = "Value_Key_03";
            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.AddProperty(providerName, g.Name, k);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);

            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }
            string kvalue = Fwk.Configuration.ConfigurationManager.GetProperty(providerName, g.Name, "K03");

            if (!kvalue.Equals("Value_Key_03", StringComparison.OrdinalIgnoreCase))
            {
                Assert.Inconclusive("No se pudo obtener correctamente la propiedad", kvalue);
            }



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveProperty(providerName, g.Name, "K03");
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }

            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
            if (!string.IsNullOrEmpty(strErrorResut))
            {
                return;
            }



            try
            {
                Fwk.Configuration.ConfigurationManager_CRUD.RemoveGroup(providerName, g.Name);
            }
            catch (Exception e)
            {
                strErrorResut = Fwk.Exceptions.ExceptionHelper.GetAllMessageException(e);
            }
            Assert.AreEqual <String>(strErrorResut, string.Empty, strErrorResut);
        }
Ejemplo n.º 4
0
        bool CheckFile(string fileName)
        {
            if (!System.IO.File.Exists(fileName))
            {
                base.ExceptionViewer.Show(new Exception("File not exist"));
                return false;
            }
            Fwk.Configuration.Common.ConfigurationFile file = new Fwk.Configuration.Common.ConfigurationFile();
            try
            {
                file.SetXml(Fwk.HelperFunctions.FileFunctions.OpenTextFile(fileName));
            }
            catch
            {
                base.ExceptionViewer.Show(new Exception("Incorrect configuration file"));
                return false;
            }

            return true;
        }