public void null_when_nothing_matches()
        {
            var v1 = new StubVariable("a");
            var v2 = new StubVariable("b");
            var v3 = new StubVariable("c");
            var v4 = new StubVariable("b");

            theSources.Add(new StubVariableSource
            {
                TheVariables =
                {
                    v1,
                    v2
                }
            });

            theSources.Add(new StubVariableSource
            {
                TheVariables =
                {
                    v3,
                    v4
                }
            });

            theRegistry
            .Find(new VariableExpansionContext(null, "d", null))
            .ShouldBeNull();
        }
        public void finds_the_last_matching_variable()
        {
            var v1 = new StubVariable("a");
            var v2 = new StubVariable("b");
            var v3 = new StubVariable("c");
            var v4 = new StubVariable("b");

            theSources.Add(new StubVariableSource
            {
                TheVariables =
                {
                    v1,
                    v2
                }
            });

            theSources.Add(new StubVariableSource
            {
                TheVariables =
                {
                    v3,
                    v4
                }
            });

            theRegistry
            .Find(new VariableExpansionContext(null, "b", null))
            .ShouldEqual(v4);
        }
        public void expands_the_variable()
        {
            var variable = new StubVariable {
                Value = "bar"
            };

            theRegistry.Variable = variable;

            theExpander.Expand("${foo}").ShouldEqual("bar");
        }
        public void expands_the_variable_from_the_context()
        {
            var variable = new StubVariable {
                Value = "bar"
            };

            theRegistry.Variable = variable;

            var data   = new ModelData();
            var values = new Dictionary <string, object>
            {
                { "foo", "barbarbar" }
            };
            var context = new VariableExpanderContext(data, values);

            theExpander.PushContext(context);

            theExpander.Expand("${foo}").ShouldEqual("barbarbar");
        }