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