Ejemplo n.º 1
0
        public void PropertiesWithIgnoreAttributeArentSerialized()
        {
            var config = new ConfigClasses.ConfigurationWithEncryption
            {
                IgnoredVariable = "super_secret_variable"
            };

            var s = new MiqoConfig()
                    .Save(config)
                    .ApplicationSettings()
                    .ToString();

            var deserializedConfig = new MiqoConfig()
                                     .Load()
                                     .ApplicationSettings()
                                     .FromString <ConfigClasses.ConfigurationWithEncryption>(s);

            Assert.Null(deserializedConfig.IgnoredVariable);
        }
Ejemplo n.º 2
0
        public void SerializedConfigurationCanBeDeserialized()
        {
            var config = new ConfigClasses.ConfigurationWithEncryption
            {
                ServerName = "127.0.0.0"
            };

            var s = new MiqoConfig()
                    .Save(config)
                    .ApplicationSettings()
                    .ToString();

            var deserializedConfig = new MiqoConfig()
                                     .Load()
                                     .ApplicationSettings()
                                     .FromString <ConfigClasses.ConfigurationWithEncryption>(s);

            Assert.Equal(config.ServerName, deserializedConfig.ServerName);
        }
Ejemplo n.º 3
0
        public void PropertiesCanBeEncryptedAndDecrypted()
        {
            var config = new ConfigClasses.ConfigurationWithEncryption
            {
                ConnectionString = "super_secret_connection_string"
            };

            var s = new MiqoConfig()
                    .Save(config)
                    .ApplicationSettings()
                    .ToString();

            Assert.DoesNotContain("super_secret_connection_string", s);

            var deserializedConfig = new MiqoConfig()
                                     .Load()
                                     .ApplicationSettings()
                                     .FromString <ConfigClasses.ConfigurationWithEncryption>(s);

            Assert.Equal("super_secret_connection_string", deserializedConfig.ConnectionString);
        }