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"); }
protected Element() { Attributes = new XhtmlAttributeCollection(); ChildNodes = new List<INode>(); ContentModel = new List<Type>(); IsVisible = true; }
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>>(); }
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"); }
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"); }