public void ValueWithUnknownKey() { var key = new ConfigurationKey <int>("b"); var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>()); Assert.Throws <ArgumentException>(() => configuration.Value(key)); }
public void HasValueWithUnknownKey() { var key = new ConfigurationKey <string>("a"); var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>()); Assert.IsFalse(configuration.HasValueFor(key)); }
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)); }
public void HasValueWithKnownKey() { var key = new ConfigurationKey <string>("a"); var configuration = new ConstantConfiguration( new Dictionary <ConfigurationKeyBase, object> { [key] = 10 }); Assert.IsTrue(configuration.HasValueFor(key)); }
public void ValueWithNullKey() { var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>()); Assert.Throws <ArgumentNullException>(() => configuration.Value <int>(null)); }
public void HasValueWithNullKey() { var configuration = new ConstantConfiguration(new Dictionary <ConfigurationKeyBase, object>()); Assert.IsFalse(configuration.HasValueFor(null)); }