Example #1
0
        public void ReferenceParsedOnAssignment()
        {
            var reference = new SecretReferenceConfigurationSetting("key", new Uri("http://example.org"));

            reference.Value = ReferenceValueWithFormatting;
            Assert.AreEqual("http://example.com/secret", reference.SecretId.AbsoluteUri);
        }
Example #2
0
        public void CanRountripValue(string value)
        {
            var featureFlag = new SecretReferenceConfigurationSetting();

            featureFlag.Value = value;

            Assert.AreEqual(value, featureFlag.Value);
        }
Example #3
0
        public void CreatingSetsContentType()
        {
            var reference = new SecretReferenceConfigurationSetting("key", new Uri("http://example.com/secret"));

            Assert.AreEqual("application/vnd.microsoft.appconfig.keyvaultref+json;charset=utf-8", reference.ContentType);
            Assert.AreEqual("key", reference.Key);
            Assert.AreEqual("http://example.com/secret", reference.SecretId.AbsoluteUri);
        }
Example #4
0
        public void SettingSecretUriChangesValue()
        {
            var feature = new SecretReferenceConfigurationSetting();

            feature.Value    = ReferenceValueWithFormatting;
            feature.SecretId = new Uri("http://example.org");

            Assert.AreEqual("{\"uri\":\"http://example.org/\"}", feature.Value);
        }
Example #5
0
        public void ReadingPropertiedDoesNotChangeValue()
        {
            var feature = new SecretReferenceConfigurationSetting();

            feature.Value = ReferenceValueWithFormatting;
            _             = feature.SecretId;

            Assert.AreEqual(ReferenceValueWithFormatting, feature.Value);
        }
Example #6
0
        private static ConfigurationSetting ReadSetting(JsonElement root)
        {
            ConfigurationSetting setting;

            if (IsFeatureFlag(root))
            {
                setting = new FeatureFlagConfigurationSetting();
            }
            else if (IsSecretReference(root))
            {
                setting = new SecretReferenceConfigurationSetting();
            }
            else
            {
                setting = new ConfigurationSetting();
            }

            foreach (JsonProperty property in root.EnumerateObject())
            {
                ReadPropertyValue(setting, property);
            }

            return(setting);
        }
Example #7
0
        public void NewFeatureReferenceSerialized()
        {
            var reference = new SecretReferenceConfigurationSetting("key", new Uri("http://example.com/secret"));

            Assert.AreEqual(ReferenceValue, reference.Value);
        }