diff options
author | Santiago Fernandez Madero <safern@microsoft.com> | 2017-06-17 07:03:31 +0300 |
---|---|---|
committer | Dan Moseley <danmose@microsoft.com> | 2017-06-17 07:03:31 +0300 |
commit | c21e366fcb7b2f07b9fb4a46a25d358427b996cb (patch) | |
tree | b525de9963c50813adb810d7a9bf2a9cbe68abe6 /src/System.Private.Xml/tests/Xslt | |
parent | ebb6a8e32b46f566c6bcb10ae5325db390ba8327 (diff) |
Fix System.Xml.Xsl.XslTransformApi.Tests in uap (#21162)
Diffstat (limited to 'src/System.Private.Xml/tests/Xslt')
3 files changed, 17 insertions, 11 deletions
diff --git a/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTArgumentList.cs b/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTArgumentList.cs index 26d1078893..603863a9f0 100644 --- a/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTArgumentList.cs +++ b/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTArgumentList.cs @@ -20,9 +20,14 @@ namespace System.Xml.Tests public class CArgIntegrity : XsltApiTestCaseBase { private ITestOutputHelper _output; + private string _xslFile; + private string _xmlFile; + public CArgIntegrity(ITestOutputHelper output) : base(output) { _output = output; + _xslFile = $"{GetTestFilePath()}.xsl"; + _xmlFile = $"{GetTestFilePath()}.xml"; } //[Variation(Desc = "Basic Verification Test", Pri = 0)] @@ -51,7 +56,7 @@ namespace System.Xml.Tests </xsl:template> </xsl:stylesheet>"; - private static void WriteFiles(string input, string output) + private void WriteFiles(string input, string output) { using (XmlWriter w = XmlWriter.Create(output)) { @@ -62,10 +67,10 @@ namespace System.Xml.Tests } } - private static void WriteXmlAndXslFiles() + private void WriteXmlAndXslFiles() { - WriteFiles(s_typeXml, "type.xml"); - WriteFiles(s_typeXsl, "type.xsl"); + WriteFiles(s_typeXml, _xmlFile); + WriteFiles(s_typeXsl, _xslFile); } //[Variation(Desc = "Tuple.XsltArgumentList.AddParam/AddExtensionObject", Param = 1)] @@ -94,13 +99,13 @@ namespace System.Xml.Tests #pragma warning disable 0618 XslTransform xslt = new XslTransform(); #pragma warning restore 0618 - xslt.Load("type.xsl"); + xslt.Load(_xslFile); XsltArgumentList xslArg = new XsltArgumentList(); xslArg.AddParam("param", "", t); xslArg.AddExtensionObject("", t); - XPathDocument xpathDom = new XPathDocument("type.xml"); + XPathDocument xpathDom = new XPathDocument(_xmlFile); using (StringWriter sw = new StringWriter()) { xslt.Transform(xpathDom, xslArg, sw); diff --git a/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs b/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs index 2048d5bc31..1dbbacdb4f 100644 --- a/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs +++ b/src/System.Private.Xml/tests/Xslt/XslTransformApi/CXslTransform.cs @@ -2759,7 +2759,7 @@ namespace System.Xml.Tests { if (LoadXSL("XmlResolver_Main.xsl", inputType, readerType) == 1) { - CallTransform(xslt, szFullFilename, "out.xml", null); + CallTransform(xslt, szFullFilename, _strOutFile, null); VerifyResult(expected); return; } @@ -2786,7 +2786,7 @@ namespace System.Xml.Tests if (LoadXSL("xmlResolver_document_function.xsl", inputType, readerType) == 1) { - CallTransform(xslt, szFullFilename, "out.xml", null); + CallTransform(xslt, szFullFilename, _strOutFile, null); VerifyResult(expected); return; } @@ -2920,7 +2920,7 @@ param2 (correct answer is 'local-param2-arg'): local-param2-arg if ((LoadXSL("Bug109644.xsl", inputType, readerType) == 1) && (Transform("foo.xml", transformType, docType) == 1)) { - Assert.Equal(expected, File.ReadAllText("out.xml")); + Assert.Equal(expected, File.ReadAllText(_strOutFile)); return; } else diff --git a/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs b/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs index c26bf1bbf1..0d525ffa93 100644 --- a/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs +++ b/src/System.Private.Xml/tests/Xslt/XslTransformApi/XSLTransform.cs @@ -46,7 +46,7 @@ namespace System.Xml.Tests // Base class for test cases // //////////////////////////////////////////////////////////////// - public class XsltApiTestCaseBase + public class XsltApiTestCaseBase : FileCleanupTestBase { // Generic data for all derived test cases public String szXslNS = "http://www.w3.org/1999/XSL/Transform"; @@ -66,7 +66,7 @@ namespace System.Xml.Tests private bool _fTrace; // Should we write out the results of the transform? // Other global variables - protected string _strOutFile = "out.xml"; // File to create when using write transforms + protected string _strOutFile = null; // File to create when using write transforms #pragma warning disable 0618 protected XslTransform xslt; // Main XslTransform instance @@ -83,6 +83,7 @@ namespace System.Xml.Tests // Make sure that we don't cache the value of the switch to enable testing AppContext.SetSwitch("TestSwitch.LocalAppContext.DisableCaching", true); _output = output; + _strOutFile = GetTestFilePath(); this.Init(null); } |