public void ReturnFalse_WhenTheHtmlElementHasNoAttributeStartingWithXml() { // Act var actualResult = new XmlAttributeSanitizer().CanSanitize(ElementFactory.CreateAnchor()); // Assert Assert.IsFalse(actualResult); }
public void ReturnFalse_WhenTheHtmlElementIsNull() { // Act var actualResult = new XmlAttributeSanitizer().CanSanitize(null); // Assert Assert.IsFalse(actualResult); }
public void ReturnTrue_WhenTheHtmlElementHasAnAttributeStartingWithXml() { // Arrange var htmlString = "<p xml:space=\"preserve\">Some text</p>"; var htmlElement = ElementFactory.CreateFromHtmlString(htmlString); // Act var actualResult = new XmlAttributeSanitizer().CanSanitize(htmlElement); // Assert Assert.IsTrue(actualResult); }
public void RemoveAllXmlAttributes() { // Arrange var htmlString = "<p xml:space=\"preserve\">Some text</p>"; var htmlElement = ElementFactory.CreateFromHtmlString(htmlString); // Act var actualResult = new XmlAttributeSanitizer().Sanitize(null, htmlElement); var xmlAttributesExist = htmlElement.Attributes.Any(a => a.Name.StartsWith("xml")); // Assert Assert.IsFalse(xmlAttributesExist); }