Beispiel #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));
        }
Beispiel #2
0
        public void HasValueWithUnknownKey()
        {
            var key = new ConfigurationKey <string>("a");

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

            Assert.IsFalse(configuration.HasValueFor(key));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #5
0
        public void ValueWithNullKey()
        {
            var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>());

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

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