// // System.Xml.Xsl.MsxslScriptTests.cs // // Author: // Atsushi Enomoto // // (C) 2004 Novell Inc. // using System; using System.IO; using System.Xml; using System.Xml.Xsl; using NUnit.Framework; namespace MonoTests.System.Xml.Xsl { [TestFixture] public class MsxslScriptTests : Assertion { // PI calc stuff are one of MSDN samples. static XmlDocument doc; static MsxslScriptTests () { string inputxml = @" 12 37.5 "; doc = new XmlDocument (); doc.LoadXml (inputxml); } static string xslstring = @" ***** rewrite here ***** TEST: "; string cs1 = @" "; string cs2 = @" "; string vb1 = @" "; string js1 = @" "; XslTransform xslt; [SetUp] public void GetReady () { xslt = new XslTransform (); } [Test] public void TestCSharp () { XmlTextReader xr = new XmlTextReader (cs1, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); xr = new XmlTextReader (cs2, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] public void TestVB () { XmlTextReader xr = new XmlTextReader (vb1, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] public void TestJScript () { XmlTextReader xr = new XmlTextReader (js1, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] [ExpectedException (typeof (XsltCompileException))] public void InvalidScript () { string script = @" "; xslt.Load (new XmlTextReader (script, XmlNodeType.Document, null)); } } }