示例#1
0
        public void ValueWithUnknownKey()
        {
            var key           = new ConfigurationKey <int>("b");
            var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>());

            Assert.Throws <ArgumentException>(() => configuration.Value(key));
        }
示例#2
0
        public void HasValueWithUnknownKey()
        {
            var key = new ConfigurationKey <string>("a");

            var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>());

            Assert.IsFalse(configuration.HasValueFor(key));
        }
示例#3
0
        public void ValueWithKnownKey()
        {
            var value         = "a";
            var key           = new ConfigurationKey <string>("b");
            var configuration = new ConstantConfiguration(
                new Dictionary <ConfigurationKeyBase, object>
            {
                [key] = value
            });

            Assert.AreSame(value, configuration.Value(key));
        }
示例#4
0
        public void HasValueWithKnownKey()
        {
            var key = new ConfigurationKey <string>("a");

            var configuration = new ConstantConfiguration(
                new Dictionary <ConfigurationKeyBase, object>
            {
                [key] = 10
            });

            Assert.IsTrue(configuration.HasValueFor(key));
        }
示例#5
0
        public void ValueWithNullKey()
        {
            var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>());

            Assert.Throws <ArgumentNullException>(() => configuration.Value <int>(null));
        }
示例#6
0
        public void HasValueWithNullKey()
        {
            var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>());

            Assert.IsFalse(configuration.HasValueFor(null));
        }