예제 #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));
        }