README.txt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Metadata Tests
  2. ==============
  3. These tests can be run either as part of System.ServiceModel_test_<profile>.dll
  4. or as the stand-alone MetadataTests.dll, which bundles all the XML files as
  5. embedded resources.
  6. Generating and updating the XML Samples:
  7. ========================================
  8. Mono's WsdlExporter is not yet capable of generating the wsdl files that
  9. are used as test input here.
  10. To generate the XML files, compile the ExportUtil.exe tool:
  11. mcs -r:System.ServiceModel -r:System.Web.Services ExportUtil.cs MetadataSamples.cs TestContext.cs
  12. Then copy the binary to a Windows machine and run it there. This will generate a bunch of
  13. .xml files. Run dos2unix on them and copy them into the Resources/ subdirectory.
  14. Adding new Tests:
  15. =================
  16. To add a new test, add a method with the [MetadataaSample] attribute to
  17. MetadataSamples.cs, like this:
  18. [MetadataSample]
  19. public static MetadataSet MyXML ()
  20. {
  21. ....
  22. }
  23. You may also specify a name:
  24. [MetadataSample ("MyXML")]
  25. public static MetadataSet RandomMethodName ()
  26. {
  27. }
  28. Re-compile ExportUtil.exe and it will produce a new 'MyXML.xml' file.
  29. Then write a new test case:
  30. [Test]
  31. public void MyXML ()
  32. {
  33. var doc = TestContext.GetMetadata ("MyXML");
  34. ... test it here
  35. }
  36. The idea behind the 'TestContext' class is to allow "self-hosting" at a
  37. later time, ie. use Mono's WsdlExporter to generate the metadata instead
  38. of loading the on-disk file without having to modify a bunch of tests.