Exemplo n.º 1
0
        public void add_child_adds_a_dictionary_to_the_dictionary()
        {
            theNode.AddChild("child").SetAttribute("color", "red");

            theNode.Values["child"].As <IDictionary <string, object> >()
            ["color"].ShouldEqual("red");
        }
Exemplo n.º 2
0
        public IDictionary <string, object> Write(IEnumerable <JavascriptRoute> routes)
        {
            var node = new DictionaryMediaNode();

            routes.Each(x => {
                var child = node.AddChild(x.Name);
                var chain = x.FindChain(_resolver);
                child.SetAttribute("name", x.Name);
                child.SetAttribute("method", x.Method);

                child.SetAttribute("url", _routeData.ToUrl(chain));

                var parameters = _routeData.ToParameters(chain);
                if (parameters.Any())
                {
                    child.SetAttribute("params", parameters);
                }
            });

            return(node.Values);
        }