public void LoadGeneric8(object param) { string Baseline = "baseline\\" + (string)param; CustomNullResolver myResolver = new CustomNullResolver(_output); if ((LoadXSL("xmlResolver_main.xsl") == 1)) { try { LoadXSL_Resolver("xmlResolver_main.xsl", myResolver); } catch (System.Xml.Xsl.XsltException e1) { // The lovely thing about this test is that the stylesheet, XmlResolver_main.xsl, has an include. GetEntity is therefore called twice. We need to have both these // checks here to ensure that both the XmlResolver_main.xsl and XmlResolver_Include.xsl GetEntity() calls are handled. // Yes, this is effetively the same test as LoadGeneric7, in that we use the NullResolver to return null from a GetEntity call. try { CheckExpectedError(e1, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("XmlResolver_Include.xsl"))).ToString(), "null" }); return; } catch (Xunit.Sdk.TrueException) { CheckExpectedError(e1, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("xmlResolver_main.xsl"))).ToString(), "null" }); return; } } catch (ArgumentNullException e2) { _output.WriteLine(e2.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("ArgumentNullException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } catch (XmlException e3) { _output.WriteLine(e3.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("XmlException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } _output.WriteLine("No exception generated when loading with an invalid resolver after loading with valid resolver"); Assert.True(false); } _output.WriteLine("Could not load style sheet with default resolver"); Assert.True(false); }
public void LoadGeneric6(object param) { string Baseline = "baseline\\" + (string)param; CustomNullResolver myResolver = new CustomNullResolver(_output); try { LoadXSL_Resolver("ShowParam.xsl", myResolver); Transform("fruits.xml"); VerifyResult(Baseline, _strOutFile); return; } catch (ArgumentNullException e) { _output.WriteLine(e.ToString()); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("ArgumentNullException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } catch (XsltException e3) { _output.WriteLine(e3.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("XmlException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } }
public void LoadGeneric7(object param) { string Baseline = "baseline\\" + (string)param; CustomNullResolver myResolver = new CustomNullResolver(_output); try { LoadXSL_Resolver("xmlResolver_main.xsl", myResolver); } //For input types != URI catch (System.Xml.Xsl.XsltException e1) { // The lovely thing about this test is that the stylesheet, XmlResolver_main.xsl, has an include. GetEntity is therefore called twice. We need to have both these // checks here to ensure that both the XmlResolver_main.xsl and XmlResolver_Include.xsl GetEntity() calls are handled. try { CheckExpectedError(e1, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("XmlResolver_Include.xsl"))).ToString(), "null" }); } catch (Xunit.Sdk.TrueException) { CheckExpectedError(e1, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("xmlResolver_main.xsl"))).ToString(), "null" }); } if (LoadXSL("xmlResolver_main.xsl") == 1) { if ((Transform("fruits.xml") == 1) && (CheckResult(428.8541842246) == 1)) return; else Assert.True(false); } else { _output.WriteLine("Failed to load stylesheet using default resolver"); Assert.True(false); } } //For URI catch (System.ArgumentNullException e2) { try { CheckExpectedError(e2, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("XmlResolver_Include.xsl"))).ToString(), "null" }); } catch (Xunit.Sdk.TrueException) { CheckExpectedError(e2, "System.Xml", "Xslt_CannotLoadStylesheet", new string[] { new Uri(Path.GetFullPath(FullFilePath("xmlResolver_main.xsl"))).ToString(), "null" }); } if (LoadXSL("xmlResolver_main.xsl") == 1) { if (Transform("fruits.xml") == 1) { VerifyResult(Baseline, _strOutFile); return; } else Assert.True(false); } else { _output.WriteLine("Failed to load stylesheet using default resolver"); Assert.True(false); } } catch (XmlException e3) { _output.WriteLine(e3.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("XmlException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } Assert.True(false); }
public void LoadGeneric5() { CustomNullResolver myResolver = new CustomNullResolver(_output); try { LoadXSL_Resolver("xmlResolver_main.xsl", myResolver); _output.WriteLine("No exception is thrown"); Assert.True(false); } catch (XsltException e1) { _output.WriteLine(e1.Message); return; } catch (ArgumentNullException e2) { _output.WriteLine(e2.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("ArgumentNullException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } catch (XmlException e3) { _output.WriteLine(e3.Message); if (MyXslInputType() == XslInputType.URI) return; else { _output.WriteLine("XmlException is not supposed to be thrown for the input type '" + MyXslInputType() + "'"); Assert.True(false); } } }
public void LoadGeneric7() { // By design bug #84957: Skip this test for Load(url, resolver) //if (MyInputType() == InputType.URI) //{ // _output.WriteLine("By design bug #84957: Skip this test for Load(url, resolver)"); // return TEST_SKIPPED; //} CustomNullResolver myResolver = new CustomNullResolver(null); try { LoadXSL_Resolver("XmlResolver_Main.xsl", myResolver); } catch (System.Xml.Xsl.XsltCompileException e) { CheckExpectedError(e.InnerException, "System.Data.Sqlxml", "Xslt_CantResolve", new string[] { new Uri(FullFilePath("XmlResolver_Include.xsl", false)).ToString() }); if (LoadXSL("XmlResolver_Main.xsl") == 1) { if ((Transform("fruits.xml") == 1) && (CheckResult(428.8541842246) == 1)) return; else Assert.True(false); } else { _output.WriteLine("Failed to load stylesheet using default resolver"); Assert.True(false); } } Assert.True(false); }
public void LoadGeneric6() { // By design bug #84957: Skip this test for Load(url, resolver) //if (MyInputType() == InputType.URI) //{ // _output.WriteLine("By design bug #84957: Skip this test for Load(url, resolver)"); // return TEST_SKIPPED; //} CustomNullResolver myResolver = new CustomNullResolver(null); if (LoadXSL_Resolver("ShowParam.xsl", myResolver) == 1) { if ((Transform("fruits.xml") == 1) && (CheckResult(466.5112789241) == 1)) return; else Assert.True(false); } else { _output.WriteLine("Failed to load style sheet!"); Assert.True(false); } }
public void LoadGeneric5() { // By design bug #84957: Skip this test for Load(url, resolver) //if (MyInputType() == InputType.URI) //{ // _output.WriteLine("By design bug #84957: Skip this test for Load(url, resolver)"); // return TEST_SKIPPED; //} CustomNullResolver myResolver = new CustomNullResolver(null); try { LoadXSL_Resolver("XmlResolver_Main.xsl", myResolver); } catch (System.Xml.Xsl.XsltCompileException e) { CheckExpectedError(e.InnerException, "System.Data.Sqlxml", "Xslt_CantResolve", new string[] { new Uri(FullFilePath("XmlResolver_Include.xsl", false)).ToString() }); return; } _output.WriteLine("Exception not thrown for null resolver"); Assert.True(false); }
public void LoadGeneric8() { // By design bug #84957: Skip this test for Load(url, resolver) //if (MyInputType() == InputType.URI) //{ // _output.WriteLine("By design bug #84957: Skip this test for Load(url, resolver)"); // return TEST_SKIPPED; //} CustomNullResolver myResolver = new CustomNullResolver(null); if ((LoadXSL("XmlResolver_Main.xsl") == 1)) { try { LoadXSL_Resolver("XmlResolver_Main.xsl", myResolver); } catch (System.Xml.Xsl.XsltCompileException e) { CheckExpectedError(e.InnerException, "System.Data.Sqlxml", "Xslt_CantResolve", new string[] { new Uri(FullFilePath("XmlResolver_Include.xsl", false)).ToString() }); return; } _output.WriteLine("No exception generated when loading with an invalid resolver after loading with valid resolver"); Assert.True(false); } _output.WriteLine("Could not load style sheet with default resolver"); Assert.True(false); }