Exemple #1
0
        public void Create_child_element()
        {
            var schema  = new Impl.Schema.Schema("schema", NS1);
            var element = schema
                          .CreateRootElement(NS1 + "root-element")
                          .CreateElement(NS1 + "child-element")
                          .CreateAttribute(NS1 + "attr", TestDataTypes.String)
                          .Element();

            element.Name.Should().BeEquivalentTo(NS1 + "child-element");
            element.Attributes.Select(x => (x.Name, x.Type?.Name)).Should().BeEquivalentTo(new[] { (NS1 + "attr", TestDataTypes.String.Name) });
Exemple #2
0
        public void Create_root_element()
        {
            var ns     = (XNamespace)"urn:test";
            var schema = new Impl.Schema.Schema("schema", ns);

            schema
            .CreateRootElement(ns + "root")
            .CreateAttribute(ns + "a", TestDataTypes.String);

            schema.RootElement.Should().NotBeNull();
            schema.RootElement.Name.Should().Be(ns + "root");
            schema.RootElement.Attributes.Select(x => x.Name).Should().BeEquivalentTo(new[] { ns + "a" });
        }
Exemple #3
0
        public void Create_root_element_with_child_element()
        {
            var ns     = (XNamespace)"urn:test";
            var schema = new Impl.Schema.Schema("schema", ns);

            schema
            .CreateRootElement(ns + "root")
            .CreateAttribute(ns + "a", TestDataTypes.String)
            .CreateAttribute(ns + "b", TestDataTypes.String)
            .CreateElement(ns + "child")
            .CreateAttribute(ns + "a", TestDataTypes.String);

            schema.RootElement.Children.Count.Should().Be(1);
            schema.RootElement.Children[0].Name.Should().Be(ns + "child");
        }