CanResolveVariable() public méthode

Before requesting a variable resolution, a client should ask, whether the source can resolve a particular variable name.
public CanResolveVariable ( string name ) : bool
name string the name of the variable to resolve
Résultat bool
        public void Basic()
        {
            ConfigurableVariableSource vs = new ConfigurableVariableSource();
            vs.Variables.Add("Key1", "Value1");
            vs.Variables.Add("Key2", "Value2");

            // existing vars
            Assert.IsTrue(vs.CanResolveVariable("key1")); // case insensitive
            Assert.AreEqual("Value1", vs.ResolveVariable("key1")); // case insensitive
            Assert.IsTrue(vs.CanResolveVariable("Key2"));
            Assert.AreEqual("Value2", vs.ResolveVariable("Key2"));

            // non-existant variable
            Assert.IsFalse(vs.CanResolveVariable("Key3"));
            Assert.IsNull(vs.ResolveVariable("Key3"));
        }
        public void Basic()
        {
            ConfigurableVariableSource vs = new ConfigurableVariableSource();

            vs.Variables.Add("Key1", "Value1");
            vs.Variables.Add("Key2", "Value2");

            // existing vars
            Assert.IsTrue(vs.CanResolveVariable("key1"));          // case insensitive
            Assert.AreEqual("Value1", vs.ResolveVariable("key1")); // case insensitive
            Assert.IsTrue(vs.CanResolveVariable("Key2"));
            Assert.AreEqual("Value2", vs.ResolveVariable("Key2"));

            // non-existant variable
            Assert.IsFalse(vs.CanResolveVariable("Key3"));
            Assert.IsNull(vs.ResolveVariable("Key3"));
        }