public void Ctor_String(string doctype, HtmlDoctypeType expectedDoctypeType) { HtmlDoctype htmlDoctype = new HtmlDoctype(doctype); Assert.Equal(doctype, htmlDoctype.Doctype); Assert.Equal(expectedDoctypeType, htmlDoctype.DoctypeType); }
public void ToString_ReturnsExpected(HtmlDoctype doctype, string expected) { Assert.Equal(expected, doctype.ToString()); Assert.Equal(expected, doctype.Serialize()); Assert.Equal(expected, doctype.Serialize(HtmlSerializeOptions.None)); Assert.Equal(expected, doctype.Serialize(HtmlSerializeOptions.NoFormatting)); }
public void Ctor_HtmlDoctypeType(HtmlDoctypeType doctype, string expectedDoctype) { HtmlDoctype htmlDoctype = new HtmlDoctype(doctype); Assert.Equal(expectedDoctype, htmlDoctype.Doctype); Assert.Equal(doctype, htmlDoctype.DoctypeType); }
public void Doctype_Set_Get_ReturnsExpected(HtmlDoctype value) { HtmlDocument document = new HtmlDocument(); document.Doctype = value; Assert.Equal(value, document.Doctype); }
public void Equals_ReturnsExpected(HtmlDoctype doctype, object other, bool expected) { if (other is HtmlDoctype || other == null) { Assert.Equal(expected, doctype.GetHashCode().Equals(other?.GetHashCode())); Assert.Equal(expected, doctype.Equals((HtmlDoctype)other)); } Assert.Equal(expected, doctype.Equals(other)); }
public void Serialize_NullDoctype_NotIncluded(HtmlDoctype doctype) { HtmlDocument document = new HtmlDocument(); document.Doctype = doctype; string expectedDocType = doctype == null ? string.Empty : doctype + Environment.NewLine; Helpers.SerializeIgnoringFormatting(document, string.Format(@"{0}<html></html>", expectedDocType)); }
public void ObjectType_Get_ReturnsDoctype() { HtmlDoctype doctype = new HtmlDoctype("doctype"); Assert.Equal(HtmlObjectType.Doctype, doctype.ObjectType); }