README.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 either by using the
  11. ExportUtil.csproj or compiling it manually:
  12. mcs -r:System.ServiceModel -r:System.Web.Services ExportUtil.cs MetadataSamples.cs TestContext.cs
  13. Then copy the binary to a Windows machine and run it there. This will generate a bunch of
  14. .xml files. Run dos2unix on them and copy them into the Resources/ subdirectory.
  15. Adding new Tests:
  16. =================
  17. To add a new test, add a method with the [MetadataaSample] attribute to
  18. MetadataSamples.cs, like this:
  19. [MetadataSample]
  20. public static MetadataSet MyXML ()
  21. {
  22. ....
  23. }
  24. You may also specify a name:
  25. [MetadataSample ("MyXML")]
  26. public static MetadataSet RandomMethodName ()
  27. {
  28. }
  29. Re-compile ExportUtil.exe and it will produce a new 'MyXML.xml' file.
  30. Then write a new test case:
  31. [Test]
  32. public void MyXML ()
  33. {
  34. var doc = TestContext.GetMetadata ("MyXML");
  35. ... test it here
  36. }
  37. The idea behind the 'TestContext' class is to allow "self-hosting" at a
  38. later time, ie. use Mono's WsdlExporter to generate the metadata instead
  39. of loading the on-disk file without having to modify a bunch of tests.