public void ValueFor() { try { var key = new ConfigurationKey <int>("Key1"); var connectionConfiguration = new ConstantConfiguration( new Dictionary <ConfigurationKeyBase, object> { [ConfigurationKeys.ConsulAddress] = "http://localhost:8500", [ConfigurationKeys.ConsulDatacenter] = "dc1", [ConfigurationKeys.ConsulConfigurationPrefix] = "all-my-keys-start-with-this-value", }); var configuration = new ConsulConfiguration( new[] { key }, connectionConfiguration); var value = configuration.Value(key); Assert.AreEqual(10, value); } catch (ArgumentException e) { Assert.IsInstanceOf <ArgumentException>(e); } }
public void HasValue() { var key = new ConfigurationKey <int>("my_property"); var configuration = new ConstantConfiguration( new Dictionary <ConfigurationKeyBase, object> { [key] = 10 }); var hasValue = configuration.HasValueFor(key); Assert.IsTrue(hasValue); }
public void ValueFor() { var constantValue = 10; var key = new ConfigurationKey <int>("my_property"); var configuration = new ConstantConfiguration( new Dictionary <ConfigurationKeyBase, object> { [key] = constantValue }); var value = configuration.Value(key); Assert.AreEqual(constantValue, value); }
public void HasValue() { var key = new ConfigurationKey <int>("Key1"); var connectionConfiguration = new ConstantConfiguration( new Dictionary <ConfigurationKeyBase, object> { [ConfigurationKeys.ConsulAddress] = "http://localhost:8500", [ConfigurationKeys.ConsulDatacenter] = "dc1", [ConfigurationKeys.ConsulConfigurationPrefix] = "all-my-keys-start-with-this-value", }); var configuration = new ConsulConfiguration( new[] { key }, connectionConfiguration); var hasValue = configuration.HasValueFor(key); Assert.IsFalse(hasValue); }