public void list_of_media_types_are_of_type_nmtoken()
        {
            var attribs = new XhtmlAttributeCollection();
            attribs.GetAttribute<IList<MediaType>>("types").Add(MediaType.Xml);

            attribs["types"].SerializedValue.ShouldBe("application/xml");
        }
Пример #2
0
 protected Element()
 {
     Attributes = new XhtmlAttributeCollection();
     ChildNodes = new List<INode>();
     ContentModel = new List<Type>();
     IsVisible = true;
 }
Пример #3
0
        public void list_of_media_types_are_of_type_nmtoken()
        {
            var attribs = new XhtmlAttributeCollection();

            attribs.GetAttribute <IList <MediaType> >("types").Add(MediaType.Xml);

            attribs["types"].SerializedValue.ShouldBe("application/xml");
        }
        public void any_attribute_with_simple_types_is_created_automatically()
        {
            var attribs = new XhtmlAttributeCollection();
            attribs.Count.ShouldBe(0);

            attribs.SetAttribute("name", "value");

            attribs["name"].ShouldBeOfType<IAttribute<string>>();
        }
Пример #5
0
        public void any_attribute_with_simple_types_is_created_automatically()
        {
            var attribs = new XhtmlAttributeCollection();

            attribs.Count.ShouldBe(0);

            attribs.SetAttribute("name", "value");

            attribs["name"].ShouldBeAssignableTo <IAttribute <string> >();
        }
        public void attributes_not_in_initial_list_are_added_as_generic_strings()
        {
            var attribs = new XhtmlAttributeCollection
            {
                AllowedAttributes = new Dictionary<string, Func<IAttribute>>
                {
                    {"name", () => new PrimaryTypeAttributeNode<string>("name")},
                    {"value", () => new PrimaryTypeAttributeNode<int?>("value")}
                }
            };

            attribs.SetAttribute("name", "a name");
            attribs.SetAttribute<int?>("value", 3);

            attribs["name"].SerializedValue.ShouldBe("a name");
            attribs["value"].SerializedValue.ShouldBe("3");

            attribs.SetAttribute("unknownValue", "25");

            attribs["unknownValue"].SerializedValue.ShouldBe("25");
        }
Пример #7
0
        public void attributes_not_in_initial_list_are_added_as_generic_strings()
        {
            var attribs = new XhtmlAttributeCollection
            {
                AllowedAttributes = new Dictionary <string, Func <IAttribute> >
                {
                    { "name", () => new PrimaryTypeAttributeNode <string>("name") },
                    { "value", () => new PrimaryTypeAttributeNode <int?>("value") }
                }
            };

            attribs.SetAttribute("name", "a name");
            attribs.SetAttribute <int?>("value", 3);

            attribs["name"].SerializedValue.ShouldBe("a name");
            attribs["value"].SerializedValue.ShouldBe("3");

            attribs.SetAttribute("unknownValue", "25");

            attribs["unknownValue"].SerializedValue.ShouldBe("25");
        }