Exemplo n.º 1
0
        public void Tag_Not_Writes_Blank_XmlNamespaces()
        {
            const string xmlns = "http://foo.com";

              dynamic builder = new DynamicXmlBuilder();
              builder.Foo(new { xmlns = xmlns }, DynamicXmlBuilder.Fragment(x =>
            x.Bar("foobar")
              ));

              var namespaces = FindNamespaces(builder);

              Assert.Equal(1, namespaces.Length);
              Assert.Equal(xmlns, namespaces[0]);
        }
Exemplo n.º 2
0
        public void Tag_Adds_Nested_XmlNamespace_Properly()
        {
            const string xmlns = "http://foo.com";
              const string xmlns2 = "http://foobar.com";

              dynamic builder = new DynamicXmlBuilder();
              builder.Foo(new { xmlns = xmlns }, DynamicXmlBuilder.Fragment(x =>
            x.Bar("foobar", new { xmlns = xmlns2 })
              ));

              var namespaces = FindNamespaces(builder);

              Assert.Equal(2, namespaces.Length);
              Assert.Equal(xmlns, namespaces[0]);
              Assert.Equal(xmlns2, namespaces[1]);
        }