// // 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 vb1 = @" "; string js1 = @" "; XslTransform xslt; [SetUp] public void GetReady () { xslt = new XslTransform (); } [Test] [Category ("NotWorking")] // it depends on "mcs" existence public void TestCSharp () { string style = xslstring.Replace ("***** rewrite here *****", cs1); XmlTextReader xr = new XmlTextReader (style, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] [Category ("NotWorking")] // it depends on "mbas" existence public void TestVB () { string style = xslstring.Replace ("***** rewrite here *****", vb1); XmlTextReader xr = new XmlTextReader (style, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] [Category ("NotWorking")] // it depends on "mjs" existence public void TestJScript () { string style = xslstring.Replace ("***** rewrite here *****", js1); XmlTextReader xr = new XmlTextReader (style, XmlNodeType.Document, null); xslt.Load (xr); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (new StringWriter ())); } [Test] [Ignore ("Actually it should throw compile exception")] [ExpectedException (typeof (XsltException))] public void InvalidScript () { string script = @" "; xslt.Load (new XmlTextReader (script, XmlNodeType.Document, null)); } [Test] [Category ("NotWorking")] // it depends on "mcs" existence public void CompilerWarningsShouldBeIgnored () { string script = @" "; xslt.Load (new XmlTextReader (script, XmlNodeType.Document, null)); xslt.Transform (doc.CreateNavigator (), null, new XmlTextWriter (TextWriter.Null)); } [Test] [Category ("NotWorking")] // it depends on "mcs" existence public void CompileNoLineInfoSource () { // bug #76116 string xslt = @" "; XmlDocument doc = new XmlDocument (); doc.LoadXml (xslt); XslTransform t = new XslTransform (); t.Load (doc); } } }