public async Task ValidateXsltValid() { var text = @"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:variable name='foo' select='bar' /> </xsl:stylesheet>"; var results = await XmlEditorService.Validate(text, "test.xslt", CancellationToken.None); Assert.AreEqual(0, results.Count); }
public async Task ValidateXsltInvalid() { var text = @"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:varibble name='foo' select='bar' /> </xsl:stylesheet>"; var results = await XmlEditorService.Validate(text, "test.xslt", CancellationToken.None); Assert.AreEqual(1, results.Count); Assert.AreEqual("test.xslt", results [0].FileName); Assert.AreEqual(2, results [0].Line); Assert.AreEqual(2, results [0].Column); Assert.IsTrue(results [0].ErrorText.StartsWith("The element 'stylesheet' in namespace 'http://www.w3.org/1999/XSL/Transform' has invalid child element 'varibble'", System.StringComparison.Ordinal)); }