1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using Xunit; 6 using Xunit.Abstractions; 7 using System.Collections.Generic; 8 using System.Dynamic; 9 using System.IO; 10 using System.Xml.XPath; 11 using System.Xml.Xsl; 12 13 namespace System.Xml.Tests 14 { 15 /***********************************************************/ 16 /* XsltArgumentList.GetParam */ 17 /***********************************************************/ 18 19 //[TestCase(Name = "XsltArgumentList - GetParam", Desc = "Get Param Test Cases")] 20 public class CArgIntegrity : XsltApiTestCaseBase2 21 { 22 private ITestOutputHelper _output; CArgIntegrity(ITestOutputHelper output)23 public CArgIntegrity(ITestOutputHelper output) : base(output) 24 { 25 _output = output; 26 } 27 28 //[Variation(Desc = "Basic Verification Test", Pri = 0)] 29 [InlineData()] 30 [Theory] GetParam1()31 public void GetParam1() 32 { 33 m_xsltArg = new XsltArgumentList(); 34 35 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 36 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 37 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 38 if (retObj.ToString() != "Test1") 39 Assert.True(false); 40 return; 41 } 42 43 private static string s_typeXml = "<order></order>"; 44 45 private static string s_typeXsl = @"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> 46 <xsl:param name='param'/> 47 <xsl:template match='/'> 48 <order> 49 <param><xsl:value-of select='$param'/></param> 50 </order> 51 </xsl:template> 52 </xsl:stylesheet>"; 53 WriteFiles(string input, string output)54 private static void WriteFiles(string input, string output) 55 { 56 using (XmlWriter w = XmlWriter.Create(output)) 57 { 58 using (XmlReader r = XmlReader.Create(new StringReader(input))) 59 { 60 w.WriteNode(r, false); 61 } 62 } 63 } 64 WriteXmlAndXslFiles()65 private static void WriteXmlAndXslFiles() 66 { 67 WriteFiles(s_typeXml, "type.xml"); 68 WriteFiles(s_typeXsl, "type.xsl"); 69 } 70 71 //[Variation(Desc = "Tuple.XsltArgumentList.AddParam/AddExtensionObject", Param = 1)] 72 [InlineData(1)] 73 //[Variation(Desc = "DynamicObject.XsltArgumentList.AddParam/AddExtensionObject", Param = 2)] 74 [InlineData(2)] 75 //[Variation(Desc = "Guid.XsltArgumentList.AddParam/AddExtensionObject", Param = 3)] 76 [InlineData(3)] 77 //[Variation(Desc = "Dictionary.XsltArgumentList.AddParam/AddExtensionObject", Param = 4)] 78 [InlineData(4)] 79 [Theory] GetParam_Tuple(object param)80 public void GetParam_Tuple(object param) 81 { 82 WriteXmlAndXslFiles(); 83 84 object t = null; 85 switch ((int)param) 86 { 87 case 1: t = Tuple.Create(1, "Melitta", 7.5); break; 88 case 2: t = new TestDynamicObject(); break; 89 case 3: t = new Guid(); break; 90 case 4: t = new Dictionary<string, object>(); break; 91 } 92 _output.WriteLine(t.ToString()); 93 94 XslCompiledTransform xslt = new XslCompiledTransform(); 95 xslt.Load("type.xsl"); 96 97 XsltArgumentList xslArg = new XsltArgumentList(); 98 xslArg.AddParam("param", "", t); 99 xslArg.AddExtensionObject("", t); 100 101 try 102 { 103 xslt.Transform("type.xml", xslArg, new StringWriter()); 104 } 105 catch (Exception e) 106 { 107 _output.WriteLine(e.Message); 108 return; 109 } 110 Assert.True(false); 111 } 112 113 public class TestDynamicObject : DynamicObject 114 { GetDynamicObject()115 public dynamic GetDynamicObject() 116 { 117 return new Dictionary<string, object>(); 118 } 119 } 120 121 //[Variation("Param name is null")] 122 [InlineData()] 123 [Theory] GetParam2()124 public void GetParam2() 125 { 126 m_xsltArg = new XsltArgumentList(); 127 128 retObj = m_xsltArg.GetParam(null, szEmpty); 129 if (retObj != null) 130 { 131 _output.WriteLine("Did not return NULL for null param name {0}", retObj); 132 Assert.True(false); 133 } 134 else 135 return; 136 } 137 138 //[Variation("Param name is empty string")] 139 [InlineData()] 140 [Theory] GetParam3()141 public void GetParam3() 142 { 143 m_xsltArg = new XsltArgumentList(); 144 145 retObj = m_xsltArg.GetParam(szEmpty, szEmpty); 146 if (retObj != null) 147 { 148 _output.WriteLine("Did not return NULL for empty string param name: {0}", retObj); 149 Assert.True(false); 150 } 151 return; 152 } 153 154 //[Variation("Param name is non existent")] 155 [InlineData()] 156 [Theory] GetParam4()157 public void GetParam4() 158 { 159 m_xsltArg = new XsltArgumentList(); 160 161 retObj = m_xsltArg.GetParam("RandomName", szEmpty); 162 if (retObj != null) 163 { 164 _output.WriteLine("Did not return NULL for non-existent parameter name: {0}", retObj); 165 Assert.True(false); 166 } 167 return; 168 } 169 170 //[Variation("Invalid Param name")] 171 [InlineData()] 172 [Theory] GetParam5()173 public void GetParam5() 174 { 175 m_xsltArg = new XsltArgumentList(); 176 177 retObj = m_xsltArg.GetParam(szInvalid, szEmpty); 178 if (retObj != null) 179 { 180 _output.WriteLine("Did not return NULL for an invalid param name"); 181 Assert.True(false); 182 } 183 return; 184 } 185 186 //[Variation("Very Long Param")] 187 [InlineData()] 188 [Theory] GetParam6()189 public void GetParam6() 190 { 191 m_xsltArg = new XsltArgumentList(); 192 193 m_xsltArg.AddParam(szLongString, szEmpty, "Test6"); 194 retObj = m_xsltArg.GetParam(szLongString, szEmpty); 195 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test6", retObj); 196 if (retObj.ToString() != "Test6") 197 Assert.True(false); 198 return; 199 } 200 201 //[Variation("Namespace URI = null")] 202 [InlineData()] 203 [Theory] GetParam7()204 public void GetParam7() 205 { 206 m_xsltArg = new XsltArgumentList(); 207 208 retObj = m_xsltArg.GetParam("myArg1", null); 209 if (retObj != null) 210 { 211 _output.WriteLine("Did not return NULL for null namespace System.Xml.Tests"); 212 Assert.True(false); 213 } 214 return; 215 } 216 217 //[Variation("Namespace URI is empty string")] 218 [InlineData()] 219 [Theory] GetParam8()220 public void GetParam8() 221 { 222 m_xsltArg = new XsltArgumentList(); 223 224 m_xsltArg.AddParam("myArg1", szEmpty, "Test8"); 225 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 226 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test8", retObj); 227 if (retObj.ToString() != "Test8") 228 Assert.True(false); 229 return; 230 } 231 232 //[Variation("Namespace URI non-existent")] 233 [InlineData()] 234 [Theory] GetParam9()235 public void GetParam9() 236 { 237 m_xsltArg = new XsltArgumentList(); 238 239 m_xsltArg.AddParam("myArg1", szEmpty, "Test9"); 240 retObj = m_xsltArg.GetParam("myArg1", "http://www.microsoft.com"); 241 if (retObj != null) 242 { 243 _output.WriteLine("Did not retrieve a null value for non-existent uri"); 244 Assert.True(false); 245 } 246 247 m_xsltArg.AddParam("myArg2", "http://www.msn.com", "Test1"); 248 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 249 if (retObj != null) 250 { 251 _output.WriteLine("Did not retrieve a null value for non-existent uri"); 252 Assert.True(false); 253 } 254 255 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 256 if (retObj != null) 257 { 258 _output.WriteLine("Did not retrieve a null value for non-existent uri"); 259 Assert.True(false); 260 } 261 return; 262 } 263 264 //[Variation("Very long namespace System.Xml.Tests")] 265 [InlineData()] 266 [Theory] GetParam10()267 public void GetParam10() 268 { 269 m_xsltArg = new XsltArgumentList(); 270 271 m_xsltArg.AddParam("myArg1", szLongNS, "Test10"); 272 retObj = m_xsltArg.GetParam("myArg1", szLongNS); 273 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test10", retObj); 274 if (retObj.ToString() != "Test10") 275 Assert.True(false); 276 return; 277 } 278 279 //[Variation("Invalid Namespace URI")] 280 [InlineData()] 281 [Theory] GetParam11()282 public void GetParam11() 283 { 284 m_xsltArg = new XsltArgumentList(); 285 m_xsltArg.AddParam("myArg1", szInvalid, "Test11"); 286 287 retObj = m_xsltArg.GetParam("myArg1", szInvalid); 288 289 Assert.True(retObj.ToString() == "Test11"); //Expected myArg1 = Test11 290 } 291 292 //[Variation("Different Data Types")] 293 [InlineData()] 294 [Theory] GetParam12()295 public void GetParam12() 296 { 297 m_xsltArg = new XsltArgumentList(); 298 String obj = "0.00"; 299 300 // string 301 m_xsltArg.AddParam("myArg1", szEmpty, obj); 302 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 303 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "0.00", retObj); 304 if (retObj.ToString() != "0.00") 305 { 306 _output.WriteLine("Failed to add/get a value for {0} of type {1}", "0.00", "string"); 307 _output.WriteLine("Retrieved: {0} ", retObj); 308 Assert.True(false); 309 } 310 311 //int -- check conversions and value for original object and returned object 312 //DCR - 298350 : Changing the expected value as per this DCR 313 int i = 8; 314 m_xsltArg.AddParam("myArg2", szEmpty, i); 315 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 316 _output.WriteLine("Added Value:{0}\nRetrieved Value:{1}", i, retObj); 317 Assert.Equal(retObj.GetType(), i.GetType()); 318 319 Boolean bF = (1 == 0); 320 m_xsltArg.AddParam("myArg3", szEmpty, bF); 321 retObj = m_xsltArg.GetParam("myArg3", szEmpty); 322 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bF.ToString(), retObj); 323 if (!bF.Equals(retObj)) 324 { 325 _output.WriteLine("Failed to add/get a value for {0} of type {1}", bF.ToString(), "boolean"); 326 _output.WriteLine("Retrieved: {0} ", retObj); 327 Assert.True(false); 328 } 329 330 Boolean bT = (1 == 1); 331 m_xsltArg.AddParam("myArg4", szEmpty, bT); 332 retObj = m_xsltArg.GetParam("myArg4", szEmpty); 333 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bT.ToString(), retObj); 334 if (!bT.Equals(retObj)) 335 { 336 _output.WriteLine("Failed to add/get a value for {0} of type {1}", bT.ToString(), "boolean"); 337 _output.WriteLine("Retrieved: {0} ", retObj); 338 Assert.True(false); 339 } 340 341 XPathDocument xd = new XPathDocument(FullFilePath("Fish.xml")); 342 343 m_xsltArg.AddParam("myArg5", szEmpty, ((IXPathNavigable)xd).CreateNavigator()); 344 retObj = m_xsltArg.GetParam("myArg5", szEmpty); 345 if (retObj == null) 346 { 347 _output.WriteLine("Failed to add/get a value of type {1}", "XPathNavigator"); 348 _output.WriteLine("Retrieved: {0} ", retObj); 349 Assert.True(false); 350 } 351 return; 352 } 353 354 //[Variation("Case Sensitivity")] 355 [InlineData()] 356 [Theory] GetParam13()357 public void GetParam13() 358 { 359 m_xsltArg = new XsltArgumentList(); 360 361 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 362 retObj = m_xsltArg.GetParam("myarg1", szEmpty); 363 if (retObj != null) 364 Assert.True(false); 365 retObj = m_xsltArg.GetParam("myArg1 ", szEmpty); 366 if (retObj != null) 367 Assert.True(false); 368 retObj = m_xsltArg.GetParam("myArg", szEmpty); 369 if (retObj != null) 370 Assert.True(false); 371 372 return; 373 } 374 375 //[Variation("Whitespace")] 376 [InlineData()] 377 [Theory] GetParam14()378 public void GetParam14() 379 { 380 int i = 1; 381 m_xsltArg = new XsltArgumentList(); 382 383 foreach (String str in szWhiteSpace) 384 { 385 m_xsltArg.AddParam("myArg" + i, szEmpty, "Test" + str); 386 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 387 if (retObj.ToString() != "Test" + str) 388 { 389 _output.WriteLine("Error processing {0} test for whitespace arg in first set", i); 390 Assert.True(false); 391 } 392 i++; 393 } 394 395 foreach (String str in szWhiteSpace) 396 { 397 m_xsltArg.AddParam("myArg" + i, szEmpty, "Test"); // dont add whitespace to name here since addparam would throw 398 retObj = m_xsltArg.GetParam("myArg" + str, szEmpty); 399 if (retObj != null) 400 { 401 _output.WriteLine("Error processing {0} test for whitespace arg in second set. Returned object is not null.", i); 402 Assert.True(false); 403 } 404 i++; 405 } 406 return; 407 } 408 409 //[Variation("Call After Param has been removed")] 410 [InlineData()] 411 [Theory] GetParam15()412 public void GetParam15() 413 { 414 m_xsltArg = new XsltArgumentList(); 415 416 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 417 m_xsltArg.RemoveParam("myArg1", szEmpty); 418 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 419 420 if (retObj != null) 421 Assert.True(false); 422 return; 423 } 424 425 //[Variation("Call multiple Times")] 426 [InlineData()] 427 [Theory] GetParam16()428 public void GetParam16() 429 { 430 m_xsltArg = new XsltArgumentList(); 431 int i = 0; 432 433 m_xsltArg.AddParam("myArg1", szEmpty, "Test16"); 434 for (i = 0; i < 200; i++) 435 { 436 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 437 if (retObj.ToString() != "Test16") 438 { 439 _output.WriteLine("Failed after retrieving {0} times", i); 440 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test16", retObj); 441 Assert.True(false); 442 } 443 } 444 _output.WriteLine("Retrievied {0} times", i); 445 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 446 return; 447 } 448 449 //[Variation("Using XSL namespace")] 450 [InlineData()] 451 [Theory] GetParam17()452 public void GetParam17() 453 { 454 m_xsltArg = new XsltArgumentList(); 455 456 m_xsltArg.AddParam("myArg1", szEmpty, "Test17"); 457 458 retObj = m_xsltArg.GetParam("myArg3", szDefaultNS); 459 if (retObj != null) 460 { 461 _output.WriteLine("Return a non-null value when retrieving Param with namespace {0}", szXslNS); 462 Assert.True(false); 463 } 464 return; 465 } 466 467 //[Variation("Resolving conflicts with variables with different namespaces")] 468 [InlineData()] 469 [Theory] GetParam18()470 public void GetParam18() 471 { 472 m_xsltArg = new XsltArgumentList(); 473 474 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 475 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 476 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 477 478 m_xsltArg.AddParam("myArg1", "http://www.msn.com", "Test2"); 479 retObj = m_xsltArg.GetParam("myArg1", "http://www.msn.com"); 480 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 481 482 if (retObj.ToString() != "Test2") 483 Assert.True(false); 484 485 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 486 _output.WriteLine("Retrieve Original Value:{0}\nActual Retrieved Value: {1}", "Test1", retObj); 487 488 if (retObj.ToString() != "Test1") 489 Assert.True(false); 490 return; 491 } 492 493 //[Variation("Namespace AND param = null")] 494 [InlineData()] 495 [Theory] GetParam19()496 public void GetParam19() 497 { 498 m_xsltArg = new XsltArgumentList(); 499 500 retObj = m_xsltArg.GetParam(null, null); 501 if (retObj != null) 502 { 503 _output.WriteLine("Did not return NULL for null parameter name"); 504 Assert.True(false); 505 } 506 return; 507 } 508 509 //[Variation("Data Types - Of type Double ")] 510 [InlineData()] 511 [Theory] GetParamDoubles()512 public void GetParamDoubles() 513 { 514 double d1 = double.PositiveInfinity; 515 double d2 = double.NegativeInfinity; 516 double d3 = double.NaN; 517 double d4 = 2.000001; 518 double d5 = 0.00; 519 double d6 = double.MaxValue; 520 double d7 = double.MinValue; 521 522 m_xsltArg = new XsltArgumentList(); 523 524 m_xsltArg.AddParam("myArg1", szEmpty, d1); 525 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 526 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d1, retObj); 527 if (!double.IsPositiveInfinity((double)retObj)) 528 { 529 _output.WriteLine("Failed to add/get a value for {0}", d1); 530 _output.WriteLine("Retrieved: {0} ", retObj); 531 Assert.True(false); 532 } 533 534 m_xsltArg.AddParam("myArg2", szEmpty, d2); 535 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 536 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d2, retObj); 537 if (!double.IsNegativeInfinity((double)retObj)) 538 { 539 _output.WriteLine("Failed to add/get a value for {0}", d2); 540 _output.WriteLine("Retrieved: {0} ", retObj); 541 Assert.True(false); 542 } 543 544 m_xsltArg.AddParam("myArg3", szEmpty, d3); 545 retObj = m_xsltArg.GetParam("myArg3", szEmpty); 546 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d3, retObj); 547 if (!double.IsNaN((double)retObj)) 548 { 549 _output.WriteLine("Failed to add/get a value for {0}", d3); 550 _output.WriteLine("Retrieved: {0} ", retObj); 551 Assert.True(false); 552 } 553 554 m_xsltArg.AddParam("myArg4", szEmpty, d4); 555 retObj = m_xsltArg.GetParam("myArg4", szEmpty); 556 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d4, retObj); 557 if (!d4.Equals((double)retObj)) 558 { 559 _output.WriteLine("Failed to add/get a value for {0}", d4); 560 _output.WriteLine("Retrieved: {0} ", retObj); 561 Assert.True(false); 562 } 563 564 m_xsltArg.AddParam("myArg5", szEmpty, d5); 565 retObj = m_xsltArg.GetParam("myArg5", szEmpty); 566 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d5, retObj); 567 if (!d5.Equals(retObj)) 568 { 569 _output.WriteLine("Failed to add/get a value for {0}", d5); 570 _output.WriteLine("Retrieved: {0} ", retObj); 571 Assert.True(false); 572 } 573 574 m_xsltArg.AddParam("myArg6", szEmpty, d6); 575 retObj = m_xsltArg.GetParam("myArg6", szEmpty); 576 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d6, retObj); 577 if (!d6.Equals(retObj)) 578 { 579 _output.WriteLine("Failed to add/get a value for {0}", d6); 580 _output.WriteLine("Retrieved: {0} ", retObj); 581 Assert.True(false); 582 } 583 584 m_xsltArg.AddParam("myArg7", szEmpty, d7); 585 retObj = m_xsltArg.GetParam("myArg7", szEmpty); 586 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", d7, retObj); 587 if (!d7.Equals(retObj)) 588 { 589 _output.WriteLine("Failed to add/get a value for {0}", d7); 590 _output.WriteLine("Retrieved: {0} ", retObj); 591 Assert.True(false); 592 } 593 return; 594 } 595 596 //DCR : 298350 - XsltArgumentList no longer reports the same type on the GetParam methods 597 //[Variation(id = 20, Desc = "Add Parameter other than XSLT Data Type and verify the type, expected same as added", Pri = 0)] 598 [InlineData()] 599 [Theory] GetParam20()600 public void GetParam20() 601 { 602 m_xsltArg = new XsltArgumentList(); 603 604 int i = 10; 605 _output.WriteLine("Adding integer parameter of value {0}", i); 606 m_xsltArg.AddParam("intArg", "", i); 607 608 Type exp = i.GetType(); 609 Type act = m_xsltArg.GetParam("intArg", "").GetType(); 610 611 _output.WriteLine("Added Type : {0}", exp); 612 _output.WriteLine("Returned Type : {0}", act); 613 614 Assert.Equal(act, exp); //Expected Type is integer 615 return; 616 } 617 } 618 619 /***********************************************************/ 620 /* XsltArgumentList.GetExtensionObject */ 621 /***********************************************************/ 622 623 //[TestCase(Name = "XsltArgumentList - GetExtensionObject", Desc = "XsltArgumentList.GetExtensionObject")] 624 public class CArgGetExtObj : XsltApiTestCaseBase2 625 { 626 private ITestOutputHelper _output; CArgGetExtObj(ITestOutputHelper output)627 public CArgGetExtObj(ITestOutputHelper output) : base(output) 628 { 629 _output = output; 630 } 631 632 //[Variation(Desc = "Basic Verification Test", Pri = 1)] 633 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 634 [Theory] GetExtObject1(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)635 public void GetExtObject1(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 636 { 637 MyObject obj = new MyObject(1, _output); 638 m_xsltArg = new XsltArgumentList(); 639 640 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 641 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 642 643 _output.WriteLine("Retrieved value: {0}", ((MyObject)retObj).MyValue()); 644 if (((MyObject)retObj).MyValue() != obj.MyValue()) 645 { 646 _output.WriteLine("Set and retrieved value appear to be different"); 647 Assert.True(false); 648 } 649 650 string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"urn:my-object\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>"; 651 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 652 { 653 VerifyResult(expXml); 654 return; 655 } 656 else 657 Assert.True(false); 658 } 659 660 //[Variation("Namespace URI = null")] 661 [InlineData()] 662 [Theory] GetExtObject2()663 public void GetExtObject2() 664 { 665 m_xsltArg = new XsltArgumentList(); 666 667 try 668 { 669 m_xsltArg.GetExtensionObject(null); 670 } 671 catch (System.ArgumentNullException) 672 { 673 return; 674 } 675 _output.WriteLine("ArgumentNullException not thrown for null namespace System.Xml.Tests"); 676 return; 677 } 678 679 //[Variation("Namespace URI is empty string", Param = "showParam.txt")] 680 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 681 [Theory] GetExtObject3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)682 public void GetExtObject3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 683 { 684 string Baseline = Path.Combine("baseline", (string)param); 685 m_xsltArg = new XsltArgumentList(); 686 687 try 688 { 689 retObj = m_xsltArg.GetExtensionObject(szEmpty); 690 } 691 catch (Exception e) 692 { 693 _output.WriteLine(e.ToString()); 694 Assert.True(false); 695 } 696 697 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 698 { 699 VerifyResult(Baseline, _strOutFile); 700 return; 701 } 702 else 703 Assert.True(false); 704 } 705 706 //[Variation("Namespace URI non-existent")] 707 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 708 [Theory] GetExtObject4(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)709 public void GetExtObject4(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 710 { 711 m_xsltArg = new XsltArgumentList(); 712 713 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 714 715 if (retObj != null) 716 { 717 _output.WriteLine("Did not return a NULL value for a non-existent URI"); 718 Assert.True(false); 719 } 720 try 721 { 722 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 723 Transform_ArgList("fruits.xml", outputType, navType); 724 } 725 catch (System.Xml.Xsl.XsltException) 726 { 727 return; 728 } 729 _output.WriteLine("Did not throw exception for an invalid transform"); 730 Assert.True(false); 731 } 732 733 //[Variation("Very long namespace System.Xml.Tests")] 734 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 735 [Theory] GetExtObject5(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)736 public void GetExtObject5(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 737 { 738 m_xsltArg = new XsltArgumentList(); 739 MyObject obj = new MyObject(5, _output); 740 741 m_xsltArg.AddExtensionObject(szLongNS, obj); 742 retObj = m_xsltArg.GetExtensionObject(szLongNS); 743 744 if (((MyObject)retObj).MyValue() != obj.MyValue()) 745 { 746 _output.WriteLine("Set and retrieved value appear to be different"); 747 Assert.True(false); 748 } 749 750 string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"http://www.microsoft.com/this/is/a/very/long/namespace/uri/to/do/the/api/testing/for/xslt/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>"; 751 if ((LoadXSL("myObjectLongNS.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 752 { 753 VerifyResult(expXml); 754 return; 755 } 756 else 757 Assert.True(false); 758 } 759 760 //[Variation("Invalid namespace System.Xml.Tests")] 761 [InlineData()] 762 [Theory] GetExtObject6()763 public void GetExtObject6() 764 { 765 m_xsltArg = new XsltArgumentList(); 766 MyObject obj = new MyObject(6, _output); 767 m_xsltArg.AddExtensionObject(szInvalid, obj); 768 769 retObj = m_xsltArg.GetExtensionObject(szInvalid); 770 771 Assert.True(retObj == obj); 772 } 773 774 //[Variation("Different Data Types")] 775 [InlineData()] 776 [Theory] GetExtObject7()777 public void GetExtObject7() 778 { 779 m_xsltArg = new XsltArgumentList(); 780 String obj = "0.00"; 781 782 // string 783 m_xsltArg.AddExtensionObject("myArg1", obj); 784 retObj = m_xsltArg.GetExtensionObject("myArg1"); 785 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "0.00", retObj); 786 if (retObj.ToString() != "0.00") 787 { 788 _output.WriteLine("Failed to add/get a value for {0} of type {1}", "0.00", "string"); 789 _output.WriteLine("Retrieved: {0} ", retObj); 790 Assert.True(false); 791 } 792 793 int i = 8; 794 795 m_xsltArg.AddExtensionObject("myArg2", i); 796 retObj = m_xsltArg.GetExtensionObject("myArg2"); 797 _output.WriteLine("Added Value:{0}\nRetrieved Value:{1}", i, retObj); 798 if (!i.Equals(retObj)) 799 { 800 _output.WriteLine("Failed to add/get a value for {0} with conversion from int to double", i); 801 _output.WriteLine("Retrieved: {0}", retObj.ToString()); 802 Assert.True(false); 803 } 804 805 //must also be same instance!!! 806 if (i != (int)retObj) 807 Assert.True(false); 808 809 Boolean bF = (1 == 0); 810 811 m_xsltArg.AddExtensionObject("myArg3", bF); 812 retObj = m_xsltArg.GetExtensionObject("myArg3"); 813 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bF.ToString(), retObj); 814 if (!bF.Equals(retObj)) 815 { 816 _output.WriteLine("Failed to add/get a value for {0} of type {1}", bF.ToString(), "boolean"); 817 _output.WriteLine("Retrieved: {0} ", retObj); 818 Assert.True(false); 819 } 820 821 Boolean bT = (1 == 1); 822 823 m_xsltArg.AddExtensionObject("myArg4", bT); 824 retObj = m_xsltArg.GetExtensionObject("myArg4"); 825 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", bT.ToString(), retObj); 826 if (!bT.Equals(retObj)) 827 { 828 _output.WriteLine("Failed to add/get a value for {0} of type {1}", bT.ToString(), "boolean"); 829 _output.WriteLine("Retrieved: {0} ", retObj); 830 Assert.True(false); 831 } 832 return; 833 } 834 835 //[Variation("Case sensitivity")] 836 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 837 [Theory] GetExtObject8(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)838 public void GetExtObject8(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 839 { 840 MyObject obj = new MyObject(8, _output); 841 m_xsltArg = new XsltArgumentList(); 842 843 m_xsltArg.AddExtensionObject("urn:my-object", obj); 844 845 retObj = m_xsltArg.GetExtensionObject("urn:my-object"); 846 if (((MyObject)retObj).MyValue() != obj.MyValue()) 847 { 848 _output.WriteLine("Set and retrieved value appear to be different"); 849 Assert.True(false); 850 } 851 852 retObj = m_xsltArg.GetExtensionObject("URN:MY-OBJECT"); 853 if (retObj != null) 854 { 855 _output.WriteLine("Set and retrieved value appear to be different for URN:MY-OBJECT"); 856 Assert.True(false); 857 } 858 859 retObj = m_xsltArg.GetExtensionObject("urn:My-Object"); 860 if (retObj != null) 861 { 862 _output.WriteLine("Set and retrieved value appear to be different for urn:My-Object"); 863 Assert.True(false); 864 } 865 866 retObj = m_xsltArg.GetExtensionObject("urn-my:object"); 867 if (retObj != null) 868 { 869 _output.WriteLine("Set and retrieved value appear to be different for urn-my:object"); 870 Assert.True(false); 871 } 872 873 string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"urn:my-object\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>"; 874 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 875 { 876 VerifyResult(expXml); 877 return; 878 } 879 else 880 Assert.True(false); 881 } 882 883 //[Variation("Whitespace")] 884 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 885 [Theory] GetExtObject9(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)886 public void GetExtObject9(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 887 { 888 int i = 1; 889 m_xsltArg = new XsltArgumentList(); 890 891 foreach (String str in szWhiteSpace) 892 { 893 MyObject obj = new MyObject(i, _output); 894 895 m_xsltArg.AddExtensionObject(szDefaultNS + str, obj); 896 retObj = m_xsltArg.GetExtensionObject(szDefaultNS + str); 897 if (((MyObject)retObj).MyValue() != i) 898 { 899 _output.WriteLine("Error processing {0} test for whitespace arg", i); 900 Assert.True(false); 901 } 902 i++; 903 } 904 905 try 906 { 907 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 908 Transform_ArgList("fruits.xml", outputType, navType); 909 } 910 catch (System.Xml.Xsl.XsltException) 911 { 912 return; 913 } 914 _output.WriteLine("Did not throw expected exception: System.Xml.Xsl.XsltException"); 915 Assert.True(false); 916 } 917 918 //[Variation("Call after object has been removed")] 919 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 920 [Theory] GetExtObject10(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)921 public void GetExtObject10(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 922 { 923 MyObject obj = new MyObject(10, _output); 924 m_xsltArg = new XsltArgumentList(); 925 926 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 927 m_xsltArg.RemoveExtensionObject(szDefaultNS); 928 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 929 930 if (retObj != null) 931 { 932 _output.WriteLine("Did not retrieve a NULL value for a non-existent object returned"); 933 Assert.True(false); 934 } 935 936 try 937 { 938 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 939 Transform_ArgList("fruits.xml", outputType, navType); 940 } 941 catch (System.Xml.Xsl.XsltException) 942 { 943 return; 944 } 945 _output.WriteLine("Did not throw expected exception: System.Xml.Xsl.XsltException"); 946 Assert.True(false); 947 } 948 949 //[Variation("Call multiple times")] 950 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 951 [Theory] GetExtObject11(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)952 public void GetExtObject11(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 953 { 954 MyObject obj = new MyObject(11, _output); 955 m_xsltArg = new XsltArgumentList(); 956 957 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 958 959 for (int i = 0; i < 500; i++) 960 { 961 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 962 if (((MyObject)retObj).MyValue() != obj.MyValue()) 963 { 964 _output.WriteLine("Set and retrieved value appear to be different after {i} tries", i); 965 Assert.True(false); 966 } 967 } 968 string expXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><result xmlns:myObj=\"urn:my-object\"><func1>1.Test1</func1><func2>2.Test2</func2><func3>3.Test3</func3></result>"; 969 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 970 { 971 VerifyResult(expXml); 972 return; 973 } 974 else 975 Assert.True(false); 976 } 977 978 //[Variation("Using XSL Namespace")] 979 [InlineData()] 980 [Theory] GetExtObject12()981 public void GetExtObject12() 982 { 983 m_xsltArg = new XsltArgumentList(); 984 985 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 986 if (retObj != null) 987 { 988 _output.WriteLine("Did not retrieve null value when using namespace {0}", szXslNS); 989 Assert.True(false); 990 } 991 return; 992 } 993 } 994 995 /***********************************************************/ 996 /* XsltArgumentList.AddParam */ 997 /***********************************************************/ 998 999 //[TestCase(Name = "XsltArgumentList - AddParam : Reader, Reader", Desc = "READER,READER")] 1000 //[TestCase(Name = "XsltArgumentList - AddParam : Reader, Stream", Desc = "READER,STREAM")] 1001 //[TestCase(Name = "XsltArgumentList - AddParam : Reader, Writer", Desc = "READER,WRITER")] 1002 //[TestCase(Name = "XsltArgumentList - AddParam : Reader, TextWriter", Desc = "READER,TEXTWRITER")] 1003 //[TestCase(Name = "XsltArgumentList - AddParam : URI, Reader", Desc = "URI,READER")] 1004 //[TestCase(Name = "XsltArgumentList - AddParam : URI, Stream", Desc = "URI,STREAM")] 1005 //[TestCase(Name = "XsltArgumentList - AddParam : URI, Writer", Desc = "URI,WRITER")] 1006 //[TestCase(Name = "XsltArgumentList - AddParam : URI, TextWriter", Desc = "URI,TEXTWRITER")] 1007 //[TestCase(Name = "XsltArgumentList - AddParam : Navigator, Reader", Desc = "NAVIGATOR,READER")] 1008 //[TestCase(Name = "XsltArgumentList - AddParam : Navigator, Stream", Desc = "NAVIGATOR,STREAM")] 1009 //[TestCase(Name = "XsltArgumentList - AddParam : Navigator, Writer", Desc = "NAVIGATOR,WRITER")] 1010 //[TestCase(Name = "XsltArgumentList - AddParam : Navigator, TextWriter", Desc = "NAVIGATOR,TEXTWRITER")] 1011 public class CArgAddParam : XsltApiTestCaseBase2 1012 { 1013 private ITestOutputHelper _output; CArgAddParam(ITestOutputHelper output)1014 public CArgAddParam(ITestOutputHelper output) : base(output) 1015 { 1016 _output = output; 1017 } 1018 1019 //[Variation(Desc = "Basic Verification Test", Pri = 1, Param = "showParam1.txt")] 1020 [InlineData("showParam1.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1021 [InlineData("showParam1.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1022 [InlineData("showParam1.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1023 [InlineData("showParam1.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1024 [InlineData("showParam1.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1025 [InlineData("showParam1.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1026 [InlineData("showParam1.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1027 [InlineData("showParam1.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1028 [InlineData("showParam1.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1029 [Theory] AddParam1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1030 public void AddParam1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1031 { 1032 string Baseline = Path.Combine("baseline", (string)param); 1033 m_xsltArg = new XsltArgumentList(); 1034 1035 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 1036 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1037 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1038 if (retObj.ToString() != "Test1") 1039 Assert.True(false); 1040 1041 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1042 { 1043 VerifyResult(Baseline, _strOutFile); 1044 return; 1045 } 1046 else 1047 Assert.True(false); 1048 } 1049 1050 //[Variation("Param = null")] 1051 [InlineData()] 1052 [Theory] AddParam2()1053 public void AddParam2() 1054 { 1055 m_xsltArg = new XsltArgumentList(); 1056 1057 try 1058 { 1059 m_xsltArg.AddParam(null, szEmpty, "Test1"); 1060 } 1061 catch (System.ArgumentNullException) 1062 { 1063 return; 1064 } 1065 _output.WriteLine("System.ArgumentNullException not thrown for adding null param"); 1066 Assert.True(false); 1067 } 1068 1069 //[Variation("Param name is empty string")] 1070 [InlineData()] 1071 [Theory] AddParam3()1072 public void AddParam3() 1073 { 1074 m_xsltArg = new XsltArgumentList(); 1075 1076 try 1077 { 1078 m_xsltArg.AddParam(szEmpty, szEmpty, "Test1"); 1079 } 1080 catch (System.ArgumentNullException) 1081 { 1082 return; 1083 } 1084 _output.WriteLine("System.ArgumentNullException not thrown for param name empty string"); 1085 Assert.True(false); 1086 } 1087 1088 //[Variation("Very Long Param Name", Param = "LongParam.txt")] 1089 [InlineData("LongParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1090 [InlineData("LongParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1091 [InlineData("LongParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1092 [InlineData("LongParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1093 [InlineData("LongParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1094 [InlineData("LongParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1095 [InlineData("LongParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1096 [InlineData("LongParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1097 [InlineData("LongParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1098 [Theory] AddParam4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1099 public void AddParam4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1100 { 1101 string Baseline = Path.Combine("baseline", (string)param); 1102 m_xsltArg = new XsltArgumentList(); 1103 1104 m_xsltArg.AddParam(szLongString, szEmpty, "Test1"); 1105 retObj = m_xsltArg.GetParam(szLongString, szEmpty); 1106 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1107 if (retObj.ToString() != "Test1") 1108 Assert.True(false); 1109 1110 if ((LoadXSL("showParamLongName.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1111 { 1112 VerifyResult(Baseline, _strOutFile); 1113 return; 1114 } 1115 else 1116 Assert.True(false); 1117 } 1118 1119 //[Variation("Invalid Param name")] 1120 [InlineData()] 1121 [Theory] AddParam5()1122 public void AddParam5() 1123 { 1124 m_xsltArg = new XsltArgumentList(); 1125 1126 try 1127 { 1128 m_xsltArg.AddParam(szInvalid, szEmpty, "Test1"); 1129 } 1130 catch (System.Xml.XmlException) 1131 { 1132 return; 1133 } 1134 _output.WriteLine("System.Xml.XmlException not thrown for invalid param name"); 1135 Assert.True(false); 1136 } 1137 1138 //[Variation("Namespace URI = null")] 1139 [InlineData()] 1140 [Theory] AddParam6()1141 public void AddParam6() 1142 { 1143 m_xsltArg = new XsltArgumentList(); 1144 1145 try 1146 { 1147 m_xsltArg.AddParam("myArg1", null, "Test1"); 1148 } 1149 catch (System.ArgumentNullException) 1150 { 1151 return; 1152 } 1153 _output.WriteLine("System.ArgumentNullException not thrown for null namespace System.Xml.Tests"); 1154 Assert.True(false); 1155 } 1156 1157 //[Variation("Namespace URI is empty string", Param = "showParam7.txt")] 1158 [InlineData("showParam7.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1159 [InlineData("showParam7.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1160 [InlineData("showParam7.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1161 [InlineData("showParam7.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1162 [InlineData("showParam7.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1163 [InlineData("showParam7.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1164 [InlineData("showParam7.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1165 [InlineData("showParam7.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1166 [InlineData("showParam7.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1167 [Theory] AddParam7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1168 public void AddParam7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1169 { 1170 string Baseline = Path.Combine("baseline", (string)param); 1171 m_xsltArg = new XsltArgumentList(); 1172 1173 m_xsltArg.AddParam("myArg1", szEmpty, "Test7"); 1174 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1175 1176 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test7", retObj); 1177 if (retObj.ToString() != "Test7") 1178 Assert.True(false); 1179 1180 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1181 { 1182 VerifyResult(Baseline, _strOutFile); 1183 return; 1184 } 1185 else 1186 Assert.True(false); 1187 } 1188 1189 //[Variation("Very long namespace System.Xml.Tests", Param = "showParam.txt")] 1190 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1191 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1192 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1193 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1194 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1195 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1196 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1197 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1198 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1199 [Theory] AddParam8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1200 public void AddParam8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1201 { 1202 string Baseline = Path.Combine("baseline", (string)param); 1203 m_xsltArg = new XsltArgumentList(); 1204 1205 m_xsltArg.AddParam("myArg1", szLongNS, "Test8"); 1206 retObj = m_xsltArg.GetParam("myArg1", szLongNS); 1207 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1208 if (retObj.ToString() != "Test8") 1209 Assert.True(false); 1210 1211 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1212 { 1213 VerifyResult(Baseline, _strOutFile); 1214 return; 1215 } 1216 else 1217 Assert.True(false); 1218 } 1219 1220 //[Variation("Invalid Namespace URI")] 1221 [InlineData()] 1222 [Theory] AddParam9()1223 public void AddParam9() 1224 { 1225 m_xsltArg = new XsltArgumentList(); 1226 m_xsltArg.AddParam("myArg1", szInvalid, "Test1"); 1227 retObj = m_xsltArg.GetParam("myArg1", szInvalid); 1228 Assert.True(retObj.ToString() == "Test1"); 1229 } 1230 1231 //[Variation("Setting a param that already exists")] 1232 [InlineData()] 1233 [Theory] AddParam11()1234 public void AddParam11() 1235 { 1236 m_xsltArg = new XsltArgumentList(); 1237 1238 m_xsltArg.AddParam("myArg1", szEmpty, "Test2"); 1239 try 1240 { 1241 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 1242 } 1243 catch (System.ArgumentException) 1244 { 1245 return; 1246 } 1247 _output.WriteLine("Did not throw System.ArgumentException for adding a param that already exists"); 1248 Assert.True(false); 1249 } 1250 1251 //[Variation("Object with same name, different namespace System.Xml.Tests", Param = "AddParam12.txt")] 1252 [InlineData("AddParam12.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1253 [InlineData("AddParam12.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1254 [InlineData("AddParam12.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1255 [InlineData("AddParam12.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1256 [InlineData("AddParam12.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1257 [InlineData("AddParam12.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1258 [InlineData("AddParam12.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1259 [InlineData("AddParam12.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1260 [InlineData("AddParam12.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1261 [Theory] AddParam12(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1262 public void AddParam12(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1263 { 1264 string Baseline = Path.Combine("baseline", (string)param); 1265 1266 m_xsltArg = new XsltArgumentList(); 1267 1268 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 1269 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1270 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1271 if (retObj.ToString() != "Test1") 1272 Assert.True(false); 1273 1274 m_xsltArg.AddParam("myArg1", "http://www.msn.com", "Test2"); 1275 retObj = m_xsltArg.GetParam("myArg1", "http://www.msn.com"); 1276 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 1277 1278 if (retObj.ToString() != "Test2") 1279 Assert.True(false); 1280 1281 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1282 _output.WriteLine("Retrieve Original Value:{0}\nActual Retrieved Value: {1}", "Test1", retObj); 1283 1284 if (retObj.ToString() != "Test1") 1285 Assert.True(false); 1286 1287 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1288 { 1289 VerifyResult(Baseline, _strOutFile); 1290 return; 1291 } 1292 else 1293 Assert.True(false); 1294 } 1295 1296 //[Variation("Object with same namespace System.Xml.Tests, different name", Param = "AddParam13.txt")] 1297 [InlineData("AddParam13.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1298 [InlineData("AddParam13.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1299 [InlineData("AddParam13.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1300 [InlineData("AddParam13.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1301 [InlineData("AddParam13.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1302 [InlineData("AddParam13.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1303 [InlineData("AddParam13.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1304 [InlineData("AddParam13.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1305 [InlineData("AddParam13.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1306 [Theory] AddParam13(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1307 public void AddParam13(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1308 { 1309 string Baseline = Path.Combine("baseline", (string)param); 1310 m_xsltArg = new XsltArgumentList(); 1311 1312 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 1313 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1314 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1315 if (retObj.ToString() != "Test1") 1316 Assert.True(false); 1317 1318 m_xsltArg.AddParam("myArg2", szEmpty, "Test2"); 1319 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 1320 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 1321 1322 if (retObj.ToString() != "Test2") 1323 Assert.True(false); 1324 1325 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1326 _output.WriteLine("Retrieve Original Value:{0}\nActual Retrieved Value: {1}", "Test1", retObj); 1327 1328 if (retObj.ToString() != "Test1") 1329 Assert.True(false); 1330 1331 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1332 { 1333 VerifyResult(Baseline, _strOutFile); 1334 return; 1335 } 1336 else 1337 Assert.True(false); 1338 } 1339 1340 //[Variation("Case Sensitivity", Param = "AddParam14.txt")] 1341 [InlineData("AddParam14.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1342 [InlineData("AddParam14.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1343 [InlineData("AddParam14.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1344 [InlineData("AddParam14.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1345 [InlineData("AddParam14.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1346 [InlineData("AddParam14.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1347 [InlineData("AddParam14.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1348 [InlineData("AddParam14.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1349 [InlineData("AddParam14.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1350 [Theory] AddParam14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1351 public void AddParam14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1352 { 1353 string Baseline = Path.Combine("baseline", (string)param); 1354 m_xsltArg = new XsltArgumentList(); 1355 1356 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 1357 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 1358 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1359 if (retObj.ToString() != "Test1") 1360 Assert.True(false); 1361 1362 m_xsltArg.AddParam("myarg1", szEmpty, "Test2"); 1363 retObj = m_xsltArg.GetParam("myarg1", szEmpty); 1364 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 1365 if (retObj.ToString() != "Test2") 1366 Assert.True(false); 1367 1368 m_xsltArg.AddParam("myArg2", szEmpty, "Test2"); 1369 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 1370 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 1371 if (retObj.ToString() != "Test2") 1372 Assert.True(false); 1373 1374 m_xsltArg.AddParam("myarg3", szEmpty, "Test3"); 1375 retObj = m_xsltArg.GetParam("myarg3", szEmpty); 1376 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test3", retObj); 1377 if (retObj.ToString() != "Test3") 1378 Assert.True(false); 1379 1380 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1381 { 1382 VerifyResult(Baseline, _strOutFile); 1383 return; 1384 } 1385 else 1386 Assert.True(false); 1387 } 1388 1389 //[Variation("Object is null")] 1390 [InlineData()] 1391 [Theory] AddParam15()1392 public void AddParam15() 1393 { 1394 m_xsltArg = new XsltArgumentList(); 1395 1396 try 1397 { 1398 m_xsltArg.AddParam("myArg1", szEmpty, null); 1399 } 1400 catch (System.ArgumentNullException) 1401 { 1402 return; 1403 } 1404 _output.WriteLine("System.ArgumentNullException not thrown for null object"); 1405 Assert.True(false); 1406 } 1407 1408 //[Variation("Add/remove object many times", Param = "AddParam16.txt")] 1409 [InlineData("AddParam16.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1410 [InlineData("AddParam16.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1411 [InlineData("AddParam16.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1412 [InlineData("AddParam16.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1413 [InlineData("AddParam16.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1414 [InlineData("AddParam16.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1415 [InlineData("AddParam16.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1416 [InlineData("AddParam16.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1417 [InlineData("AddParam16.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1418 [Theory] AddParam16(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1419 public void AddParam16(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1420 { 1421 string Baseline = Path.Combine("baseline", (string)param); 1422 m_xsltArg = new XsltArgumentList(); 1423 String obj = "Test"; 1424 1425 for (int i = 0; i < 200; i++) 1426 { 1427 m_xsltArg.AddParam("myArg2", szEmpty, obj + i); 1428 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 1429 if (retObj.ToString() != ("Test" + i)) 1430 { 1431 _output.WriteLine("Failed to add/remove iteration {0}", i); 1432 Assert.True(false); 1433 } 1434 m_xsltArg.RemoveParam("myArg2", szEmpty); 1435 } 1436 1437 for (int i = 0; i < 200; i++) 1438 { 1439 m_xsltArg.AddParam("myArg" + i, szEmpty, obj + i); 1440 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 1441 if (retObj.ToString() != (obj + i)) 1442 { 1443 _output.WriteLine("Failed in 2nd part to add/remove iteration {0}", i); 1444 Assert.True(false); 1445 } 1446 m_xsltArg.RemoveParam("myArg2", szEmpty); 1447 } 1448 1449 for (int i = 0; i < 200; i++) 1450 { 1451 m_xsltArg.RemoveParam("myArg" + i, szEmpty); 1452 } 1453 1454 m_xsltArg.AddParam("myArg2", szEmpty, obj + "2"); 1455 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 1456 if (retObj.ToString() != "Test2") 1457 Assert.True(false); 1458 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1459 { 1460 VerifyResult(Baseline, _strOutFile); 1461 return; 1462 } 1463 else 1464 Assert.True(false); 1465 } 1466 1467 //[Variation("Whitespace in URI and param", Param = "AddParam17.txt")] 1468 [InlineData("AddParam17.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1469 [InlineData("AddParam17.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1470 [InlineData("AddParam17.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1471 [InlineData("AddParam17.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1472 [InlineData("AddParam17.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1473 [InlineData("AddParam17.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1474 [InlineData("AddParam17.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1475 [InlineData("AddParam17.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1476 [InlineData("AddParam17.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1477 [Theory] AddParam17(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1478 public void AddParam17(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1479 { 1480 string Baseline = Path.Combine("baseline", (string)param); 1481 int i = 1; 1482 int errCount = 0; 1483 m_xsltArg = new XsltArgumentList(); 1484 1485 foreach (String str in szWhiteSpace) 1486 { 1487 try 1488 { 1489 m_xsltArg.AddParam("myArg" + i, szEmpty, "Test" + str); 1490 } 1491 catch (System.Xml.XmlException) 1492 { 1493 _output.WriteLine("Improperly reported an exception for a whitespace value"); 1494 Assert.True(false); 1495 } 1496 i++; 1497 } 1498 1499 foreach (String str in szWhiteSpace) 1500 { 1501 try 1502 { 1503 m_xsltArg.AddParam("myArg" + str, szEmpty, "Test"); 1504 } 1505 catch (System.Xml.XmlException) 1506 { 1507 errCount++; 1508 } 1509 finally 1510 { 1511 errCount--; 1512 } 1513 } 1514 1515 if (errCount != 0) 1516 { 1517 _output.WriteLine("At least one whitespace test failed."); 1518 Assert.True(false); 1519 } 1520 1521 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1522 { 1523 VerifyResult(Baseline, _strOutFile); 1524 return; 1525 } 1526 else 1527 Assert.True(false); 1528 } 1529 1530 //[Variation("Adding many objects", Param = "AddParam18.txt")] 1531 [InlineData("AddParam18.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1532 [InlineData("AddParam18.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1533 [InlineData("AddParam18.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1534 [InlineData("AddParam18.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1535 [InlineData("AddParam18.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1536 [InlineData("AddParam18.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1537 [InlineData("AddParam18.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1538 [InlineData("AddParam18.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1539 [InlineData("AddParam18.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1540 [Theory] AddParam18(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1541 public void AddParam18(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1542 { 1543 string Baseline = Path.Combine("baseline", (string)param); 1544 m_xsltArg = new XsltArgumentList(); 1545 String obj = "Test"; 1546 1547 for (int i = 1; i < 7; i++) 1548 { 1549 m_xsltArg.AddParam("myArg" + +i, szEmpty, obj + i); 1550 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 1551 if (retObj.ToString() != ("Test" + i)) 1552 Assert.True(false); 1553 } 1554 1555 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1556 { 1557 VerifyResult(Baseline, _strOutFile); 1558 return; 1559 } 1560 else 1561 Assert.True(false); 1562 } 1563 1564 //[Variation("Add same object many times", Param = "AddParam19.txt")] 1565 [InlineData("AddParam19.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1566 [InlineData("AddParam19.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1567 [InlineData("AddParam19.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1568 [InlineData("AddParam19.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1569 [InlineData("AddParam19.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1570 [InlineData("AddParam19.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1571 [InlineData("AddParam19.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1572 [InlineData("AddParam19.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1573 [InlineData("AddParam19.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1574 [Theory] AddParam19(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1575 public void AddParam19(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1576 { 1577 string Baseline = Path.Combine("baseline", (string)param); 1578 m_xsltArg = new XsltArgumentList(); 1579 String obj = "Test"; 1580 1581 for (int i = 0; i < 300; i++) 1582 { 1583 m_xsltArg.AddParam("myArg" + i, szEmpty, obj + "1"); 1584 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 1585 if (retObj.ToString() != ("Test" + "1")) 1586 { 1587 _output.WriteLine("Failed to add {0}", "myArg" + i); 1588 Assert.True(false); 1589 } 1590 m_xsltArg.RemoveParam("myArg" + i, szEmpty); 1591 } 1592 1593 m_xsltArg.AddParam("myArg2", szEmpty, "Test2"); 1594 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 1595 if (retObj.ToString() != ("Test2")) 1596 Assert.True(false); 1597 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1598 { 1599 VerifyResult(Baseline, _strOutFile); 1600 return; 1601 } 1602 else 1603 Assert.True(false); 1604 } 1605 1606 //[Variation("Using Different XSLT namespace", Param = "AddParam20.txt")] 1607 [InlineData("AddParam20.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1608 [InlineData("AddParam20.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1609 [InlineData("AddParam20.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1610 [InlineData("AddParam20.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1611 [InlineData("AddParam20.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1612 [InlineData("AddParam20.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1613 [InlineData("AddParam20.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1614 [InlineData("AddParam20.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1615 [InlineData("AddParam20.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1616 [Theory] AddParam20(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1617 public void AddParam20(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1618 { 1619 string Baseline = Path.Combine("baseline", (string)param); 1620 1621 m_xsltArg = new XsltArgumentList(); 1622 1623 m_xsltArg.AddParam("myArg1", "urn:" + szXslNS, "Test1"); 1624 retObj = m_xsltArg.GetParam("myArg1", "urn:" + szXslNS); 1625 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 1626 if (retObj.ToString() != "Test1") 1627 Assert.True(false); 1628 1629 m_xsltArg.AddParam("myArg2", "urn:tmp", "Test2"); 1630 retObj = m_xsltArg.GetParam("myArg2", "urn:tmp"); 1631 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test2", retObj); 1632 if (retObj.ToString() != "Test2") 1633 Assert.True(false); 1634 1635 m_xsltArg.AddParam("myArg3", "urn:my-object", "Test3"); 1636 retObj = m_xsltArg.GetParam("myArg3", "urn:my-object"); 1637 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test3", retObj); 1638 if (retObj.ToString() != "Test3") 1639 Assert.True(false); 1640 1641 m_xsltArg.AddParam("myArg4", "urn:MY-OBJECT", "Test4"); 1642 retObj = m_xsltArg.GetParam("myArg4", "urn:MY-OBJECT"); 1643 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test4", retObj); 1644 if (retObj.ToString() != "Test4") 1645 Assert.True(false); 1646 1647 if ((LoadXSL("showParamNS.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 1648 { 1649 VerifyResult(Baseline, _strOutFile); 1650 return; 1651 } 1652 else 1653 Assert.True(false); 1654 } 1655 1656 //[Variation("Using Default XSLT namespace")] 1657 [InlineData()] 1658 [Theory] AddParam21()1659 public void AddParam21() 1660 { 1661 m_xsltArg = new XsltArgumentList(); 1662 m_xsltArg.AddParam("myArg1", szXslNS, "Test1"); 1663 retObj = m_xsltArg.GetParam("myArg1", szXslNS); 1664 1665 Assert.True(retObj.ToString() == "Test1"); 1666 } 1667 1668 //[Variation("Parameters should not be cached")] 1669 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1670 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1671 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1672 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1673 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1674 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1675 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1676 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1677 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1678 [Theory] AddExtObject32(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)1679 public void AddExtObject32(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 1680 { 1681 string expected1 = @"<?xml version=""1.0"" encoding=""utf-8""?><out>Param: first</out>"; 1682 string expected2 = @"<?xml version=""1.0"" encoding=""utf-8""?><out>Param: second</out>"; 1683 1684 if (LoadXSL("test_Param.xsl", xslInputType, readerType) == 1) 1685 { 1686 m_xsltArg = new XsltArgumentList(); 1687 m_xsltArg.AddParam("myParam1", szEmpty, "first"); 1688 1689 // Transform once 1690 if (Transform_ArgList("foo.xml", outputType, navType) == 1) 1691 { 1692 VerifyResult(expected1); 1693 m_xsltArg = new XsltArgumentList(); 1694 m_xsltArg.AddParam("myParam1", szEmpty, "second"); 1695 1696 // Transform again to make sure that parameter from first transform are not cached 1697 if (Transform_ArgList("foo.xml", outputType, navType) == 1) 1698 { 1699 VerifyResult(expected2); 1700 return; 1701 } 1702 } 1703 } 1704 Assert.True(false); 1705 } 1706 } 1707 1708 /***************************************************************/ 1709 /* XsltArgumentList.AddParam Misc Tests */ 1710 /*Bug 268515 - Global param value is overridden by local value */ 1711 /***************************************************************/ 1712 1713 //Testcases with Reader outputs are skipped because they don't write to an output file 1714 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Reader, Stream", Desc = "READER,STREAM")] 1715 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Reader, Writer", Desc = "READER,WRITER")] 1716 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Reader, TextWriter", Desc = "READER,TEXTWRITER")] 1717 //[TestCase(Name = "XsltArgumentList - AddParam Misc : URI, Stream", Desc = "URI,STREAM")] 1718 //[TestCase(Name = "XsltArgumentList - AddParam Misc : URI, Writer", Desc = "URI,WRITER")] 1719 //[TestCase(Name = "XsltArgumentList - AddParam Misc : URI, TextWriter", Desc = "URI,TEXTWRITER")] 1720 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Navigator, Stream", Desc = "NAVIGATOR,STREAM")] 1721 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Navigator, Writer", Desc = "NAVIGATOR,WRITER")] 1722 //[TestCase(Name = "XsltArgumentList - AddParam Misc : Navigator, TextWriter", Desc = "NAVIGATOR,TEXTWRITER")] 1723 public class CArgAddParamMisc : XsltApiTestCaseBase2 1724 { 1725 private ITestOutputHelper _output; CArgAddParamMisc(ITestOutputHelper output)1726 public CArgAddParamMisc(ITestOutputHelper output) : base(output) 1727 { 1728 _output = output; 1729 } 1730 1731 //All the below variations, there is no parameter sent and default global value is set 1732 1733 //global param is xsl:param local param is xsl:param 1734 //[Variation(id = 1, Pri = 2, Desc = "No param sent, global param used, local param exists with a default value", Params = new object[] { "AddParameterA1.xsl", "default local" })] 1735 [InlineData("AddParameterA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1736 [InlineData("AddParameterA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1737 [InlineData("AddParameterA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1738 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1739 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1740 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1741 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1742 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1743 [InlineData("AddParameterA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1744 //[Variation(id = 2, Pri = 2, Desc = "No param sent, global param used, local param exists with no default value", Params = new object[] { "AddParameterA2.xsl", "" })] 1745 [InlineData("AddParameterA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1746 [InlineData("AddParameterA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1747 [InlineData("AddParameterA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1748 [InlineData("AddParameterA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1749 [InlineData("AddParameterA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1750 [InlineData("AddParameterA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1751 [InlineData("AddParameterA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1752 [InlineData("AddParameterA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1753 [InlineData("AddParameterA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1754 //[Variation(id = 3, Pri = 2, Desc = "No param sent, global param used, local param doesn't exist but reference to param exists", Params = new object[] { "AddParameterA3.xsl", "default global" })] 1755 [InlineData("AddParameterA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1756 [InlineData("AddParameterA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1757 [InlineData("AddParameterA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1758 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1759 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1760 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1761 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1762 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1763 [InlineData("AddParameterA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1764 //[Variation(id = 4, Pri = 2, Desc = "No param sent, global param used, local param exists with a default value and with-param sends a value", Params = new object[] { "AddParameterA4.xsl", "with-param" })] 1765 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1766 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1767 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1768 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1769 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1770 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1771 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1772 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1773 [InlineData("AddParameterA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1774 //[Variation(id = 5, Pri = 2, Desc = "No param sent, global param used, local param exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterA5.xsl", "" })] 1775 [InlineData("AddParameterA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1776 [InlineData("AddParameterA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1777 [InlineData("AddParameterA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1778 [InlineData("AddParameterA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1779 [InlineData("AddParameterA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1780 [InlineData("AddParameterA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1781 [InlineData("AddParameterA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1782 [InlineData("AddParameterA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1783 [InlineData("AddParameterA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1784 //[Variation(id = 6, Pri = 2, Desc = "No param sent, global param used, local param doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterA6.xsl", "default global" })] 1785 [InlineData("AddParameterA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1786 [InlineData("AddParameterA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1787 [InlineData("AddParameterA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1788 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1789 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1790 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1791 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1792 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1793 [InlineData("AddParameterA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1794 //[Variation(id = 7, Pri = 2, Desc = "No param sent, global param used, local param doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterA7.xsl", "default global" })] 1795 [InlineData("AddParameterA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1796 [InlineData("AddParameterA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1797 [InlineData("AddParameterA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1798 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1799 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1800 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1801 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1802 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1803 [InlineData("AddParameterA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1804 1805 //global param is xsl:variable local param is xsl:param 1806 //[Variation(id = 8, Pri = 2, Desc = "No param sent, global variable used, local param exists with a default value", Params = new object[] { "AddParameterDA1.xsl", "default local" })] 1807 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1808 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1809 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1810 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1811 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1812 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1813 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1814 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1815 [InlineData("AddParameterDA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1816 //[Variation(id = 9, Pri = 2, Desc = "No param sent, global variable used, local param exists with no default value", Params = new object[] { "AddParameterDA2.xsl", "" })] 1817 [InlineData("AddParameterDA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1818 [InlineData("AddParameterDA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1819 [InlineData("AddParameterDA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1820 [InlineData("AddParameterDA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1821 [InlineData("AddParameterDA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1822 [InlineData("AddParameterDA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1823 [InlineData("AddParameterDA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1824 [InlineData("AddParameterDA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1825 [InlineData("AddParameterDA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1826 //[Variation(id = 10, Pri = 2, Desc = "No param sent, global variable used, local param doesn't exist but reference to param exists", Params = new object[] { "AddParameterDA3.xsl", "default global" })] 1827 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1828 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1829 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1830 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1831 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1832 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1833 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1834 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1835 [InlineData("AddParameterDA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1836 //[Variation(id = 11, Pri = 2, Desc = "No param sent, global variable used, local param exists with a default value and with-param sends a value", Params = new object[] { "AddParameterDA4.xsl", "with-param" })] 1837 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1838 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1839 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1840 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1841 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1842 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1843 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1844 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1845 [InlineData("AddParameterDA4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1846 //[Variation(id = 12, Pri = 2, Desc = "No param sent, global variable used, local param exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterDA5.xsl", "" })] 1847 [InlineData("AddParameterDA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1848 [InlineData("AddParameterDA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1849 [InlineData("AddParameterDA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1850 [InlineData("AddParameterDA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1851 [InlineData("AddParameterDA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1852 [InlineData("AddParameterDA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1853 [InlineData("AddParameterDA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1854 [InlineData("AddParameterDA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1855 [InlineData("AddParameterDA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1856 //[Variation(id = 13, Pri = 2, Desc = "No param sent, global variable used, local param doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterDA6.xsl", "default global" })] 1857 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1858 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1859 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1860 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1861 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1862 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1863 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1864 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1865 [InlineData("AddParameterDA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1866 //[Variation(id = 14, Pri = 2, Desc = "No param sent, global variable used, local param doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterDA7.xsl", "default global" })] 1867 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1868 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1869 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1870 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1871 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1872 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1873 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1874 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1875 [InlineData("AddParameterDA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1876 1877 //global param is xsl:param local param is xsl:variable 1878 //[Variation(id = 15, Pri = 2, Desc = "No param sent, global param used, local variable exists with a default value", Params = new object[] { "AddParameterEA1.xsl", "default local" })] 1879 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1880 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1881 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1882 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1883 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1884 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1885 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1886 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1887 [InlineData("AddParameterEA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1888 //[Variation(id = 16, Pri = 2, Desc = "No param sent, global param used, local variable exists with no default value", Params = new object[] { "AddParameterEA2.xsl", "" })] 1889 [InlineData("AddParameterEA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1890 [InlineData("AddParameterEA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1891 [InlineData("AddParameterEA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1892 [InlineData("AddParameterEA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1893 [InlineData("AddParameterEA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1894 [InlineData("AddParameterEA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1895 [InlineData("AddParameterEA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1896 [InlineData("AddParameterEA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1897 [InlineData("AddParameterEA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1898 //[Variation(id = 17, Pri = 2, Desc = "No param sent, global param used, local variable doesn't exist but reference to param exists", Params = new object[] { "AddParameterEA3.xsl", "default global" })] 1899 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1900 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1901 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1902 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1903 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1904 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1905 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1906 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1907 [InlineData("AddParameterEA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1908 //[Variation(id = 18, Pri = 2, Desc = "No param sent, global param used, local variable exists with a default value and with-param sends a value", Params = new object[] { "AddParameterEA4.xsl", "default local" })] 1909 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1910 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1911 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1912 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1913 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1914 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1915 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1916 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1917 [InlineData("AddParameterEA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1918 //[Variation(id = 19, Pri = 2, Desc = "No param sent, global param used, local variable exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterEA5.xsl", "" })] 1919 [InlineData("AddParameterEA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1920 [InlineData("AddParameterEA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1921 [InlineData("AddParameterEA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1922 [InlineData("AddParameterEA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1923 [InlineData("AddParameterEA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1924 [InlineData("AddParameterEA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1925 [InlineData("AddParameterEA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1926 [InlineData("AddParameterEA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1927 [InlineData("AddParameterEA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1928 //[Variation(id = 20, Pri = 2, Desc = "No param sent, global param used, local variable doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterEA6.xsl", "default global" })] 1929 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1930 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1931 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1932 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1933 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1934 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1935 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1936 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1937 [InlineData("AddParameterEA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1938 //[Variation(id = 21, Pri = 2, Desc = "No param sent, global param used, local variable doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterEA7.xsl", "default global" })] 1939 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1940 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1941 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1942 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1943 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1944 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1945 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1946 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1947 [InlineData("AddParameterEA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1948 1949 //global param is xsl:variable local param is xsl:variable 1950 //[Variation(id = 22, Pri = 2, Desc = "No param sent, global variable used, local variable exists with a default value", Params = new object[] { "AddParameterFA1.xsl", "default local" })] 1951 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1952 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1953 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1954 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1955 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1956 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1957 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1958 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1959 [InlineData("AddParameterFA1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1960 //[Variation(id = 23, Pri = 2, Desc = "No param sent, global variable used, local variable exists with no default value", Params = new object[] { "AddParameterFA2.xsl", "" })] 1961 [InlineData("AddParameterFA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1962 [InlineData("AddParameterFA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1963 [InlineData("AddParameterFA2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1964 [InlineData("AddParameterFA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1965 [InlineData("AddParameterFA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1966 [InlineData("AddParameterFA2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1967 [InlineData("AddParameterFA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1968 [InlineData("AddParameterFA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1969 [InlineData("AddParameterFA2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1970 //[Variation(id = 24, Pri = 2, Desc = "No param sent, global variable used, local variable doesn't exist but reference to param exists", Params = new object[] { "AddParameterFA3.xsl", "default global" })] 1971 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1972 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1973 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1974 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1975 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1976 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1977 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1978 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1979 [InlineData("AddParameterFA3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1980 //[Variation(id = 25, Pri = 2, Desc = "No param sent, global variable used, local variable exists with a default value and with-param sends a value", Params = new object[] { "AddParameterFA4.xsl", "default local" })] 1981 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1982 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1983 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1984 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1985 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1986 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1987 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1988 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1989 [InlineData("AddParameterFA4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1990 //[Variation(id = 26, Pri = 2, Desc = "No param sent, global variable used, local variable exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterFA5.xsl", "" })] 1991 [InlineData("AddParameterFA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1992 [InlineData("AddParameterFA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1993 [InlineData("AddParameterFA5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1994 [InlineData("AddParameterFA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1995 [InlineData("AddParameterFA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1996 [InlineData("AddParameterFA5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 1997 [InlineData("AddParameterFA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 1998 [InlineData("AddParameterFA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 1999 [InlineData("AddParameterFA5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2000 //[Variation(id = 27, Pri = 2, Desc = "No param sent, global variable used, local variable doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterFA6.xsl", "default global" })] 2001 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2002 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2003 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2004 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2005 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2006 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2007 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2008 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2009 [InlineData("AddParameterFA6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2010 //[Variation(id = 28, Pri = 2, Desc = "No param sent, global variable used, local variable doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterFA7.xsl", "default global" })] 2011 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2012 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2013 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2014 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2015 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2016 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2017 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2018 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2019 [InlineData("AddParameterFA7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2020 [Theory] AddParam1(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2021 public void AddParam1(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2022 { 2023 m_xsltArg = new XsltArgumentList(); 2024 string xslFile = param0.ToString(); 2025 string expected = "<result>" + param1.ToString() + "</result>"; 2026 2027 if ((LoadXSL(xslFile, xslInputType, readerType) == 1) && (Transform_ArgList("AddParameter.xml", outputType, navType) == 1)) 2028 { 2029 VerifyResult(expected); 2030 return; 2031 } 2032 else 2033 Assert.True(false); 2034 } 2035 2036 //All the below variations, param is sent from client code 2037 2038 //global param is xsl:param local param is xsl:param 2039 //[Variation(id = 29, Pri = 2, Desc = "Param sent, global param used, local param exists with a default value", Params = new object[] { "AddParameterB1.xsl", "default local" })] 2040 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2041 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2042 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2043 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2044 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2045 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2046 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2047 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2048 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2049 //[Variation(id = 30, Pri = 2, Desc = "Param sent, global param used, local param exists with no default value", Params = new object[] { "AddParameterB2.xsl", "" })] 2050 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2051 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2052 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2053 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2054 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2055 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2056 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2057 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2058 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2059 //[Variation(id = 31, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist but reference to param exists", Params = new object[] { "AddParameterB3.xsl", "outside param" })] 2060 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2061 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2062 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2063 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2064 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2065 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2066 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2067 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2068 [InlineData("AddParameterB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2069 //[Variation(id = 32, Pri = 2, Desc = "Param sent, global param used, local param exists with a default value and with-param sends a value", Params = new object[] { "AddParameterB4.xsl", "with-param" })] 2070 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2071 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2072 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2073 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2074 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2075 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2076 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2077 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2078 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2079 //[Variation(id = 33, Pri = 2, Desc = "Param sent, global param used, local param exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterB5.xsl", "" })] 2080 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2081 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2082 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2083 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2084 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2085 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2086 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2087 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2088 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2089 //[Variation(id = 34, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterB6.xsl", "outside param" })] 2090 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2091 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2092 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2093 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2094 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2095 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2096 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2097 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2098 [InlineData("AddParameterB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2099 //[Variation(id = 35, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterB7.xsl", "outside param" })] 2100 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2101 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2102 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2103 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2104 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2105 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2106 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2107 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2108 [InlineData("AddParameterB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2109 2110 //global param is xsl:variable local param is xsl:param 2111 //[Variation(id = 36, Pri = 2, Desc = "Param sent, global variable used, local param exists with a default value", Params = new object[] { "AddParameterDB1.xsl", "default local" })] 2112 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2113 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2114 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2115 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2116 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2117 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2118 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2119 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2120 [InlineData("AddParameterDB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2121 //[Variation(id = 37, Pri = 2, Desc = "Param sent, global variable used, local param exists with no default value", Params = new object[] { "AddParameterDB2.xsl", "" })] 2122 [InlineData("AddParameterDB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2123 [InlineData("AddParameterDB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2124 [InlineData("AddParameterDB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2125 [InlineData("AddParameterDB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2126 [InlineData("AddParameterDB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2127 [InlineData("AddParameterDB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2128 [InlineData("AddParameterDB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2129 [InlineData("AddParameterDB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2130 [InlineData("AddParameterDB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2131 //[Variation(id = 38, Pri = 2, Desc = "Param sent, global variable used, local param doesn't exist but reference to param exists", Params = new object[] { "AddParameterDB3.xsl", "default global" })] 2132 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2133 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2134 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2135 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2136 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2137 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2138 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2139 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2140 [InlineData("AddParameterDB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2141 //[Variation(id = 39, Pri = 2, Desc = "Param sent, global variable used, local param exists with a default value and with-param sends a value", Params = new object[] { "AddParameterDB4.xsl", "with-param" })] 2142 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2143 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2144 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2145 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2146 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2147 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2148 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2149 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2150 [InlineData("AddParameterDB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2151 //[Variation(id = 40, Pri = 2, Desc = "Param sent, global variable used, local param exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterDB5.xsl", "" })] 2152 [InlineData("AddParameterDB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2153 [InlineData("AddParameterDB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2154 [InlineData("AddParameterDB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2155 [InlineData("AddParameterDB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2156 [InlineData("AddParameterDB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2157 [InlineData("AddParameterDB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2158 [InlineData("AddParameterDB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2159 [InlineData("AddParameterDB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2160 [InlineData("AddParameterDB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2161 //[Variation(id = 41, Pri = 2, Desc = "Param sent, global variable used, local param doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterDB6.xsl", "default global" })] 2162 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2163 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2164 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2165 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2166 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2167 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2168 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2169 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2170 [InlineData("AddParameterDB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2171 //[Variation(id = 42, Pri = 2, Desc = "Param sent, global variable used, local param doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterDB7.xsl", "default global" })] 2172 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2173 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2174 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2175 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2176 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2177 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2178 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2179 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2180 [InlineData("AddParameterDB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2181 2182 //global param is xsl:param local param is xsl:variable 2183 //[Variation(id = 43, Pri = 2, Desc = "Param sent, global param used, local variable exists with a default value", Params = new object[] { "AddParameterEB1.xsl", "default local" })] 2184 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2185 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2186 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2187 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2188 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2189 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2190 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2191 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2192 [InlineData("AddParameterEB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2193 //[Variation(id = 44, Pri = 2, Desc = "Param sent, global param used, local variable exists with no default value", Params = new object[] { "AddParameterEB2.xsl", "" })] 2194 [InlineData("AddParameterEB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2195 [InlineData("AddParameterEB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2196 [InlineData("AddParameterEB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2197 [InlineData("AddParameterEB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2198 [InlineData("AddParameterEB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2199 [InlineData("AddParameterEB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2200 [InlineData("AddParameterEB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2201 [InlineData("AddParameterEB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2202 [InlineData("AddParameterEB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2203 //[Variation(id = 45, Pri = 2, Desc = "Param sent, global param used, local variable doesn't exist but reference to param exists", Params = new object[] { "AddParameterEB3.xsl", "outside param" })] 2204 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2205 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2206 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2207 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2208 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2209 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2210 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2211 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2212 [InlineData("AddParameterEB3.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2213 //[Variation(id = 46, Pri = 2, Desc = "Param sent, global param used, local variable exists with a default value and with-param sends a value", Params = new object[] { "AddParameterEB4.xsl", "default local" })] 2214 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2215 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2216 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2217 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2218 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2219 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2220 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2221 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2222 [InlineData("AddParameterEB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2223 //[Variation(id = 47, Pri = 2, Desc = "Param sent, global param used, local variable exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterEB5.xsl", "" })] 2224 [InlineData("AddParameterEB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2225 [InlineData("AddParameterEB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2226 [InlineData("AddParameterEB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2227 [InlineData("AddParameterEB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2228 [InlineData("AddParameterEB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2229 [InlineData("AddParameterEB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2230 [InlineData("AddParameterEB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2231 [InlineData("AddParameterEB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2232 [InlineData("AddParameterEB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2233 //[Variation(id = 48, Pri = 2, Desc = "Param sent, global param used, local variable doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterEB6.xsl", "outside param" })] 2234 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2235 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2236 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2237 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2238 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2239 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2240 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2241 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2242 [InlineData("AddParameterEB6.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2243 //[Variation(id = 49, Pri = 2, Desc = "Param sent, global param used, local variable doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterEB7.xsl", "outside param" })] 2244 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2245 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2246 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2247 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2248 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2249 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2250 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2251 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2252 [InlineData("AddParameterEB7.xsl", "outside param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2253 2254 //global param is xsl:variable local param is xsl:variable 2255 //[Variation(id = 50, Pri = 2, Desc = "Param sent, global variable used, local variable exists with a default value", Params = new object[] { "AddParameterFB1.xsl", "default local" })] 2256 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2257 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2258 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2259 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2260 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2261 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2262 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2263 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2264 [InlineData("AddParameterFB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2265 //[Variation(id = 51, Pri = 2, Desc = "Param sent, global variable used, local variable exists with no default value", Params = new object[] { "AddParameterFB2.xsl", "" })] 2266 [InlineData("AddParameterFB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2267 [InlineData("AddParameterFB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2268 [InlineData("AddParameterFB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2269 [InlineData("AddParameterFB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2270 [InlineData("AddParameterFB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2271 [InlineData("AddParameterFB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2272 [InlineData("AddParameterFB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2273 [InlineData("AddParameterFB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2274 [InlineData("AddParameterFB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2275 //[Variation(id = 52, Pri = 2, Desc = "Param sent, global variable used, local variable doesn't exist but reference to param exists", Params = new object[] { "AddParameterFB3.xsl", "default global" })] 2276 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2277 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2278 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2279 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2280 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2281 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2282 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2283 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2284 [InlineData("AddParameterFB3.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2285 //[Variation(id = 53, Pri = 2, Desc = "Param sent, global variable used, local variable exists with a default value and with-param sends a value", Params = new object[] { "AddParameterFB4.xsl", "default local" })] 2286 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2287 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2288 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2289 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2290 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2291 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2292 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2293 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2294 [InlineData("AddParameterFB4.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2295 //[Variation(id = 54, Pri = 2, Desc = "Param sent, global variable used, local variable exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterFB5.xsl", "" })] 2296 [InlineData("AddParameterFB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2297 [InlineData("AddParameterFB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2298 [InlineData("AddParameterFB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2299 [InlineData("AddParameterFB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2300 [InlineData("AddParameterFB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2301 [InlineData("AddParameterFB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2302 [InlineData("AddParameterFB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2303 [InlineData("AddParameterFB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2304 [InlineData("AddParameterFB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2305 //[Variation(id = 55, Pri = 2, Desc = "Param sent, global variable used, local variable doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterFB6.xsl", "default global" })] 2306 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2307 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2308 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2309 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2310 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2311 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2312 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2313 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2314 [InlineData("AddParameterFB6.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2315 //[Variation(id = 56, Pri = 2, Desc = "Param sent, global variable used, local variable doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterFB7.xsl", "default global" })] 2316 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2317 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2318 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2319 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2320 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2321 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2322 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2323 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2324 [InlineData("AddParameterFB7.xsl", "default global", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2325 [Theory] AddParam2(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2326 public void AddParam2(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2327 { 2328 string xslFile = param0.ToString(); 2329 string expected = "<result>" + param1.ToString() + "</result>"; 2330 2331 m_xsltArg = new XsltArgumentList(); 2332 m_xsltArg.AddParam("param1", "", "outside param"); 2333 2334 if ((LoadXSL(xslFile, xslInputType, readerType) == 1) && (Transform_ArgList("AddParameter.xml", outputType, navType) == 1)) 2335 { 2336 VerifyResult(expected); 2337 return; 2338 } 2339 else 2340 Assert.True(false); 2341 } 2342 2343 //All the below variations, empty param is sent from client code 2344 //global param is xsl:param local param is xsl:param 2345 //[Variation(id = 57, Pri = 2, Desc = "Param sent, global param used, local param exists with a default value", Params = new object[] { "AddParameterB1.xsl", "default local" })] 2346 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2347 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2348 [InlineData("AddParameterB1.xsl", "default local", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2349 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2350 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2351 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2352 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2353 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2354 [InlineData("AddParameterB1.xsl", "default local", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2355 //[Variation(id = 58, Pri = 2, Desc = "Param sent, global param used, local param exists with no default value", Params = new object[] { "AddParameterB2.xsl", "" })] 2356 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2357 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2358 [InlineData("AddParameterB2.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2359 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2360 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2361 [InlineData("AddParameterB2.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2362 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2363 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2364 [InlineData("AddParameterB2.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2365 //[Variation(id = 59, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist but reference to param exists", Params = new object[] { "AddParameterB3.xsl", "" })] 2366 [InlineData("AddParameterB3.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2367 [InlineData("AddParameterB3.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2368 [InlineData("AddParameterB3.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2369 [InlineData("AddParameterB3.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2370 [InlineData("AddParameterB3.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2371 [InlineData("AddParameterB3.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2372 [InlineData("AddParameterB3.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2373 [InlineData("AddParameterB3.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2374 [InlineData("AddParameterB3.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2375 //[Variation(id = 60, Pri = 2, Desc = "Param sent, global param used, local param exists with a default value and with-param sends a value", Params = new object[] { "AddParameterB4.xsl", "with-param" })] 2376 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2377 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2378 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2379 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2380 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2381 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2382 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2383 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2384 [InlineData("AddParameterB4.xsl", "with-param", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2385 //[Variation(id = 61, Pri = 2, Desc = "Param sent, global param used, local param exists with no default value and with-param doesn't send a value", Params = new object[] { "AddParameterB5.xsl", "" })] 2386 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2387 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2388 [InlineData("AddParameterB5.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2389 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2390 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2391 [InlineData("AddParameterB5.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2392 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2393 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2394 [InlineData("AddParameterB5.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2395 //[Variation(id = 62, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist, reference to param, with-param sends a value", Params = new object[] { "AddParameterB6.xsl", "" })] 2396 [InlineData("AddParameterB6.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2397 [InlineData("AddParameterB6.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2398 [InlineData("AddParameterB6.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2399 [InlineData("AddParameterB6.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2400 [InlineData("AddParameterB6.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2401 [InlineData("AddParameterB6.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2402 [InlineData("AddParameterB6.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2403 [InlineData("AddParameterB6.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2404 [InlineData("AddParameterB6.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2405 //[Variation(id = 63, Pri = 2, Desc = "Param sent, global param used, local param doesn't exist, reference to param, with-param sends no value", Params = new object[] { "AddParameterB7.xsl", "" })] 2406 [InlineData("AddParameterB7.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2407 [InlineData("AddParameterB7.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2408 [InlineData("AddParameterB7.xsl", "", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2409 [InlineData("AddParameterB7.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2410 [InlineData("AddParameterB7.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2411 [InlineData("AddParameterB7.xsl", "", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2412 [InlineData("AddParameterB7.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2413 [InlineData("AddParameterB7.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2414 [InlineData("AddParameterB7.xsl", "", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2415 [Theory] AddParam3(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2416 public void AddParam3(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2417 { 2418 string xslFile = param0.ToString(); 2419 string expected = "<result>" + param1.ToString() + "</result>"; 2420 2421 m_xsltArg = new XsltArgumentList(); 2422 m_xsltArg.AddParam("param1", "", ""); 2423 2424 if ((LoadXSL(xslFile, xslInputType, readerType) == 1) && (Transform_ArgList("AddParameter.xml", outputType, navType) == 1)) 2425 { 2426 VerifyResult(expected); 2427 return; 2428 } 2429 else 2430 Assert.True(false); 2431 } 2432 } 2433 2434 /***********************************************************/ 2435 /* XsltArgumentList.AddExtensionObject */ 2436 /***********************************************************/ 2437 2438 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Reader , Reader", Desc = "READER,READER")] 2439 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Reader, Stream", Desc = "READER,STREAM")] 2440 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Reader, Writer", Desc = "READER,WRITER")] 2441 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Reader, TextWriter", Desc = "READER,TEXTWRITER")] 2442 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : URI, Reader", Desc = "URI,READER")] 2443 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : URI, Stream", Desc = "URI,STREAM")] 2444 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : URI, Writer", Desc = "URI,WRITER")] 2445 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : URI, TextWriter", Desc = "URI,TEXTWRITER")] 2446 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Navigator, Reader", Desc = "NAVIGATOR,READER")] 2447 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Navigator, Stream", Desc = "NAVIGATOR,STREAM")] 2448 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Navigator, Writer", Desc = "NAVIGATOR,WRITER")] 2449 //[TestCase(Name = "XsltArgumentList - AddExtensionObject : Navigator, TextWriter", Desc = "NAVIGATOR,TEXTWRITER")] 2450 public class CArgAddExtObj : XsltApiTestCaseBase2 2451 { 2452 private ITestOutputHelper _output; CArgAddExtObj(ITestOutputHelper output)2453 public CArgAddExtObj(ITestOutputHelper output) : base(output) 2454 { 2455 _output = output; 2456 } 2457 2458 //[Variation(Desc = "Basic Verification Test", Pri = 1, Param = "myObjectDef.txt")] 2459 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2460 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2461 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2462 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2463 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2464 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2465 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2466 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2467 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2468 [Theory] AddExtObject1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2469 public void AddExtObject1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2470 { 2471 MyObject obj = new MyObject(1, _output); 2472 m_xsltArg = new XsltArgumentList(); 2473 string Baseline = Path.Combine("baseline", (string)param); 2474 2475 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2476 2477 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2478 { 2479 VerifyResult(Baseline, _strOutFile); 2480 return; 2481 } 2482 else 2483 Assert.True(false); 2484 } 2485 2486 //[Variation("namespace System.Xml.Tests = null")] 2487 [InlineData()] 2488 [Theory] AddExtObject2()2489 public void AddExtObject2() 2490 { 2491 MyObject obj = new MyObject(2, _output); 2492 m_xsltArg = new XsltArgumentList(); 2493 2494 try 2495 { 2496 m_xsltArg.AddExtensionObject(null, obj); 2497 } 2498 catch (System.ArgumentNullException) 2499 { 2500 return; 2501 } 2502 _output.WriteLine("System.ArgumentNullException not generated for null namespace System.Xml.Tests"); 2503 Assert.True(false); 2504 } 2505 2506 //[Variation("namespace System.Xml.Tests is empty string")] 2507 [InlineData()] 2508 [Theory] AddExtObject3()2509 public void AddExtObject3() 2510 { 2511 MyObject obj = new MyObject(3, _output); 2512 m_xsltArg = new XsltArgumentList(); 2513 2514 m_xsltArg.AddExtensionObject(szEmpty, obj); 2515 2516 return; 2517 } 2518 2519 //[Variation("Very long namespace System.Xml.Tests", Param = "myObjectLongNs.txt")] 2520 [InlineData("myObjectLongNS.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2521 [InlineData("myObjectLongNS.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2522 [InlineData("myObjectLongNS.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2523 [InlineData("myObjectLongNS.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2524 [InlineData("myObjectLongNS.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2525 [InlineData("myObjectLongNS.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2526 [InlineData("myObjectLongNS.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2527 [InlineData("myObjectLongNS.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2528 [InlineData("myObjectLongNS.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2529 [Theory] AddExtObject4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2530 public void AddExtObject4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2531 { 2532 m_xsltArg = new XsltArgumentList(); 2533 MyObject obj = new MyObject(4, _output); 2534 string Baseline = Path.Combine("baseline", (string)param); 2535 2536 m_xsltArg.AddExtensionObject(szLongNS, obj); 2537 2538 if ((LoadXSL("myObjectLongNS.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2539 { 2540 VerifyResult(Baseline, _strOutFile); 2541 return; 2542 } 2543 else 2544 Assert.True(false); 2545 } 2546 2547 //[Variation("Invalid namespace System.Xml.Tests")] 2548 [InlineData()] 2549 [Theory] AddExtObject5()2550 public void AddExtObject5() 2551 { 2552 MyObject obj = new MyObject(5, _output); 2553 m_xsltArg = new XsltArgumentList(); 2554 2555 m_xsltArg.AddExtensionObject(szInvalid, obj); 2556 return; 2557 } 2558 2559 //[Variation("Same Namespace different objects")] 2560 [InlineData()] 2561 [Theory] AddExtObject7()2562 public void AddExtObject7() 2563 { 2564 MyObject obj1 = new MyObject(1, _output); 2565 MyObject obj2 = new MyObject(2, _output); 2566 m_xsltArg = new XsltArgumentList(); 2567 2568 m_xsltArg.AddExtensionObject(szDefaultNS, obj1); 2569 try 2570 { 2571 m_xsltArg.AddExtensionObject(szDefaultNS, obj2); 2572 } 2573 catch (System.ArgumentException) 2574 { 2575 return; 2576 } 2577 _output.WriteLine("Did not launch exception 'System.ArgumentException' for an item already added"); 2578 Assert.True(false); 2579 } 2580 2581 //[Variation("Case sensitivity", Param = "myObjectDef.txt")] 2582 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2583 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2584 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2585 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2586 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2587 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2588 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2589 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2590 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2591 [Theory] AddExtObject8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2592 public void AddExtObject8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2593 { 2594 MyObject obj = new MyObject(1, _output); 2595 m_xsltArg = new XsltArgumentList(); 2596 string Baseline = Path.Combine("baseline", (string)param); 2597 2598 m_xsltArg.AddExtensionObject("urn:my-object", obj); 2599 2600 retObj = m_xsltArg.GetExtensionObject("urn:my-object"); 2601 if (((MyObject)retObj).MyValue() != obj.MyValue()) 2602 { 2603 _output.WriteLine("Set and retrieved value appear to be different"); 2604 Assert.True(false); 2605 } 2606 m_xsltArg.AddExtensionObject("URN:MY-OBJECT", obj); 2607 m_xsltArg.AddExtensionObject("urn:My-Object", obj); 2608 m_xsltArg.AddExtensionObject("urn-my:object", obj); 2609 2610 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2611 { 2612 VerifyResult(Baseline, _strOutFile); 2613 return; 2614 } 2615 else 2616 Assert.True(false); 2617 } 2618 2619 //[Variation("Set a null object")] 2620 [InlineData()] 2621 [Theory] AddExtObject9()2622 public void AddExtObject9() 2623 { 2624 MyObject obj = new MyObject(9, _output); 2625 m_xsltArg = new XsltArgumentList(); 2626 2627 try 2628 { 2629 m_xsltArg.AddExtensionObject(szDefaultNS, null); 2630 } 2631 catch (System.ArgumentNullException) 2632 { 2633 return; 2634 } 2635 _output.WriteLine("Did not launch exception 'System.ArgumentNullException' for adding a null-valued item"); 2636 Assert.True(false); 2637 } 2638 2639 //[Variation("Unitialized and NULL return values from the methods in the extension object")] 2640 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2641 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2642 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2643 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2644 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2645 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2646 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2647 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2648 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2649 [Theory] AddExtObject10(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2650 public void AddExtObject10(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2651 { 2652 string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result xmlns:myObj=""urn:my-object""> 2653 2654 Test1 2655 Test2: 0</result>"; 2656 2657 MyObject obj = new MyObject(10, _output); 2658 m_xsltArg = new XsltArgumentList(); 2659 2660 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2661 2662 if ((LoadXSL("MyObject_Null.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2663 { 2664 VerifyResult(expected); 2665 return; 2666 } 2667 else 2668 Assert.True(false); 2669 } 2670 2671 //[Variation("Add many objects", Param = "myObjectDef.txt")] 2672 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2673 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2674 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2675 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2676 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2677 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2678 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2679 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2680 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2681 [Theory] AddExtObject11(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2682 public void AddExtObject11(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2683 { 2684 string Baseline = Path.Combine("baseline", (string)param); 2685 m_xsltArg = new XsltArgumentList(); 2686 2687 MyObject obj1 = new MyObject(100, _output); 2688 2689 m_xsltArg.AddExtensionObject(szDefaultNS, obj1); 2690 2691 for (int i = 1; i < 500; i++) 2692 { 2693 MyObject obj = new MyObject(i, _output); 2694 m_xsltArg.AddExtensionObject(szDefaultNS + i, obj); 2695 } 2696 2697 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2698 { 2699 VerifyResult(Baseline, _strOutFile); 2700 return; 2701 } 2702 else 2703 Assert.True(false); 2704 } 2705 2706 //[Variation("Whitespace")] 2707 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2708 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2709 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2710 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2711 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2712 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2713 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2714 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2715 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2716 [Theory] AddExtObject12(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2717 public void AddExtObject12(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2718 { 2719 int i = 1; 2720 m_xsltArg = new XsltArgumentList(); 2721 2722 foreach (String str in szWhiteSpace) 2723 { 2724 MyObject obj = new MyObject(i, _output); 2725 m_xsltArg.AddExtensionObject(szDefaultNS + str, obj); 2726 i++; 2727 } 2728 2729 try 2730 { 2731 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 2732 Transform_ArgList("fruits.xml", outputType, navType, true); 2733 } 2734 catch (System.Xml.Xsl.XsltException) 2735 { 2736 return; 2737 } 2738 _output.WriteLine("Did not throw expected exception"); 2739 Assert.True(false); 2740 } 2741 2742 //[Variation("Add object many times")] 2743 [InlineData()] 2744 [Theory] AddExtObject13()2745 public void AddExtObject13() 2746 { 2747 MyObject obj = new MyObject(13, _output); 2748 m_xsltArg = new XsltArgumentList(); 2749 2750 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2751 try 2752 { 2753 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2754 } 2755 catch (System.ArgumentException) 2756 { 2757 return; 2758 } 2759 _output.WriteLine("Did not exception for adding an extension object that already exists"); 2760 Assert.True(false); 2761 } 2762 2763 //[Variation("Add and Remove multiple times", Param = "myObjectDef.txt")] 2764 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2765 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2766 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2767 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2768 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2769 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2770 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2771 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2772 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2773 [Theory] AddExtObject14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2774 public void AddExtObject14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2775 { 2776 string Baseline = Path.Combine("baseline", (string)param); 2777 MyObject obj = new MyObject(14, _output); 2778 m_xsltArg = new XsltArgumentList(); 2779 2780 for (int i = 0; i < 400; i++) 2781 { 2782 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2783 m_xsltArg.RemoveExtensionObject(szDefaultNS); 2784 } 2785 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2786 2787 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2788 { 2789 VerifyResult(Baseline, _strOutFile); 2790 return; 2791 } 2792 else 2793 Assert.True(false); 2794 } 2795 2796 //[Variation("Namespace URI non-existent")] 2797 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2798 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2799 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2800 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2801 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2802 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2803 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2804 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2805 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2806 [Theory] AddExtObject15(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2807 public void AddExtObject15(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2808 { 2809 MyObject obj = new MyObject(15, _output); 2810 m_xsltArg = new XsltArgumentList(); 2811 2812 m_xsltArg.AddExtensionObject(szSimple, obj); 2813 2814 try 2815 { 2816 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 2817 Transform_ArgList("fruits.xml", outputType, navType, true); 2818 } 2819 catch (System.Xml.Xsl.XsltException) 2820 { 2821 return; 2822 } 2823 _output.WriteLine("Did not throw expected exception"); 2824 Assert.True(false); 2825 } 2826 2827 //[Variation("Accessing Private and protected Items")] 2828 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2829 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2830 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2831 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2832 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2833 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2834 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2835 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2836 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2837 [Theory] AddExtObject16(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2838 public void AddExtObject16(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2839 { 2840 MyObject obj = new MyObject(1, _output); 2841 m_xsltArg = new XsltArgumentList(); 2842 2843 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2844 2845 try 2846 { 2847 LoadXSL("MyObject_PrivateAccess.xsl", xslInputType, readerType); 2848 Transform_ArgList("fruits.xml", outputType, navType, true); 2849 } 2850 catch (System.Xml.Xsl.XsltException) 2851 { 2852 try 2853 { 2854 LoadXSL("MyObject_ProtectedAccess.xsl", xslInputType, readerType); 2855 Transform_ArgList("fruits.xml", outputType, navType, true); 2856 } 2857 catch (System.Xml.Xsl.XsltException) 2858 { 2859 try 2860 { 2861 LoadXSL("MyObject_DefaultAccess.xsl", xslInputType, readerType); 2862 Transform_ArgList("fruits.xml", outputType, navType, true); 2863 } 2864 catch (System.Xml.Xsl.XsltException) 2865 { 2866 return; 2867 } 2868 } 2869 } 2870 Assert.True(false); 2871 } 2872 2873 //[Variation("Writing To Output")] 2874 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2875 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2876 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2877 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2878 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2879 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2880 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2881 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2882 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2883 [Theory] AddExtObject17(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2884 public void AddExtObject17(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2885 { 2886 string expected = @"<?xml version=""1.0"" encoding=""utf-8""?><result xmlns:myObj=""urn:my-object""> 2887 Here:End 2888 </result>"; 2889 2890 MyObject obj = new MyObject(17, _output); 2891 m_xsltArg = new XsltArgumentList(); 2892 2893 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2894 2895 if ((LoadXSL("MyObject_ConsoleWrite.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2896 { 2897 VerifyResult(expected); 2898 return; 2899 } 2900 else 2901 Assert.True(false); 2902 } 2903 2904 //[Variation("Recursive Functions", Param = "myObject_Recursion.txt")] 2905 [InlineData("MyObject_Recursion.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2906 [InlineData("MyObject_Recursion.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2907 [InlineData("MyObject_Recursion.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2908 [InlineData("MyObject_Recursion.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2909 [InlineData("MyObject_Recursion.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2910 [InlineData("MyObject_Recursion.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2911 [InlineData("MyObject_Recursion.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2912 [InlineData("MyObject_Recursion.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2913 [InlineData("MyObject_Recursion.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2914 [Theory] AddExtObject18(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2915 public void AddExtObject18(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2916 { 2917 MyObject obj = new MyObject(18, _output); 2918 m_xsltArg = new XsltArgumentList(); 2919 string Baseline = Path.Combine("baseline", (string)param); 2920 2921 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2922 2923 if ((LoadXSL("MyObject_Recursion.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2924 { 2925 VerifyResult(Baseline, _strOutFile); 2926 return; 2927 } 2928 else 2929 Assert.True(false); 2930 } 2931 2932 //[Variation("Function-exists tests", Param = "MyObject_FnExists.txt")] 2933 [InlineData("MyObject_FnExists.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2934 [InlineData("MyObject_FnExists.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2935 [InlineData("MyObject_FnExists.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2936 [InlineData("MyObject_FnExists.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2937 [InlineData("MyObject_FnExists.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2938 [InlineData("MyObject_FnExists.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2939 [InlineData("MyObject_FnExists.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2940 [InlineData("MyObject_FnExists.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2941 [InlineData("MyObject_FnExists.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2942 [Theory] AddExtObject20(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2943 public void AddExtObject20(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2944 { 2945 string Baseline = Path.Combine("baseline", (string)param); 2946 MyObject obj = new MyObject(20, _output); 2947 m_xsltArg = new XsltArgumentList(); 2948 2949 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2950 2951 if ((LoadXSL("MyObject_FnExists.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2952 { 2953 VerifyResult(Baseline, _strOutFile); 2954 return; 2955 } 2956 else 2957 Assert.True(false); 2958 } 2959 2960 //[Variation("Argument Tests", Param = "MyObject_Arguments.txt")] 2961 [InlineData("MyObject_Arguments.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2962 [InlineData("MyObject_Arguments.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2963 [InlineData("MyObject_Arguments.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2964 [InlineData("MyObject_Arguments.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2965 [InlineData("MyObject_Arguments.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2966 [InlineData("MyObject_Arguments.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2967 [InlineData("MyObject_Arguments.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 2968 [InlineData("MyObject_Arguments.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 2969 [InlineData("MyObject_Arguments.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 2970 [Theory] AddExtObject21(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)2971 public void AddExtObject21(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 2972 { 2973 string Baseline = Path.Combine("baseline", (string)param); 2974 MyObject obj = new MyObject(1, _output); 2975 m_xsltArg = new XsltArgumentList(); 2976 2977 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 2978 2979 if ((LoadXSL("MyObject_Arguments.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 2980 { 2981 VerifyResult(Baseline, _strOutFile); 2982 return; 2983 } 2984 else 2985 Assert.True(false); 2986 } 2987 2988 //[Variation("Multiple Objects in same NameSpace")] 2989 [InlineData()] 2990 [Theory] AddExtObject24()2991 public void AddExtObject24() 2992 { 2993 m_xsltArg = new XsltArgumentList(); 2994 2995 double d = 1; 2996 int i = 1; 2997 2998 m_xsltArg.AddExtensionObject("urn:myspace", d); 2999 try 3000 { 3001 m_xsltArg.AddExtensionObject("urn:myspace", i); 3002 } 3003 catch (System.ArgumentException) 3004 { 3005 return; 3006 } 3007 _output.WriteLine("Exception not thrown for URI namespace System.Xml.Tests in use"); 3008 Assert.True(false); 3009 } 3010 3011 //[Variation("Case Sensitivity")] 3012 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3013 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3014 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3015 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3016 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3017 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3018 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3019 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3020 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3021 [Theory] TC_ExtensionObj_Function_Mismatch_IncorrectCasing(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3022 public void TC_ExtensionObj_Function_Mismatch_IncorrectCasing(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3023 { 3024 MyObject obj = new MyObject(25, _output); 3025 m_xsltArg = new XsltArgumentList(); 3026 3027 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 3028 LoadXSL("MyObject_CaseSensitive.xsl", xslInputType, readerType); 3029 var e = Assert.ThrowsAny<XsltException>(() => Transform_ArgList("fruits.xml", outputType, navType)); 3030 var exceptionSourceAssembly = PlatformDetection.IsFullFramework ? "System.Data.SqlXml" : "System.Xml"; 3031 CheckExpectedError(e, exceptionSourceAssembly, "XmlIl_NoExtensionMethod", new[] { "urn:my-object", "FN3", "0" }); 3032 } 3033 3034 //[Variation("Object namespace System.Xml.Tests found")] 3035 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3036 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3037 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3038 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3039 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3040 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3041 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3042 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3043 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3044 [Theory] AddExtObject26(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3045 public void AddExtObject26(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3046 { 3047 MyObject obj = new MyObject(26, _output); 3048 m_xsltArg = new XsltArgumentList(); 3049 3050 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 3051 3052 if ((LoadXSL("MyObject_NotFoundNS.xsl", xslInputType, readerType) == 1)) 3053 { 3054 try 3055 { 3056 Transform_ArgList("fruits.xml", outputType, navType, true); 3057 } 3058 catch (System.Xml.Xsl.XsltException) 3059 { 3060 return; 3061 } 3062 } 3063 _output.WriteLine("Exception not thrown for NS not found"); 3064 Assert.True(false); 3065 } 3066 3067 //[Variation("Maintaining State", Param = "MyObject_KeepingState.txt")] 3068 [InlineData("MyObject_KeepingState.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3069 [InlineData("MyObject_KeepingState.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3070 [InlineData("MyObject_KeepingState.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3071 [InlineData("MyObject_KeepingState.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3072 [InlineData("MyObject_KeepingState.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3073 [InlineData("MyObject_KeepingState.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3074 [InlineData("MyObject_KeepingState.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3075 [InlineData("MyObject_KeepingState.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3076 [InlineData("MyObject_KeepingState.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3077 [Theory] AddExtObject27(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3078 public void AddExtObject27(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3079 { 3080 MyObject obj = new MyObject(27, _output); 3081 m_xsltArg = new XsltArgumentList(); 3082 string Baseline = Path.Combine("baseline", (string)param); 3083 3084 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 3085 3086 if ((LoadXSL("MyObject_KeepingState.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3087 { 3088 VerifyResult(Baseline, _strOutFile); 3089 return; 3090 } 3091 else 3092 Assert.True(false); 3093 } 3094 3095 //[Variation("Deliberately Messing Up the Stylesheet", Param = "MyObject_KillerStrings.txt")] 3096 [InlineData("MyObject_KillerStrings.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3097 [InlineData("MyObject_KillerStrings.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3098 [InlineData("MyObject_KillerStrings.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3099 [InlineData("MyObject_KillerStrings.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3100 [InlineData("MyObject_KillerStrings.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3101 [InlineData("MyObject_KillerStrings.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3102 [InlineData("MyObject_KillerStrings.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3103 [InlineData("MyObject_KillerStrings.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3104 [InlineData("MyObject_KillerStrings.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3105 [Theory] AddExtObject28(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3106 public void AddExtObject28(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3107 { 3108 MyObject obj = new MyObject(28, _output); 3109 m_xsltArg = new XsltArgumentList(); 3110 string Baseline = Path.Combine("baseline", (string)param); 3111 3112 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 3113 3114 if ((LoadXSL("MyObject_KillerStrings.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3115 { 3116 if (outputType == OutputType.Writer) 3117 /* writer output is slighlty different which causes a mismatch so we won't compare */ 3118 return; 3119 VerifyResult(Baseline, _strOutFile); 3120 return; 3121 } 3122 else 3123 Assert.True(false); 3124 } 3125 3126 //[Variation("Function not found in Object")] 3127 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3128 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3129 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3130 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3131 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3132 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3133 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3134 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3135 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3136 [Theory] AddExtObject29(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3137 public void AddExtObject29(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3138 { 3139 MyObject obj = new MyObject(29, _output); 3140 m_xsltArg = new XsltArgumentList(); 3141 3142 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 3143 3144 if ((LoadXSL("MyObject_NotFound.xsl", xslInputType, readerType) == 1)) 3145 { 3146 try 3147 { 3148 Transform_ArgList("fruits.xml", outputType, navType, true); 3149 } 3150 catch (System.Xml.Xsl.XsltException) 3151 { 3152 return; 3153 } 3154 } 3155 _output.WriteLine("Exception not thrown for method not found"); 3156 Assert.True(false); 3157 } 3158 3159 //[Variation("Using Default XSLT namespace")] 3160 [InlineData()] 3161 [Theory] AddExtObject31()3162 public void AddExtObject31() 3163 { 3164 MyObject obj = new MyObject(31, _output); 3165 m_xsltArg = new XsltArgumentList(); 3166 3167 m_xsltArg.AddExtensionObject(szXslNS, obj); 3168 retObj = m_xsltArg.GetExtensionObject(szXslNS); 3169 3170 Assert.Equal(retObj, obj); 3171 } 3172 3173 //[Variation("Extension objects should not be cached during Transform()", Param = "Bug78587")] 3174 [InlineData("Bug78587", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3175 [InlineData("Bug78587", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3176 [InlineData("Bug78587", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3177 [InlineData("Bug78587", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3178 [InlineData("Bug78587", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3179 [InlineData("Bug78587", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3180 [InlineData("Bug78587", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3181 [InlineData("Bug78587", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3182 [InlineData("Bug78587", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3183 [Theory] AddExtObject32(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3184 public void AddExtObject32(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3185 { 3186 string Baseline1 = Path.Combine("baseline", (string)param) + "a.txt"; 3187 string Baseline2 = Path.Combine("baseline", (string)param) + "b.txt"; 3188 3189 if (LoadXSL("Bug78587.xsl", xslInputType, readerType) == 1) 3190 { 3191 m_xsltArg = new XsltArgumentList(); 3192 m_xsltArg.AddExtensionObject("id", new Id("first")); 3193 m_xsltArg.AddExtensionObject("capitalizer", new Capitalizer()); 3194 3195 // Transform once 3196 if (Transform_ArgList("Bug78587.xml", outputType, navType) == 1) 3197 { 3198 VerifyResult(Baseline1, _strOutFile); 3199 m_xsltArg = new XsltArgumentList(); 3200 m_xsltArg.AddExtensionObject("id", new Id("second")); 3201 m_xsltArg.AddExtensionObject("capitalizer", new Capitalizer()); 3202 3203 // Transform again to make sure that extension objects from first transform are not cached 3204 if (Transform_ArgList("Bug78587.xml", outputType, navType) == 1) 3205 { 3206 VerifyResult(Baseline2, _strOutFile); 3207 return; 3208 } 3209 } 3210 } 3211 Assert.True(false); 3212 } 3213 3214 //[Variation(id = 33, Desc = "Calling extension object from select in xsl:apply-templates", Params = new object[] { "apply-templates.xsl", "apply-templates.txt" })] 3215 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3216 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3217 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3218 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3219 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3220 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3221 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3222 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3223 [InlineData("apply-templates.xsl", "apply-templates.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3224 //[Variation(id = 34, Desc = "Calling extension object from select in xsl:for-each", Params = new object[] { "for-each.xsl", "for-each.txt" })] 3225 [InlineData("for-each.xsl", "for-each.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3226 [InlineData("for-each.xsl", "for-each.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3227 [InlineData("for-each.xsl", "for-each.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3228 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3229 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3230 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3231 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3232 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3233 [InlineData("for-each.xsl", "for-each.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3234 //[Variation(id = 35, Desc = "Calling extension object from select in xsl:copy-of", Params = new object[] { "copy-of.xsl", "copy-of.txt" })] 3235 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3236 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3237 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3238 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3239 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3240 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3241 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3242 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3243 [InlineData("copy-of.xsl", "copy-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3244 //[Variation(id = 37, Desc = "Calling extension object from select in xsl:variable", Params = new object[] { "variable.xsl", "variable.txt" })] 3245 [InlineData("variable.xsl", "variable.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3246 [InlineData("variable.xsl", "variable.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3247 [InlineData("variable.xsl", "variable.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3248 [InlineData("variable.xsl", "variable.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3249 [InlineData("variable.xsl", "variable.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3250 [InlineData("variable.xsl", "variable.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3251 [InlineData("variable.xsl", "variable.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3252 [InlineData("variable.xsl", "variable.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3253 [InlineData("variable.xsl", "variable.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3254 //[Variation(id = 38, Desc = "Calling extension object from select in xsl:param", Params = new object[] { "param.xsl", "param.txt" })] 3255 [InlineData("param.xsl", "param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3256 [InlineData("param.xsl", "param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3257 [InlineData("param.xsl", "param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3258 [InlineData("param.xsl", "param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3259 [InlineData("param.xsl", "param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3260 [InlineData("param.xsl", "param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3261 [InlineData("param.xsl", "param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3262 [InlineData("param.xsl", "param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3263 [InlineData("param.xsl", "param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3264 //[Variation(id = 39, Desc = "Calling extension object from select in xsl:with-param", Params = new object[] { "with-param.xsl", "with-param.txt" })] 3265 [InlineData("with-param.xsl", "with-param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3266 [InlineData("with-param.xsl", "with-param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3267 [InlineData("with-param.xsl", "with-param.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3268 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3269 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3270 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3271 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3272 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3273 [InlineData("with-param.xsl", "with-param.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3274 //[Variation(id = 40, Desc = "Calling extension object from select in xsl:value-of", Params = new object[] { "value-of.xsl", "value-of.txt" })] 3275 [InlineData("value-of.xsl", "value-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3276 [InlineData("value-of.xsl", "value-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3277 [InlineData("value-of.xsl", "value-of.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3278 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3279 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3280 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3281 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3282 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3283 [InlineData("value-of.xsl", "value-of.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3284 //[Variation(id = 36, Desc = "Calling extension object from select in xsl:sort", Params = new object[] { "sort.xsl", "sort.txt" })] 3285 [InlineData("sort.xsl", "sort.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3286 [InlineData("sort.xsl", "sort.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3287 [InlineData("sort.xsl", "sort.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3288 [InlineData("sort.xsl", "sort.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3289 [InlineData("sort.xsl", "sort.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3290 [InlineData("sort.xsl", "sort.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3291 [InlineData("sort.xsl", "sort.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3292 [InlineData("sort.xsl", "sort.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3293 [InlineData("sort.xsl", "sort.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3294 3295 [Theory] AddExtObject33(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3296 public void AddExtObject33(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3297 { 3298 ExObj obj = new ExObj(0, _output); 3299 m_xsltArg = new XsltArgumentList(); 3300 string xslFile = param0.ToString(); 3301 string Baseline = Path.Combine("baseline", param1.ToString()); 3302 3303 m_xsltArg.AddExtensionObject("urn-myobject", obj); 3304 3305 if ((LoadXSL(xslFile, xslInputType, readerType) == 1) && (Transform_ArgList("ExtData.xml", outputType, navType) == 1)) 3306 { 3307 VerifyResult(Baseline, _strOutFile); 3308 return; 3309 } 3310 else 3311 Assert.True(false); 3312 } 3313 3314 //[Variation(id = 41, Desc = "Calling extension function from select in xsl:variable and variable is used for incrementing an integer", Params = new object[] { "variable2.xsl", "variable2.txt" })] 3315 [InlineData("variable2.xsl", "variable2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3316 [InlineData("variable2.xsl", "variable2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3317 [InlineData("variable2.xsl", "variable2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3318 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3319 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3320 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3321 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3322 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3323 [InlineData("variable2.xsl", "variable2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3324 //[Variation(id = 42, Desc = "Calling extension function from select in xsl:variable but variable is never used", Params = new object[] { "variable3.xsl", "variable3.txt" })] 3325 [InlineData("variable3.xsl", "variable3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3326 [InlineData("variable3.xsl", "variable3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3327 [InlineData("variable3.xsl", "variable3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3328 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3329 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3330 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3331 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3332 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3333 [InlineData("variable3.xsl", "variable3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3334 //[Variation(id = 43, Desc = "Calling extension function from select in global xsl:variable but variable is never used", Params = new object[] { "variable4.xsl", "variable4.txt" })] 3335 [InlineData("variable4.xsl", "variable4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3336 [InlineData("variable4.xsl", "variable4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3337 [InlineData("variable4.xsl", "variable4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3338 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3339 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3340 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3341 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3342 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3343 [InlineData("variable4.xsl", "variable4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3344 //[Variation(id = 44, Desc = "Calling extension function from select in xsl:param and parameter is used for incrementing an integer", Params = new object[] { "param2.xsl", "param2.txt" })] 3345 [InlineData("param2.xsl", "param2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3346 [InlineData("param2.xsl", "param2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3347 [InlineData("param2.xsl", "param2.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3348 [InlineData("param2.xsl", "param2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3349 [InlineData("param2.xsl", "param2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3350 [InlineData("param2.xsl", "param2.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3351 [InlineData("param2.xsl", "param2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3352 [InlineData("param2.xsl", "param2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3353 [InlineData("param2.xsl", "param2.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3354 //[Variation(id = 45, Desc = "Calling extension function from select in xsl:param but parameter is never used", Params = new object[] { "param3.xsl", "param3.txt" })] 3355 [InlineData("param3.xsl", "param3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3356 [InlineData("param3.xsl", "param3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3357 [InlineData("param3.xsl", "param3.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3358 [InlineData("param3.xsl", "param3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3359 [InlineData("param3.xsl", "param3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3360 [InlineData("param3.xsl", "param3.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3361 [InlineData("param3.xsl", "param3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3362 [InlineData("param3.xsl", "param3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3363 [InlineData("param3.xsl", "param3.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3364 //[Variation(id = 46, Desc = "Calling extension function from select in global xsl:param but parameter is never used", Params = new object[] { "param4.xsl", "param4.txt" })] 3365 [InlineData("param4.xsl", "param4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3366 [InlineData("param4.xsl", "param4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3367 [InlineData("param4.xsl", "param4.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3368 [InlineData("param4.xsl", "param4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3369 [InlineData("param4.xsl", "param4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3370 [InlineData("param4.xsl", "param4.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3371 [InlineData("param4.xsl", "param4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3372 [InlineData("param4.xsl", "param4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3373 [InlineData("param4.xsl", "param4.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3374 [Theory] AddExtObject41(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3375 public void AddExtObject41(object param0, object param1, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3376 { 3377 /* 3378 * In these variations, the XSLT calls the extension function Increment from XSLT. 3379 * In some cases, the variable is never used in the XSLT (Bug 357711) 3380 * Verify by calling an extenfion function like increment and check the state of the variable 3381 */ 3382 ExObj obj = new ExObj(0, _output); 3383 m_xsltArg = new XsltArgumentList(); 3384 string xslFile = param0.ToString(); 3385 string Baseline = "baseline" + Path.DirectorySeparatorChar + param1.ToString(); 3386 3387 m_xsltArg.AddExtensionObject("urn-myobject", obj); 3388 3389 if ((LoadXSL(xslFile, xslInputType, readerType) == 1) && (Transform_ArgList("ExtData.xml", outputType, navType) == 1)) 3390 { 3391 VerifyResult(Baseline, _strOutFile); 3392 return; 3393 } 3394 else 3395 Assert.True(false); 3396 } 3397 } 3398 3399 public class ExObj : XsltApiTestCaseBase2 3400 { 3401 private ITestOutputHelper _output; ExObj(int i, ITestOutputHelper output)3402 public ExObj(int i, ITestOutputHelper output) : base(output) 3403 { 3404 count = 0; 3405 _output = output; 3406 } 3407 3408 //Return a node-set ReturnNodeSet(string xpath)3409 public XPathNodeIterator ReturnNodeSet(string xpath) 3410 { 3411 XmlDocument doc = new XmlDocument(); 3412 doc.LoadXml("<books><book><title>XML Primer</title><author>A</author></book><book><title>XSLT Basics</title><author>B</author></book><book><title>Advanced XSLT</title><author>C</author></book></books>"); 3413 XPathNavigator nav = doc.CreateNavigator(); 3414 XPathNodeIterator iterator = nav.Select(xpath); 3415 return iterator; 3416 } 3417 3418 public static int count; 3419 Increment()3420 public int Increment() 3421 { 3422 return ++count; 3423 } 3424 } 3425 3426 /***********************************************************/ 3427 /* XsltArgumentList.RemoveParam */ 3428 /***********************************************************/ 3429 3430 //[TestCase(Name = "XsltArgumentList - RemoveParam : Reader , Reader", Desc = "READER,READER")] 3431 //[TestCase(Name = "XsltArgumentList - RemoveParam : URI, Stream", Desc = "URI,STREAM")] 3432 //[TestCase(Name = "XsltArgumentList - RemoveParam : Navigator, Writer", Desc = "NAVIGATOR,WRITER")] 3433 //[TestCase(Name = "XsltArgumentList - RemoveParam : Navigator, TextWriter", Desc = "NAVIGATOR,TEXTWRITER")] 3434 public class CArgRemoveParam : XsltApiTestCaseBase2 3435 { 3436 private string _baseline = string.Empty; 3437 3438 private ITestOutputHelper _output; CArgRemoveParam(ITestOutputHelper output)3439 public CArgRemoveParam(ITestOutputHelper output) : base(output) 3440 { 3441 _output = output; 3442 } 3443 3444 //[Variation(id = 1, Desc = "Basic Verification Test", Pri = 1, Param = "RemoveParam1.txt")] 3445 [InlineData("RemoveParam1.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3446 [InlineData("RemoveParam1.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3447 [InlineData("RemoveParam1.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3448 [InlineData("RemoveParam1.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3449 [Theory] RemoveParam1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3450 public void RemoveParam1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3451 { 3452 m_xsltArg = new XsltArgumentList(); 3453 3454 m_xsltArg.AddParam("myArg1", szEmpty, "Test2"); 3455 m_xsltArg.RemoveParam("myArg1", szEmpty); 3456 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 3457 if (retObj != null) 3458 { 3459 _output.WriteLine("Value of Removed Object is not null : {0}", retObj); 3460 Assert.True(false); 3461 } 3462 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 3463 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 3464 3465 _output.WriteLine("Added Value:{0}\nRetrieved Value: {1}", "Test1", retObj); 3466 if (retObj.ToString() != "Test1") 3467 { 3468 _output.WriteLine("Value of removed object is not as expected : {0}", retObj); 3469 Assert.True(false); 3470 } 3471 3472 _baseline = Path.Combine("baseline", (string)param); 3473 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3474 { 3475 VerifyResult(_baseline, "out.xml"); 3476 return; 3477 } 3478 else 3479 Assert.True(false); 3480 } 3481 3482 //[Variation(id = 2, Desc = "Param name is null", Pri = 1, Param = "RemoveParam2.txt")] 3483 [InlineData()] 3484 [Theory] RemoveParam2()3485 public void RemoveParam2() 3486 { 3487 m_xsltArg = new XsltArgumentList(); 3488 retObj = m_xsltArg.RemoveParam(null, szEmpty); 3489 if (retObj != null) 3490 { 3491 _output.WriteLine("Did not return NULL for null parameter name"); 3492 Assert.True(false); 3493 } 3494 return; 3495 } 3496 3497 //[Variation("Param name is empty string", Param = "showParam.txt")] 3498 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3499 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3500 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3501 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3502 [Theory] RemoveParam3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3503 public void RemoveParam3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3504 { 3505 string Baseline = Path.Combine("baseline", (string)param); 3506 m_xsltArg = new XsltArgumentList(); 3507 m_xsltArg.RemoveParam(szEmpty, szEmpty); 3508 3509 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3510 { 3511 VerifyResult(Baseline, _strOutFile); 3512 return; 3513 } 3514 else 3515 Assert.True(false); 3516 } 3517 3518 //[Variation("Param name is non-existent", Param = "showParam.txt")] 3519 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3520 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3521 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3522 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3523 [Theory] RemoveParam4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3524 public void RemoveParam4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3525 { 3526 string Baseline = Path.Combine("baseline", (string)param); 3527 m_xsltArg = new XsltArgumentList(); 3528 m_xsltArg.RemoveParam(szSimple, szEmpty); 3529 3530 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3531 { 3532 VerifyResult(Baseline, _strOutFile); 3533 return; 3534 } 3535 else 3536 Assert.True(false); 3537 } 3538 3539 //[Variation("Invalid Param name", Param = "showParam.txt")] 3540 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3541 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3542 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3543 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3544 [Theory] RemoveParam5(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3545 public void RemoveParam5(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3546 { 3547 string Baseline = Path.Combine("baseline", (string)param); 3548 m_xsltArg = new XsltArgumentList(); 3549 m_xsltArg.RemoveParam(szInvalid, szEmpty); 3550 3551 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3552 { 3553 VerifyResult(Baseline, _strOutFile); 3554 return; 3555 } 3556 else 3557 Assert.True(false); 3558 } 3559 3560 //[Variation("Very long param name", Param = "showParamLongName.txt")] 3561 [InlineData("showParamLongName.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3562 [InlineData("showParamLongName.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3563 [InlineData("showParamLongName.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3564 [InlineData("showParamLongName.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3565 [Theory] RemoveParam6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3566 public void RemoveParam6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3567 { 3568 string Baseline = Path.Combine("baseline", (string)param); 3569 m_xsltArg = new XsltArgumentList(); 3570 3571 m_xsltArg.AddParam(szLongString, szEmpty, "Test1"); 3572 m_xsltArg.RemoveParam(szLongString, szEmpty); 3573 3574 if ((LoadXSL("showParamLongName.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3575 { 3576 VerifyResult(Baseline, _strOutFile); 3577 return; 3578 } 3579 else 3580 Assert.True(false); 3581 } 3582 3583 //[Variation("Namespace URI is null")] 3584 [InlineData()] 3585 [Theory] RemoveParam7()3586 public void RemoveParam7() 3587 { 3588 m_xsltArg = new XsltArgumentList(); 3589 3590 retObj = m_xsltArg.RemoveParam("myArg1", null); 3591 if (retObj != null) 3592 { 3593 _output.WriteLine("Did not return NULL for null URI namespace"); 3594 Assert.True(false); 3595 } 3596 return; 3597 } 3598 3599 //[Variation("Namespace URI is empty string", Param = "showParam.txt")] 3600 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3601 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3602 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3603 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3604 [Theory] RemoveParam8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3605 public void RemoveParam8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3606 { 3607 string Baseline = Path.Combine("baseline", (string)param); 3608 m_xsltArg = new XsltArgumentList(); 3609 3610 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 3611 m_xsltArg.RemoveParam("myArg1", szEmpty); 3612 3613 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3614 { 3615 VerifyResult(Baseline, _strOutFile); 3616 return; 3617 } 3618 else 3619 Assert.True(false); 3620 } 3621 3622 //[Variation("Namespace URI is non-existent", Param = "RemoveParam9.txt")] 3623 [InlineData("RemoveParam9.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3624 [InlineData("RemoveParam9.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3625 [InlineData("RemoveParam9.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3626 [InlineData("RemoveParam9.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3627 [Theory] RemoveParam9(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3628 public void RemoveParam9(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3629 { 3630 string Baseline = Path.Combine("baseline", (string)param); 3631 m_xsltArg = new XsltArgumentList(); 3632 3633 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 3634 m_xsltArg.RemoveParam("myArg1", "http://www.xsltTest.com"); 3635 3636 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3637 { 3638 VerifyResult(Baseline, _strOutFile); 3639 return; 3640 } 3641 else 3642 Assert.True(false); 3643 } 3644 3645 //[Variation("Very long namespace System.Xml.Tests", Param = "showParam.txt")] 3646 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3647 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3648 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3649 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3650 [Theory] RemoveParam10(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3651 public void RemoveParam10(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3652 { 3653 string Baseline = Path.Combine("baseline", (string)param); 3654 m_xsltArg = new XsltArgumentList(); 3655 3656 m_xsltArg.AddParam("myArg1", szLongString, "Test1"); 3657 m_xsltArg.RemoveParam("myArg1", szLongString); 3658 3659 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3660 { 3661 VerifyResult(Baseline, _strOutFile); 3662 return; 3663 } 3664 else 3665 Assert.True(false); 3666 } 3667 3668 //[Variation("Different Data Types", Param = "showParam.txt")] 3669 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3670 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3671 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3672 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3673 [Theory] RemoveParam11(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3674 public void RemoveParam11(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3675 { 3676 string Baseline = Path.Combine("baseline", (string)param); 3677 3678 double d1 = double.PositiveInfinity; 3679 double d2 = double.NegativeInfinity; 3680 double d3 = double.NaN; 3681 double d4 = 2.000001; 3682 double d5 = 0.00; 3683 double d6 = double.MaxValue; 3684 double d7 = double.MinValue; 3685 3686 m_xsltArg = new XsltArgumentList(); 3687 3688 m_xsltArg.AddParam("myArg1", szEmpty, d1); 3689 m_xsltArg.RemoveParam("myArg1", szEmpty); 3690 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 3691 if (retObj != null) 3692 { 3693 _output.WriteLine("Failed to remove {0}", d1); 3694 Assert.True(false); 3695 } 3696 3697 m_xsltArg.AddParam("myArg2", szEmpty, d2); 3698 m_xsltArg.RemoveParam("myArg2", szEmpty); 3699 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3700 if (retObj != null) 3701 { 3702 _output.WriteLine("Failed to remove {0}", d2); 3703 Assert.True(false); 3704 } 3705 3706 m_xsltArg.AddParam("myArg3", szEmpty, d3); 3707 m_xsltArg.RemoveParam("myArg3", szEmpty); 3708 retObj = m_xsltArg.GetParam("myArg3", szEmpty); 3709 if (retObj != null) 3710 { 3711 _output.WriteLine("Failed to remove {0}", d3); 3712 Assert.True(false); 3713 } 3714 3715 m_xsltArg.AddParam("myArg4", szEmpty, d4); 3716 m_xsltArg.RemoveParam("myArg4", szEmpty); 3717 retObj = m_xsltArg.GetParam("myArg4", szEmpty); 3718 if (retObj != null) 3719 { 3720 _output.WriteLine("Failed to remove {0}", d4); 3721 Assert.True(false); 3722 } 3723 3724 m_xsltArg.AddParam("myArg5", szEmpty, d5); 3725 m_xsltArg.RemoveParam("myArg5", szEmpty); 3726 retObj = m_xsltArg.GetParam("myArg5", szEmpty); 3727 if (retObj != null) 3728 { 3729 _output.WriteLine("Failed to remove {0}", d5); 3730 Assert.True(false); 3731 } 3732 3733 m_xsltArg.AddParam("myArg6", szEmpty, d6); 3734 m_xsltArg.RemoveParam("myArg6", szEmpty); 3735 retObj = m_xsltArg.GetParam("myArg6", szEmpty); 3736 if (retObj != null) 3737 { 3738 _output.WriteLine("Failed to remove {0}", d6); 3739 Assert.True(false); 3740 } 3741 3742 m_xsltArg.AddParam("myArg7", szEmpty, d7); 3743 m_xsltArg.RemoveParam("myArg7", szEmpty); 3744 retObj = m_xsltArg.GetParam("myArg7", szEmpty); 3745 if (retObj != null) 3746 { 3747 _output.WriteLine("Failed to remove {0}", d7); 3748 Assert.True(false); 3749 } 3750 3751 String obj = "0.00"; 3752 3753 // string 3754 m_xsltArg.AddParam("myArg1", szEmpty, obj); 3755 m_xsltArg.RemoveParam("myArg1", szEmpty); 3756 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 3757 if (retObj != null) 3758 { 3759 _output.WriteLine("Failed to remove {0}", obj); 3760 Assert.True(false); 3761 } 3762 3763 //int 3764 int i = 2; 3765 3766 m_xsltArg.AddParam("myArg2", szEmpty, i); 3767 m_xsltArg.RemoveParam("myArg2", szEmpty); 3768 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3769 if (retObj != null) 3770 { 3771 _output.WriteLine("Failed to remove {0}", i); 3772 Assert.True(false); 3773 } 3774 3775 Boolean bF = (1 == 0); 3776 m_xsltArg.AddParam("myArg4", szEmpty, bF); 3777 m_xsltArg.RemoveParam("myArg4", szEmpty); 3778 retObj = m_xsltArg.GetParam("myArg4", szEmpty); 3779 if (retObj != null) 3780 { 3781 _output.WriteLine("Failed to remove {0}", bF); 3782 Assert.True(false); 3783 } 3784 3785 Boolean bT = (1 == 1); 3786 m_xsltArg.AddParam("myArg5", szEmpty, bT); 3787 m_xsltArg.RemoveParam("myArg5", szEmpty); 3788 retObj = m_xsltArg.GetParam("myArg5", szEmpty); 3789 if (retObj != null) 3790 { 3791 _output.WriteLine("Failed to remove {0}", bT); 3792 Assert.True(false); 3793 } 3794 3795 m_xsltArg.AddParam("myArg2", szEmpty, (Int16)i); 3796 m_xsltArg.RemoveParam("myArg2", szEmpty); 3797 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3798 if (retObj != null) 3799 { 3800 _output.WriteLine("Failed to remove {0}", i); 3801 Assert.True(false); 3802 } 3803 3804 m_xsltArg.AddParam("myArg2", szEmpty, (UInt16)i); 3805 m_xsltArg.RemoveParam("myArg2", szEmpty); 3806 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3807 if (retObj != null) 3808 { 3809 _output.WriteLine("Failed to remove {0}", i); 3810 Assert.True(false); 3811 } 3812 3813 m_xsltArg.AddParam("myArg2", szEmpty, (Int32)i); 3814 m_xsltArg.RemoveParam("myArg2", szEmpty); 3815 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3816 if (retObj != null) 3817 { 3818 _output.WriteLine("Failed to remove {0}", i); 3819 Assert.True(false); 3820 } 3821 3822 m_xsltArg.AddParam("myArg2", szEmpty, (UInt32)i); 3823 m_xsltArg.RemoveParam("myArg2", szEmpty); 3824 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3825 if (retObj != null) 3826 { 3827 _output.WriteLine("Failed to remove {0}", i); 3828 Assert.True(false); 3829 } 3830 3831 m_xsltArg.AddParam("myArg2", szEmpty, (Int64)i); 3832 m_xsltArg.RemoveParam("myArg2", szEmpty); 3833 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3834 if (retObj != null) 3835 { 3836 _output.WriteLine("Failed to remove {0}", i); 3837 Assert.True(false); 3838 } 3839 3840 m_xsltArg.AddParam("myArg2", szEmpty, (UInt64)i); 3841 m_xsltArg.RemoveParam("myArg2", szEmpty); 3842 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3843 if (retObj != null) 3844 { 3845 _output.WriteLine("Failed to remove {0}", i); 3846 Assert.True(false); 3847 } 3848 3849 m_xsltArg.AddParam("myArg2", szEmpty, (Single)i); 3850 m_xsltArg.RemoveParam("myArg2", szEmpty); 3851 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3852 if (retObj != null) 3853 { 3854 _output.WriteLine("Failed to remove {0}", i); 3855 Assert.True(false); 3856 } 3857 3858 m_xsltArg.AddParam("myArg2", szEmpty, (Decimal)i); 3859 m_xsltArg.RemoveParam("myArg2", szEmpty); 3860 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 3861 if (retObj != null) 3862 { 3863 _output.WriteLine("Failed to remove {0}", i); 3864 Assert.True(false); 3865 } 3866 3867 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3868 { 3869 VerifyResult(Baseline, _strOutFile); 3870 return; 3871 } 3872 else 3873 Assert.True(false); 3874 } 3875 3876 //[Variation("Case Sensitivity", Param = "RemoveParam12.txt")] 3877 [InlineData("RemoveParam12.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3878 [InlineData("RemoveParam12.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3879 [InlineData("RemoveParam12.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3880 [InlineData("RemoveParam12.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3881 [Theory] RemoveParam12(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3882 public void RemoveParam12(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3883 { 3884 string Baseline = Path.Combine("baseline", (string)param); 3885 m_xsltArg = new XsltArgumentList(); 3886 3887 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 3888 m_xsltArg.RemoveParam("myarg1", szEmpty); 3889 m_xsltArg.RemoveParam("MYARG1", szEmpty); 3890 m_xsltArg.RemoveParam("myArg1 ", szEmpty); 3891 3892 // perform a transform for kicks and ensure all is ok. 3893 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3894 { 3895 VerifyResult(Baseline, _strOutFile); 3896 return; 3897 } 3898 else 3899 Assert.True(false); 3900 } 3901 3902 //[Variation("Whitespace", Param = "RemoveParam13.txt")] 3903 [InlineData("RemoveParam13.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3904 [InlineData("RemoveParam13.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3905 [InlineData("RemoveParam13.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3906 [InlineData("RemoveParam13.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3907 [Theory] RemoveParam13(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3908 public void RemoveParam13(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3909 { 3910 string Baseline = Path.Combine("baseline", (string)param); 3911 int i = 1; 3912 m_xsltArg = new XsltArgumentList(); 3913 3914 foreach (String str in szWhiteSpace) 3915 { 3916 m_xsltArg.AddParam("myArg" + i, szEmpty, "Test" + str); 3917 m_xsltArg.RemoveParam("myArg" + i, szEmpty); 3918 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 3919 if (retObj != null) 3920 { 3921 _output.WriteLine("Error removing case #{0} from this test", i); 3922 Assert.True(false); 3923 } 3924 i++; 3925 } 3926 3927 i = 1; 3928 foreach (String str in szWhiteSpace) 3929 { 3930 m_xsltArg.AddParam("myArg" + i, szEmpty, "Test"); // dont add whitespace to name here since addparam would throw 3931 m_xsltArg.RemoveParam("myArg" + str, szEmpty); 3932 retObj = m_xsltArg.GetParam("myArg" + str, szEmpty); 3933 if (retObj != null) 3934 { 3935 _output.WriteLine("Error removing case #{0} in the second batch from this test", i); 3936 Assert.True(false); 3937 } 3938 i++; 3939 } 3940 3941 // perform a transform for kicks and ensure all is ok. 3942 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3943 { 3944 VerifyResult(Baseline, _strOutFile); 3945 return; 3946 } 3947 else 3948 Assert.True(false); 3949 } 3950 3951 //[Variation("Call Multiple Times", Param = "showParam.txt")] 3952 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3953 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 3954 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Writer, NavType.XPathDocument)] 3955 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 3956 [Theory] RemoveParam14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)3957 public void RemoveParam14(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 3958 { 3959 string Baseline = Path.Combine("baseline", (string)param); 3960 m_xsltArg = new XsltArgumentList(); 3961 3962 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 3963 m_xsltArg.RemoveParam("myArg1", szEmpty); 3964 for (int i = 0; i < 500; i++) 3965 m_xsltArg.RemoveParam("myArg1", szEmpty); 3966 3967 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 3968 { 3969 VerifyResult(Baseline, _strOutFile); 3970 return; 3971 } 3972 else 3973 Assert.True(false); 3974 } 3975 3976 //[Variation("Using Default XSLT Namespace")] 3977 [InlineData()] 3978 [Theory] RemoveParam15()3979 public void RemoveParam15() 3980 { 3981 m_xsltArg = new XsltArgumentList(); 3982 m_xsltArg.RemoveParam("myParam", szDefaultNS); 3983 3984 return; 3985 } 3986 } 3987 3988 /***********************************************************/ 3989 /* XslCompiledTransform.RemoveExtensionObject */ 3990 /***********************************************************/ 3991 3992 //[TestCase(Name = "XsltArgumentList - RemoveExtensionObject : Reader, Stream", Desc = "READER,STREAM")] 3993 //[TestCase(Name = "XsltArgumentList - RemoveExtensionObject : Reader, TextWriter", Desc = "READER,TEXTWRITER")] 3994 //[TestCase(Name = "XsltArgumentList - RemoveExtensionObject : URI, Reader", Desc = "URI,READER")] 3995 //[TestCase(Name = "XsltArgumentList - RemoveExtensionObject : Navigator, Stream", Desc = "NAVIGATOR,STREAM")] 3996 public class CArgRemoveExtObj : XsltApiTestCaseBase2 3997 { 3998 private ITestOutputHelper _output; CArgRemoveExtObj(ITestOutputHelper output)3999 public CArgRemoveExtObj(ITestOutputHelper output) : base(output) 4000 { 4001 _output = output; 4002 } 4003 4004 //[Variation(Desc = "Basic Verification Test", Pri = 1)] 4005 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4006 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4007 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4008 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4009 [Theory] RemoveExtObj1(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4010 public void RemoveExtObj1(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4011 { 4012 MyObject obj = new MyObject(1, _output); 4013 m_xsltArg = new XsltArgumentList(); 4014 4015 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 4016 m_xsltArg.RemoveExtensionObject(szDefaultNS); 4017 4018 try 4019 { 4020 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 4021 Transform_ArgList("fruits.xml", outputType, navType, true); 4022 } 4023 catch (System.Xml.Xsl.XsltException) 4024 { 4025 return; 4026 } 4027 _output.WriteLine("Did not throw expected exception"); 4028 Assert.True(false); 4029 } 4030 4031 //[Variation("Namespace URI is null")] 4032 [InlineData()] 4033 [Theory] RemoveExtObj2()4034 public void RemoveExtObj2() 4035 { 4036 MyObject obj = new MyObject(2, _output); 4037 m_xsltArg = new XsltArgumentList(); 4038 4039 try 4040 { 4041 m_xsltArg.RemoveExtensionObject(null); 4042 } 4043 catch (System.ArgumentNullException) 4044 { 4045 return; 4046 } 4047 _output.WriteLine("Exception not generated for null parameter name"); 4048 Assert.True(false); 4049 } 4050 4051 //[Variation("Call Multiple Times", Param = "showParam.txt")] 4052 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4053 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4054 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4055 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4056 [Theory] RemoveExtObj3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4057 public void RemoveExtObj3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4058 { 4059 string Baseline = Path.Combine("baseline", (string)param); 4060 MyObject obj = new MyObject(10, _output); 4061 m_xsltArg = new XsltArgumentList(); 4062 4063 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 4064 for (int i = 0; i < 500; i++) 4065 m_xsltArg.RemoveExtensionObject(szDefaultNS); 4066 4067 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4068 { 4069 VerifyResult(Baseline, _strOutFile); 4070 return; 4071 } 4072 else 4073 Assert.True(false); 4074 } 4075 4076 //[Variation("Namespace URI is non-existent", Param = "MyObjectDef.txt")] 4077 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4078 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4079 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4080 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4081 [Theory] RemoveExtObj4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4082 public void RemoveExtObj4(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4083 { 4084 string Baseline = Path.Combine("baseline", (string)param); 4085 MyObject obj = new MyObject(4, _output); 4086 m_xsltArg = new XsltArgumentList(); 4087 4088 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 4089 m_xsltArg.RemoveExtensionObject(szSimple); 4090 4091 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4092 { 4093 VerifyResult(Baseline, _strOutFile); 4094 return; 4095 } 4096 else 4097 Assert.True(false); 4098 } 4099 4100 //[Variation("Very long namespace System.Xml.Tests")] 4101 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4102 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4103 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4104 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4105 [Theory] RemoveExtObj5(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4106 public void RemoveExtObj5(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4107 { 4108 m_xsltArg = new XsltArgumentList(); 4109 MyObject obj = new MyObject(5, _output); 4110 4111 m_xsltArg.AddExtensionObject("urn:" + szLongNS, obj); 4112 m_xsltArg.RemoveExtensionObject("urn:" + szLongNS); 4113 4114 try 4115 { 4116 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 4117 Transform_ArgList("fruits.xml", outputType, navType, true); 4118 } 4119 catch (System.Xml.Xsl.XsltException) 4120 { 4121 return; 4122 } 4123 _output.WriteLine("Did not throw expected exception"); 4124 Assert.True(false); 4125 } 4126 4127 //[Variation("Different Data Types", Param = "showParam.txt")] 4128 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4129 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4130 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4131 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4132 [Theory] RemoveExtObj6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4133 public void RemoveExtObj6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4134 { 4135 string Baseline = Path.Combine("baseline", (string)param); 4136 MyObject obj = new MyObject(6, _output); 4137 m_xsltArg = new XsltArgumentList(); 4138 4139 m_xsltArg.AddExtensionObject("urn:my-object", obj); 4140 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4141 4142 m_xsltArg.AddExtensionObject("urn:my-object", 2); 4143 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4144 4145 m_xsltArg.AddExtensionObject("urn:my-object", "Test String"); 4146 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4147 4148 m_xsltArg.AddExtensionObject("urn:my-object", (double)5.1); 4149 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4150 4151 m_xsltArg.AddExtensionObject("urn:my-object", true); 4152 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4153 4154 m_xsltArg.AddExtensionObject("urn:my-object", false); 4155 m_xsltArg.RemoveExtensionObject("urn:my-object"); 4156 4157 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4158 { 4159 VerifyResult(Baseline, _strOutFile); 4160 return; 4161 } 4162 else 4163 Assert.True(false); 4164 } 4165 4166 //[Variation("Case Sensitivity", Param = "MyObjectDef.txt")] 4167 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4168 [InlineData("myObjectDef.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4169 [InlineData("myObjectDef.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4170 [InlineData("myObjectDef.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4171 [Theory] RemoveExtObj7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4172 public void RemoveExtObj7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4173 { 4174 MyObject obj = new MyObject(7, _output); 4175 m_xsltArg = new XsltArgumentList(); 4176 string Baseline = Path.Combine("baseline", (string)param); 4177 4178 m_xsltArg.AddExtensionObject("urn:my-object", obj); 4179 4180 m_xsltArg.RemoveExtensionObject("URN:MY-OBJECT"); 4181 m_xsltArg.RemoveExtensionObject("urn:My-Object"); 4182 m_xsltArg.RemoveExtensionObject("urn-my:object"); 4183 m_xsltArg.RemoveExtensionObject("urn:my-object "); 4184 4185 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4186 { 4187 VerifyResult(Baseline, _strOutFile); 4188 return; 4189 } 4190 else 4191 Assert.True(false); 4192 } 4193 4194 //[Variation("Whitespace")] 4195 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4196 [InlineData(XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4197 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4198 [InlineData(XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4199 [Theory] RemoveExtObj8(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4200 public void RemoveExtObj8(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4201 { 4202 int i = 1; 4203 m_xsltArg = new XsltArgumentList(); 4204 4205 foreach (String str in szWhiteSpace) 4206 { 4207 MyObject obj = new MyObject(i, _output); 4208 4209 m_xsltArg.AddExtensionObject(szDefaultNS + str, obj); 4210 m_xsltArg.RemoveExtensionObject(szDefaultNS + str); 4211 retObj = m_xsltArg.GetExtensionObject(szDefaultNS + str); 4212 if (retObj != null) 4213 { 4214 _output.WriteLine("Error deleting case #{0} for whitespace arg", i); 4215 Assert.True(false); 4216 } 4217 i++; 4218 } 4219 4220 try 4221 { 4222 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 4223 Transform_ArgList("fruits.xml", outputType, navType, true); 4224 } 4225 catch (System.Xml.Xsl.XsltException) 4226 { 4227 return; 4228 } 4229 _output.WriteLine("Did not exception for object that could not be executed"); 4230 Assert.True(false); 4231 } 4232 4233 //[Variation("Using default XSLT namespace", Param = "showParam.txt")] 4234 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4235 [InlineData("showParam.txt", XslInputType.Reader, ReaderType.XmlValidatingReader, OutputType.TextWriter, NavType.XPathDocument)] 4236 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4237 [InlineData("showParam.txt", XslInputType.Navigator, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4238 [Theory] RemoveExtObj9(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4239 public void RemoveExtObj9(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4240 { 4241 string Baseline = Path.Combine("baseline", (string)param); 4242 MyObject obj = new MyObject(10, _output); 4243 m_xsltArg = new XsltArgumentList(); 4244 4245 m_xsltArg.RemoveExtensionObject(szDefaultNS); 4246 4247 // ensure we can still do a transform 4248 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4249 { 4250 VerifyResult(Baseline, _strOutFile); 4251 return; 4252 } 4253 else 4254 Assert.True(false); 4255 } 4256 } 4257 4258 /***********************************************************/ 4259 /* XslCompiledTransform.Clear */ 4260 /***********************************************************/ 4261 4262 //[TestCase(Name = "XsltArgumentList - Clear", Desc = "XsltArgumentList.Clear")] 4263 public class CArgClear : XsltApiTestCaseBase2 4264 { 4265 private ITestOutputHelper _output; CArgClear(ITestOutputHelper output)4266 public CArgClear(ITestOutputHelper output) : base(output) 4267 { 4268 _output = output; 4269 } 4270 4271 //[Variation(Desc = "Basic Verification Test", Pri = 1, Param = "showParam.txt")] 4272 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4273 [Theory] Clear1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4274 public void Clear1(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4275 { 4276 string Baseline = Path.Combine("baseline", (string)param); 4277 m_xsltArg = new XsltArgumentList(); 4278 4279 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 4280 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4281 if (retObj.ToString() != "Test1") 4282 return; //TEST_SKIPPED; 4283 4284 m_xsltArg.Clear(); 4285 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4286 if (retObj != null) 4287 Assert.True(false); 4288 4289 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4290 { 4291 VerifyResult(Baseline, _strOutFile); 4292 return; 4293 } 4294 else 4295 Assert.True(false); 4296 } 4297 4298 //[Variation("Clear with nothing loaded", Param = "showParam.txt")] 4299 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4300 [Theory] Clear2(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4301 public void Clear2(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4302 { 4303 string Baseline = Path.Combine("baseline", (string)param); 4304 m_xsltArg = new XsltArgumentList(); 4305 4306 m_xsltArg.Clear(); 4307 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4308 { 4309 VerifyResult(Baseline, _strOutFile); 4310 return; 4311 } 4312 else 4313 Assert.True(false); 4314 } 4315 4316 //[Variation("Clear Params", Param = "showParam.txt")] 4317 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4318 [Theory] Clear3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4319 public void Clear3(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4320 { 4321 string Baseline = Path.Combine("baseline", (string)param); 4322 m_xsltArg = new XsltArgumentList(); 4323 4324 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 4325 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4326 if (retObj.ToString() != "Test1") 4327 return; //TEST_SKIPPED; 4328 4329 m_xsltArg.Clear(); 4330 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4331 if (retObj != null) 4332 Assert.True(false); 4333 4334 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4335 { 4336 VerifyResult(Baseline, _strOutFile); 4337 return; 4338 } 4339 else 4340 Assert.True(false); 4341 } 4342 4343 //[Variation("Clear Extension Objects")] 4344 [InlineData(XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4345 [Theory] Clear4(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4346 public void Clear4(XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4347 { 4348 MyObject obj = new MyObject(26, _output); 4349 m_xsltArg = new XsltArgumentList(); 4350 4351 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 4352 m_xsltArg.Clear(); 4353 retObj = m_xsltArg.GetExtensionObject(szDefaultNS); 4354 if (retObj != null) 4355 { 4356 _output.WriteLine("Did not appear to clear an extension object"); 4357 Assert.True(false); 4358 } 4359 4360 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 4361 { 4362 try 4363 { 4364 Transform_ArgList("fruits.xml", outputType, navType); 4365 } 4366 catch (System.Xml.Xsl.XsltException) 4367 { 4368 return; 4369 } 4370 } 4371 _output.WriteLine("Exception not thrown for NS not found"); 4372 Assert.True(false); 4373 } 4374 4375 //[Variation("Clear Many Objects", Param = "showParam.txt")] 4376 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4377 [Theory] Clear5(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4378 public void Clear5(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4379 { 4380 string Baseline = Path.Combine("baseline", (string)param); 4381 m_xsltArg = new XsltArgumentList(); 4382 String obj = "Test"; 4383 4384 for (int i = 0; i < 200; i++) 4385 { 4386 m_xsltArg.AddParam("myArg2", szEmpty, obj + i); 4387 retObj = m_xsltArg.GetParam("myArg2", szEmpty); 4388 if (retObj.ToString() != (obj + i)) 4389 { 4390 _output.WriteLine("Failed to add/remove iteration {0}", i); 4391 _output.WriteLine("{0} : {1}", retObj, obj + i); 4392 4393 Assert.True(false); 4394 } 4395 m_xsltArg.Clear(); 4396 } 4397 4398 for (int i = 0; i < 200; i++) 4399 { 4400 m_xsltArg.AddParam("myArg" + i, szEmpty, obj + i); 4401 retObj = m_xsltArg.GetParam("myArg" + i, szEmpty); 4402 if (retObj.ToString() != (obj + i)) 4403 { 4404 _output.WriteLine("Failed in 2nd part to add/remove iteration {0}", i); 4405 Assert.True(false); 4406 } 4407 } 4408 4409 m_xsltArg.Clear(); 4410 4411 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4412 { 4413 VerifyResult(Baseline, _strOutFile); 4414 return; 4415 } 4416 else 4417 Assert.True(false); 4418 } 4419 4420 //[Variation("Clear Multiple Times", Param = "showParam.txt")] 4421 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4422 [Theory] Clear6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4423 public void Clear6(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4424 { 4425 string Baseline = Path.Combine("baseline", (string)param); 4426 m_xsltArg = new XsltArgumentList(); 4427 4428 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 4429 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4430 if (retObj.ToString() != "Test1") 4431 return; //TEST_SKIPPED; 4432 4433 for (int i = 0; i < 300; i++) 4434 m_xsltArg.Clear(); 4435 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4436 if (retObj != null) 4437 Assert.True(false); 4438 4439 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4440 { 4441 VerifyResult(Baseline, _strOutFile); 4442 return; 4443 } 4444 else 4445 Assert.True(false); 4446 } 4447 4448 //[Variation("Loading one object, but clearing another", Param = "ClearParam7.txt")] 4449 [InlineData("ClearParam7.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4450 [Theory] Clear7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4451 public void Clear7(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4452 { 4453 string Baseline = Path.Combine("baseline", (string)param); 4454 m_xsltArg = new XsltArgumentList(); 4455 XsltArgumentList m_2 = new XsltArgumentList(); 4456 4457 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 4458 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4459 if (retObj.ToString() != "Test1") 4460 return; //TEST_SKIPPED; 4461 4462 m_2.Clear(); 4463 4464 if ((LoadXSL("showParam.xsl", xslInputType, readerType) == 1) && (Transform_ArgList("fruits.xml", outputType, navType) == 1)) 4465 { 4466 VerifyResult(Baseline, _strOutFile); 4467 return; 4468 } 4469 else 4470 Assert.True(false); 4471 } 4472 4473 //[Variation("Clear after objects have been \"Removed\"", Param = "showParam.txt")] 4474 [InlineData("showParam.txt", XslInputType.URI, ReaderType.XmlValidatingReader, OutputType.Stream, NavType.XPathDocument)] 4475 [Theory] Clear8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType)4476 public void Clear8(object param, XslInputType xslInputType, ReaderType readerType, OutputType outputType, NavType navType) 4477 { 4478 string Baseline = Path.Combine("baseline", (string)param); 4479 m_xsltArg = new XsltArgumentList(); 4480 4481 m_xsltArg.AddParam("myArg1", szEmpty, "Test1"); 4482 retObj = m_xsltArg.GetParam("myArg1", szEmpty); 4483 if (retObj.ToString() != "Test1") 4484 return; //TEST_SKIPPED; 4485 retObj = m_xsltArg.RemoveParam("myArg1", szEmpty); 4486 m_xsltArg.Clear(); 4487 4488 if ((LoadXSL("showParam.xsl", xslInputType, readerType) != 1) || (Transform_ArgList("fruits.xml", outputType, navType) != 1)) 4489 Assert.True(false); 4490 4491 VerifyResult(Baseline, _strOutFile); 4492 4493 MyObject obj = new MyObject(26, _output); 4494 4495 m_xsltArg.AddExtensionObject(szDefaultNS, obj); 4496 m_xsltArg.RemoveExtensionObject(szDefaultNS); 4497 m_xsltArg.Clear(); 4498 4499 if ((LoadXSL("myObjectDef.xsl", xslInputType, readerType) == 1)) 4500 { 4501 try 4502 { 4503 Transform_ArgList("fruits.xml", outputType, navType); 4504 } 4505 catch (System.Xml.Xsl.XsltException) 4506 { 4507 return; 4508 } 4509 } 4510 _output.WriteLine("Exception not thrown for NS not found"); 4511 Assert.True(false); 4512 } 4513 } 4514 4515 //[TestCase(Name = "XsltArgumentList - Events", Desc = "Events raised by xsl:message")] 4516 public class XsltEvents : XsltApiTestCaseBase2 4517 { 4518 public bool EventRaised; 4519 public string OutFile = string.Empty; 4520 4521 private ITestOutputHelper _output; XsltEvents(ITestOutputHelper output)4522 public XsltEvents(ITestOutputHelper output) : base(output) 4523 { 4524 _output = output; 4525 } 4526 SerializeMessage(string outFile, string message)4527 public void SerializeMessage(string outFile, string message) 4528 { 4529 StreamWriter sw = new StreamWriter(new FileStream(outFile, FileMode.Create, FileAccess.Write)); 4530 sw.Write(message); 4531 sw.Dispose(); 4532 } 4533 argList_XsltMessageEncountered(object sender, XsltMessageEncounteredEventArgs e)4534 private void argList_XsltMessageEncountered(object sender, XsltMessageEncounteredEventArgs e) 4535 { 4536 EventRaised = true; 4537 _output.WriteLine("---- OnMessageEvent Raised ----"); 4538 _output.WriteLine(e.Message); 4539 SerializeMessage(OutFile, e.Message); 4540 } 4541 4542 //[Variation(id = 1, Desc = "OnQueryEvent Exists - xsl:message with terminate='no'", Priority = 0, Params = new object[] { "Message1.xsl", "no", "yes", "Message1.txt" })] 4543 [InlineData("Message1.xsl", "no", "yes", "Message1.txt")] 4544 //[Variation(id = 2, Desc = "OnQueryEvent doesn't exist - xsl:message with terminate='no'", Priority = 2, Params = new object[] { "Message2.xsl", "no", "no", "Message2.txt" })] 4545 [InlineData("Message2.xsl", "no", "no", "Message2.txt")] 4546 //[Variation(id = 3, Desc = "OnQueryEvent Exists - xsl:message with terminate='yes'", Priority = 0, Params = new object[] { "Message3.xsl", "yes", "yes", "Message3.txt" })] 4547 [InlineData("Message3.xsl", "yes", "yes", "Message3.txt")] 4548 //[Variation(id = 4, Desc = "OnQueryEvent doesn't exist - xsl:message with terminate='yes'", Priority = 2, Params = new object[] { "Message4.xsl", "yes", "no", "Message4.txt" })] 4549 [InlineData("Message4.xsl", "yes", "no", "Message4.txt")] 4550 //[Variation(id = 5, Desc = "OnQueryEvent Exists - xsl:message with XML Content and terminate='no'", Priority = 1, Params = new object[] { "Message5.xsl", "no", "yes", "Message5.txt" })] 4551 [InlineData("Message5.xsl", "no", "yes", "Message5.txt")] 4552 //[Variation(id = 6, Desc = "OnQueryEvent doesn't exist - xsl:message with XML Content and terminate='no'", Priority = 2, Params = new object[] { "Message6.xsl", "no", "no", "Message6.txt" })] 4553 [InlineData("Message6.xsl", "no", "no", "Message6.txt")] 4554 //[Variation(id = 7, Desc = "OnQueryEvent Exists - xsl:message with XML Content and terminate='yes'", Priority = 1, Params = new object[] { "Message7.xsl", "yes", "yes", "Message7.txt" })] 4555 [InlineData("Message7.xsl", "yes", "yes", "Message7.txt")] 4556 //[Variation(id = 8, Desc = "OnQueryEvent doesn't exist - xsl:message with XML Content and terminate='yes'", Priority = 2, Params = new object[] { "Message8.xsl", "yes", "no", "Message8.txt" })] 4557 [InlineData("Message8.xsl", "yes", "no", "Message8.txt")] 4558 //[Variation(id = 9, Desc = "OnQueryEvent Exists - xsl:message with template content and terminate='no'", Priority = 1, Params = new object[] { "Message9.xsl", "no", "yes", "Message9.txt" })] 4559 [InlineData("Message9.xsl", "no", "yes", "Message9.txt")] 4560 //[Variation(id = 10, Desc = "OnQueryEvent Exists - xsl:message with template content and terminate='yes'", Priority = 1, Params = new object[] { "Message10.xsl", "yes", "yes", "Message10.txt" })] 4561 [InlineData("Message10.xsl", "yes", "yes", "Message10.txt")] 4562 [Theory] EventsTests(object param0, object param1, object param2, object param3)4563 public void EventsTests(object param0, object param1, object param2, object param3) 4564 { 4565 XslCompiledTransform xslt = new XslCompiledTransform(); 4566 XsltArgumentList argList = new XsltArgumentList(); 4567 4568 //Collect the test data 4569 string SourceFile = FullFilePath("message.xml"); 4570 string XslFile = FullFilePath(param0.ToString()); 4571 string XslMessageTerminate = param1.ToString(); 4572 string EventHandlerExists = param2.ToString(); 4573 string Baseline = "baseline" + Path.DirectorySeparatorChar + param3.ToString(); 4574 OutFile = "Message.txt"; 4575 4576 //Check if the EventHandler Exists 4577 if (EventHandlerExists == "yes") 4578 argList.XsltMessageEncountered += new XsltMessageEncounteredEventHandler(argList_XsltMessageEncountered); 4579 4580 EventRaised = false; 4581 4582 //Delete the output file if it exists 4583 if (File.Exists(OutFile)) 4584 File.Delete(OutFile); 4585 4586 //Create a navigator over the source document 4587 XPathDocument doc = new XPathDocument(SourceFile); 4588 XPathNavigator nav = doc.CreateNavigator(); 4589 4590 //Create a temporary output stream 4591 StreamWriter sw = new StreamWriter(new MemoryStream()); 4592 XmlWriter xw = new XmlTextWriter(sw); 4593 4594 //Compile the Stylesheet 4595 _output.WriteLine(XslFile); 4596 xslt.Load(XslFile); 4597 4598 if (XslMessageTerminate == "yes") 4599 { 4600 try 4601 { 4602 xslt.Transform(nav, argList, xw); 4603 _output.WriteLine("**** XsltException NOT Raised ****"); 4604 Assert.True(false); 4605 } 4606 catch (XsltException e) 4607 { 4608 _output.WriteLine("---- {0} Raised ----", e.ToString()); 4609 if (EventHandlerExists == "no") 4610 SerializeMessage(OutFile, e.Message); 4611 } 4612 } 4613 else 4614 { 4615 xslt.Transform(nav, argList, xw); 4616 } 4617 4618 //Verify if the Event is raised and the result is verified 4619 if (EventRaised) 4620 { 4621 VerifyResult(Baseline, OutFile); 4622 return; 4623 } 4624 else 4625 { 4626 if (EventHandlerExists == "yes") 4627 { 4628 _output.WriteLine("**** OnMessageEvent NOT Raised ****"); 4629 Assert.True(false); 4630 } 4631 else 4632 { 4633 return; 4634 } 4635 } 4636 } 4637 } 4638 4639 //[TestCase(Name = "XPathNodeIterator Tests", Desc = "XPathNodeIterator Tests using XsltArgumentList")] 4640 public class XPathNodeIteratorTests : XsltApiTestCaseBase2 4641 { 4642 private ITestOutputHelper _output; XPathNodeIteratorTests(ITestOutputHelper output)4643 public XPathNodeIteratorTests(ITestOutputHelper output) : base(output) 4644 { 4645 _output = output; 4646 } 4647 4648 [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework does support Compiling JScript/CSharp scripts")] 4649 //[Variation(id = 1, Desc = "Call Current without MoveNext")] 4650 [InlineData()] 4651 [Theory] NodeIter1()4652 public void NodeIter1() 4653 { 4654 var e = Assert.ThrowsAny<XsltException>(() => 4655 { 4656 XslCompiledTransform xslt = new XslCompiledTransform(); 4657 4658 XsltArgumentList xslArg = new XsltArgumentList(); 4659 XmlUrlResolver ur = new XmlUrlResolver(); 4660 Uri uriSource = ur.ResolveUri(null, FullFilePath("sample.xsd")); 4661 xslArg.AddParam("sourceUri", String.Empty, uriSource.ToString()); 4662 4663 xslt.Load(FullFilePath("xsd2cs1.xsl"), new XsltSettings(true, true), new XmlUrlResolver()); 4664 }); 4665 4666 Assert.Equal("Compiling JScript/CSharp scripts is not supported", e.InnerException.Message); 4667 } 4668 4669 [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Only full framework supports Compiling JScript/CSharp scripts")] 4670 //[Variation(id = 1, Desc = "Call Current without MoveNext")] 4671 [Fact] NodeIter1_FullFramework()4672 public void NodeIter1_FullFramework() 4673 { 4674 XslCompiledTransform xslt = new XslCompiledTransform(); 4675 4676 XsltArgumentList xslArg = new XsltArgumentList(); 4677 XmlUrlResolver ur = new XmlUrlResolver(); 4678 Uri uriSource = ur.ResolveUri(null, FullFilePath("sample.xsd")); 4679 xslArg.AddParam("sourceUri", String.Empty, uriSource.ToString()); 4680 4681 xslt.Load(FullFilePath("xsd2cs1.xsl"), new XsltSettings(true, true), new XmlUrlResolver()); 4682 4683 Assert.Throws<System.InvalidOperationException>(() => 4684 { 4685 XPathDocument doc = new XPathDocument(FullFilePath("sample.xsd")); 4686 using (StringWriter sw = new StringWriter()) 4687 { 4688 xslt.Transform(doc, xslArg, sw); 4689 } 4690 }); 4691 } 4692 4693 [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework does support Compiling JScript/CSharp scripts")] 4694 //[Variation(id = 2, Desc = "Call Current after MoveNext")] 4695 [InlineData()] 4696 [Theory] NodeIter2()4697 public void NodeIter2() 4698 { 4699 var e = Assert.ThrowsAny<XsltException>(() => 4700 { 4701 XslCompiledTransform xslt = new XslCompiledTransform(); 4702 4703 XsltArgumentList xslArg = new XsltArgumentList(); 4704 XmlUrlResolver ur = new XmlUrlResolver(); 4705 Uri uriSource = ur.ResolveUri(null, FullFilePath("sample.xsd")); 4706 xslArg.AddParam("sourceUri", String.Empty, uriSource.ToString()); 4707 4708 xslt.Load(FullFilePath("xsd2cs2.xsl"), new XsltSettings(true, true), new XmlUrlResolver()); 4709 }); 4710 4711 Assert.Equal("Compiling JScript/CSharp scripts is not supported", e.InnerException.Message); 4712 } 4713 4714 [SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework, "Only full framework supports Compiling JScript/CSharp scripts")] 4715 //[Variation(id = 2, Desc = "Call Current after MoveNext")] 4716 [Fact] NodeIter2_FullFramework()4717 public void NodeIter2_FullFramework() 4718 { 4719 XslCompiledTransform xslt = new XslCompiledTransform(); 4720 4721 XsltArgumentList xslArg = new XsltArgumentList(); 4722 XmlUrlResolver ur = new XmlUrlResolver(); 4723 Uri uriSource = ur.ResolveUri(null, FullFilePath("sample.xsd")); 4724 xslArg.AddParam("sourceUri", String.Empty, uriSource.ToString()); 4725 4726 xslt.Load(FullFilePath("xsd2cs2.xsl"), new XsltSettings(true, true), new XmlUrlResolver()); 4727 4728 XPathDocument doc = new XPathDocument(FullFilePath("sample.xsd")); 4729 using (StringWriter sw = new StringWriter()) 4730 { 4731 xslt.Transform(doc, xslArg, sw); 4732 } 4733 } 4734 } 4735 } 4736