// // System.Xml.Xsl.XslTransformTests.cs // // Author: // Atsushi Enomoto // // (C) 2002 Atsushi Enomoto // using System; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using NUnit.Framework; namespace MonoTests.System.Xml.Xsl { [TestFixture] public class XslTransformTests : Assertion { XmlDocument doc; XslTransform xslt; XmlDocument result; [SetUp] public void GetReady() { doc = new XmlDocument (); xslt = new XslTransform (); result = new XmlDocument (); } [Test] public void TestBasicTransform () { doc.LoadXml (""); xslt.Load ("Test/XmlFiles/xsl/empty.xsl"); xslt.Transform ("Test/XmlFiles/xsl/empty.xsl", "Test/XmlFiles/xsl/result.xml"); result.Load ("Test/XmlFiles/xsl/result.xml"); AssertEquals ("count", 2, result.ChildNodes.Count); } [Test] [ExpectedException (typeof (XsltCompileException))] public void InvalidStylesheet () { XmlDocument doc = new XmlDocument (); doc.LoadXml (""); XslTransform t = new XslTransform (); t.Load (doc); } [Test] [ExpectedException (typeof (XsltCompileException))] public void EmptyStylesheet () { XmlDocument doc = new XmlDocument (); XslTransform t = new XslTransform (); t.Load (doc); } [Test] [ExpectedException (typeof (XsltCompileException))] public void InvalidStylesheet2 () { string xml = @"text"; string xsl = @" "; XslTransform xslt = new XslTransform (); xslt.Load (new XPathDocument (new XmlTextReader (xsl, XmlNodeType.Document, null))); } } }