示例#1
0
        public void ValueWithNullKey()
        {
            var key = new ConfigurationKey <string>("a");

            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.Throws <ArgumentNullException>(() => configuration.Value <string>(null));
        }
示例#2
0
        public void ValueWithUnknownKey()
        {
            var key = new ConfigurationKey <string>("unknown");

            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.Throws <ArgumentException>(() => configuration.Value(key));
        }
示例#3
0
        public void ValueAsUnsignedLongWithKnownKey()
        {
            var value = 10UL;

            var key           = new ConfigurationKey <ulong>("ulong");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#4
0
        public void ValueAsUnsignedShortWithKnownKey()
        {
            ushort value = 10;

            var key           = new ConfigurationKey <ushort>("ushort");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#5
0
        public void ValueAsStringWithKnownKey()
        {
            var value = "string";

            var key           = new ConfigurationKey <string>("string");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#6
0
        public void ValueAsIntWithKnownKey()
        {
            var value = 10;

            var key           = new ConfigurationKey <int>("int");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#7
0
        public void ValueAsDoubleWithKnownKey()
        {
            var value = 10.0d;

            var key           = new ConfigurationKey <double>("double");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#8
0
        public void ValueAsCharacterWithKnownKey()
        {
            var value = 'a';

            var key           = new ConfigurationKey <char>("char");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }
示例#9
0
        public void ValueAsBooleanWithKnownKey()
        {
            var value = true;

            var key           = new ConfigurationKey <bool>("bool");
            var configuration = new ConsulConfiguration(
                new List <ConfigurationKeyBase>
            {
                key
            },
                _subConfiguration);

            Assert.AreEqual(value, configuration.Value(key));
        }