Exemple #1
0
        public void WriteEncryptedConfigurationTest()
        {
            var config = new XmlFileConfiguration();

            config.Initialize(STR_XMLCONFIGFILE);

            // write secure properties
            config.Password            = "******";
            config.AppConnectionString = "server=.;database=unsecured";

            config.Write();

            string xmlConfig = File.ReadAllText(STR_XMLCONFIGFILE);

            Console.WriteLine(xmlConfig);

            // Password and AppSettings  should be encrypted in config file
            Assert.IsTrue(xmlConfig.Contains(@"<Password>ADoCNO6L1HIm8V7TyI4deg==</Password>"));
            Assert.IsTrue(xmlConfig.Contains(@"<AppConnectionString>z6+T5mzXbtJBEgWqpQNYbBss0csbtw2b/qdge7PUixE=</AppConnectionString>"));

            // now re-read settings into a new object
            var config2 = new XmlFileConfiguration();

            config2.Initialize(STR_XMLCONFIGFILE);

            // check secure properties
            Assert.IsTrue(config.Password == "seekrit2");
            Assert.IsTrue(config.AppConnectionString == "server=.;database=unsecured");
        }
Exemple #2
0
        public void WriteConfigurationTest()
        {
            var config = new XmlFileConfiguration();

            config.Initialize(STR_XMLCONFIGFILE);

            config.MaxDisplayListItems         = 12;
            config.DebugMode                   = DebugModes.DeveloperErrorMessage;
            config.ApplicationName             = "Changed";
            config.SendAdminEmailConfirmations = true;

            // secure properties
            config.Password            = "******";
            config.AppConnectionString = "server=.;database=unsecured";

            config.License.LicenseKey = "asdss";

            config.Write();

            string xmlConfig = File.ReadAllText(STR_XMLCONFIGFILE);

            Console.WriteLine(xmlConfig);

            Assert.IsTrue(xmlConfig.Contains(@"<DebugMode>DeveloperErrorMessage</DebugMode>"));
            Assert.IsTrue(xmlConfig.Contains(@"<MaxDisplayListItems>12</MaxDisplayListItems>"));
            Assert.IsTrue(xmlConfig.Contains(@"<SendAdminEmailConfirmations>true</SendAdminEmailConfirmations>"));

            // Password and AppSettings  should be encrypted in config file
            Assert.IsTrue(xmlConfig.Contains(@"<Password>ADoCNO6L1HIm8V7TyI4deg==</Password>"));
            Assert.IsTrue(xmlConfig.Contains(@"<AppConnectionString>z6+T5mzXbtJBEgWqpQNYbBss0csbtw2b/qdge7PUixE=</AppConnectionString>"));
        }
        public void WriteConfigurationTest()
        {
            var config = new XmlFileConfiguration();
            config.Initialize(STR_XMLCONFIGFILE);

            config.MaxDisplayListItems = 12;
            config.DebugMode = DebugModes.DeveloperErrorMessage;
            config.ApplicationName = "Changed";
            config.SendAdminEmailConfirmations = true;

            // secure properties
            config.Password = "******";
            config.AppConnectionString = "server=.;database=unsecured";

            config.License.LicenseKey = "asdss";

            config.Write();

            string xmlConfig = File.ReadAllText(STR_XMLCONFIGFILE);
            Console.WriteLine(xmlConfig);

            Assert.IsTrue(xmlConfig.Contains(@"<DebugMode>DeveloperErrorMessage</DebugMode>"));
            Assert.IsTrue(xmlConfig.Contains(@"<MaxDisplayListItems>12</MaxDisplayListItems>"));
            Assert.IsTrue(xmlConfig.Contains(@"<SendAdminEmailConfirmations>true</SendAdminEmailConfirmations>"));

            // Password and AppSettings  should be encrypted in config file
            Assert.IsTrue(xmlConfig.Contains(@"<Password>ADoCNO6L1HIm8V7TyI4deg==</Password>"));
            Assert.IsTrue(xmlConfig.Contains(@"<AppConnectionString>z6+T5mzXbtJBEgWqpQNYbBss0csbtw2b/qdge7PUixE=</AppConnectionString>"));
        }
        public void DefaultConstructorInstanceTest()
        {
            var config = new XmlFileConfiguration();
            config.Initialize(configData: STR_XMLCONFIGFILE);

            Assert.IsNotNull(config);
            Assert.IsFalse(string.IsNullOrEmpty(config.ApplicationName));

            string text = File.ReadAllText(STR_XMLCONFIGFILE);
            Console.WriteLine(text);
        }
Exemple #5
0
        public void DefaultConstructorInstanceTest()
        {
            var config = new XmlFileConfiguration();

            config.Initialize(configData: STR_XMLCONFIGFILE);

            Assert.IsNotNull(config);
            Assert.IsFalse(string.IsNullOrEmpty(config.ApplicationName));

            string text = File.ReadAllText(STR_XMLCONFIGFILE);

            Console.WriteLine(text);
        }
        public void WriteEncryptedConfigurationTest()
        {
            var config = new XmlFileConfiguration();
            config.Initialize(STR_XMLCONFIGFILE);

            // write secure properties
            config.Password = "******";
            config.AppConnectionString = "server=.;database=unsecured";

            config.Write();

            string xmlConfig = File.ReadAllText(STR_XMLCONFIGFILE);
            Console.WriteLine(xmlConfig);

            // Password and AppSettings  should be encrypted in config file
            Assert.IsTrue(xmlConfig.Contains(@"<Password>ADoCNO6L1HIm8V7TyI4deg==</Password>"));
            Assert.IsTrue(xmlConfig.Contains(@"<AppConnectionString>z6+T5mzXbtJBEgWqpQNYbBss0csbtw2b/qdge7PUixE=</AppConnectionString>"));

            // now re-read settings into a new object
            var config2 = new XmlFileConfiguration();
            config2.Initialize(STR_XMLCONFIGFILE);

            // check secure properties
            Assert.IsTrue(config.Password == "seekrit2");
            Assert.IsTrue(config.AppConnectionString == "server=.;database=unsecured");
        }