New test.
[mono.git] / mcs / class / System.XML / Test / System.Xml.Serialization / SoapSchemaExporterTests.cs
1 //
2 // System.Xml.Serialization.SoapSchemaExporterTests
3 //
4 // Author:
5 //   Gert Driesen (drieseng@users.sourceforge.net)
6 //
7 // (C) 2005 Novell
8 // 
9
10 using System;
11 using System.Collections;
12 using System.Globalization;
13 using System.IO;
14 using System.Xml;
15 using System.Xml.Schema;
16 using System.Xml.Serialization;
17
18 using NUnit.Framework;
19
20 using MonoTests.System.Xml.TestClasses;
21
22 namespace MonoTests.System.XmlSerialization
23 {
24         [TestFixture]
25         public class SoapSchemaExporterTests
26         {
27                 private XmlSchemas Export (Type type)
28                 {
29                         return Export (type, string.Empty);
30                 }
31
32                 private XmlSchemas Export (Type type, string defaultNamespace)
33                 {
34                         SoapReflectionImporter ri = new SoapReflectionImporter (defaultNamespace);
35                         XmlSchemas schemas = new XmlSchemas ();
36                         SoapSchemaExporter sx = new SoapSchemaExporter (schemas);
37                         XmlTypeMapping tm = ri.ImportTypeMapping (type);
38                         sx.ExportTypeMapping (tm);
39                         return schemas;
40                 }
41
42                 private XmlSchemas Export (Type type, SoapAttributeOverrides overrides)
43                 {
44                         return Export (type, overrides, string.Empty);
45                 }
46
47                 private XmlSchemas Export (Type type, SoapAttributeOverrides overrides, string defaultNamespace)
48                 {
49                         SoapReflectionImporter ri = new SoapReflectionImporter (overrides, defaultNamespace);
50                         XmlSchemas schemas = new XmlSchemas ();
51                         SoapSchemaExporter sx = new SoapSchemaExporter (schemas);
52                         XmlTypeMapping tm = ri.ImportTypeMapping (type);
53                         sx.ExportTypeMapping (tm);
54                         return schemas;
55                 }
56
57                 [Test]
58                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
59                 public void ExportStruct ()
60                 {
61                         XmlSchemas schemas = Export (typeof (TimeSpan), "NSTimeSpan");
62                         Assert.AreEqual (1, schemas.Count, "#1");
63
64                         StringWriter sw = new StringWriter ();
65                         schemas[0].Write (sw);
66
67                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
68                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
69 #if NET_2_0
70                                 "<xs:schema xmlns:tns=\"NSTimeSpan\" elementFormDefault=\"qualified\" targetNamespace=\"NSTimeSpan\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
71 #else
72                                 "<xs:schema xmlns:tns=\"NSTimeSpan\" targetNamespace=\"NSTimeSpan\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
73 #endif
74                                 "  <xs:complexType name=\"TimeSpan\" />{0}" +
75                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
76
77                         schemas = Export (typeof (TimeSpan));
78                         Assert.AreEqual (1, schemas.Count, "#3");
79
80                         sw = new StringWriter ();
81                         schemas[0].Write (sw);
82
83                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
84                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
85 #if NET_2_0
86                                 "<xs:schema elementFormDefault=\"qualified\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
87 #else
88                                 "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
89 #endif
90                                 "  <xs:complexType name=\"TimeSpan\" />{0}" +
91                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#4");
92                 }
93
94                 [Test]
95                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
96 /*
97 #if NET_2_0
98                 [Category ("NotWorking")] // minOccurs is 1 on Mono
99 #endif
100 */
101                 public void ExportClass_SimpleClass ()
102                 {
103                         SoapAttributeOverrides overrides = new SoapAttributeOverrides ();
104                         SoapAttributes attr = new SoapAttributes ();
105                         SoapElementAttribute element = new SoapElementAttribute ();
106                         element.ElementName = "saying";
107                         element.IsNullable = true;
108                         attr.SoapElement = element;
109                         overrides.Add (typeof (SimpleClass), "something", attr);
110
111                         XmlSchemas schemas = Export (typeof (SimpleClass), overrides, "NSSimpleClass");
112                         Assert.AreEqual (1, schemas.Count, "#1");
113
114                         StringWriter sw = new StringWriter ();
115                         schemas[0].Write (sw);
116
117                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
118                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
119 #if NET_2_0
120                                 "<xs:schema xmlns:tns=\"NSSimpleClass\" elementFormDefault=\"qualified\" targetNamespace=\"NSSimpleClass\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
121 #else
122                                 "<xs:schema xmlns:tns=\"NSSimpleClass\" targetNamespace=\"NSSimpleClass\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
123 #endif
124                                 "  <xs:complexType name=\"SimpleClass\">{0}" +
125                                 "    <xs:sequence>{0}" +
126 #if NET_2_0
127                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"saying\" nillable=\"true\" type=\"xs:string\" />{0}" +
128 #else
129                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"saying\" type=\"xs:string\" />{0}" +
130 #endif
131                                 "    </xs:sequence>{0}" +
132                                 "  </xs:complexType>{0}" +
133                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
134                 }
135
136                 [Test]
137                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
138                 public void ExportClass_StringCollection ()
139                 {
140                         XmlSchemas schemas = Export (typeof (StringCollection), "NSStringCollection");
141                         Assert.AreEqual (1, schemas.Count, "#1");
142
143                         StringWriter sw = new StringWriter ();
144                         schemas[0].Write (sw);
145
146                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
147                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
148 #if NET_2_0
149                                 "<xs:schema xmlns:tns=\"NSStringCollection\" elementFormDefault=\"qualified\" targetNamespace=\"NSStringCollection\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
150 #else
151                                 "<xs:schema xmlns:tns=\"NSStringCollection\" targetNamespace=\"NSStringCollection\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
152 #endif
153                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
154                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
155                                 "  <xs:complexType name=\"ArrayOfString\">{0}" +
156                                 "    <xs:complexContent mixed=\"false\">{0}" +
157                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
158                                 "        <xs:attribute d5p1:arrayType=\"xs:string[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
159                                 "      </xs:restriction>{0}" +
160                                 "    </xs:complexContent>{0}" +
161                                 "  </xs:complexType>{0}" +
162                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
163                 }
164
165                 [Test]
166                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
167                 public void ExportClass_StringCollectionContainer ()
168                 {
169                         XmlSchemas schemas = Export (typeof (StringCollectionContainer), "NSStringCollectionContainer");
170                         Assert.AreEqual (1, schemas.Count, "#1");
171
172                         StringWriter sw = new StringWriter ();
173                         schemas[0].Write (sw);
174
175                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
176                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
177 #if NET_2_0
178                                 "<xs:schema xmlns:tns=\"NSStringCollectionContainer\" elementFormDefault=\"qualified\" targetNamespace=\"NSStringCollectionContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
179 #else
180                                 "<xs:schema xmlns:tns=\"NSStringCollectionContainer\" targetNamespace=\"NSStringCollectionContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
181 #endif
182                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
183                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
184                                 "  <xs:complexType name=\"StringCollectionContainer\">{0}" +
185                                 "    <xs:sequence>{0}" +
186 #if NET_2_0
187                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"Messages\" type=\"tns:ArrayOfString\" />{0}" +
188 #else
189                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Messages\" type=\"tns:ArrayOfString\" />{0}" +
190 #endif
191                                 "    </xs:sequence>{0}" +
192                                 "  </xs:complexType>{0}" +
193                                 "  <xs:complexType name=\"ArrayOfString\">{0}" +
194                                 "    <xs:complexContent mixed=\"false\">{0}" +
195                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
196                                 "        <xs:attribute d5p1:arrayType=\"xs:string[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
197                                 "      </xs:restriction>{0}" +
198                                 "    </xs:complexContent>{0}" +
199                                 "  </xs:complexType>{0}" +
200                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
201                 }
202
203                 [Test]
204                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
205                 public void ExportClass_ArrayContainer ()
206                 {
207                         XmlSchemas schemas = Export (typeof (ArrayContainer), "NSArrayContainer");
208                         Assert.AreEqual (1, schemas.Count, "#1");
209
210                         StringWriter sw = new StringWriter ();
211                         schemas[0].Write (sw);
212
213                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
214                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
215 #if NET_2_0
216                                 "<xs:schema xmlns:tns=\"NSArrayContainer\" elementFormDefault=\"qualified\" targetNamespace=\"NSArrayContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
217 #else
218                                 "<xs:schema xmlns:tns=\"NSArrayContainer\" targetNamespace=\"NSArrayContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
219 #endif
220                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
221                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
222                                 "  <xs:complexType name=\"ArrayContainer\">{0}" +
223                                 "    <xs:sequence>{0}" +
224 #if NET_2_0
225                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"items\" type=\"tns:ArrayOfAnyType\" />{0}" +
226 #else
227                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"items\" type=\"tns:ArrayOfAnyType\" />{0}" +
228 #endif
229                                 "    </xs:sequence>{0}" +
230                                 "  </xs:complexType>{0}" +
231                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
232                                 "    <xs:complexContent mixed=\"false\">{0}" +
233                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
234                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
235                                 "      </xs:restriction>{0}" +
236                                 "    </xs:complexContent>{0}" +
237                                 "  </xs:complexType>{0}" +
238                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
239                 }
240
241                 [Test]
242                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
243                 public void ExportClass_ClassArrayContainer ()
244                 {
245                         XmlSchemas schemas = Export (typeof (ClassArrayContainer), "NSClassArrayContainer");
246                         Assert.AreEqual (1, schemas.Count, "#1");
247
248                         StringWriter sw = new StringWriter ();
249                         schemas[0].Write (sw);
250
251                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
252                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
253 #if NET_2_0
254                                 "<xs:schema xmlns:tns=\"NSClassArrayContainer\" elementFormDefault=\"qualified\" targetNamespace=\"NSClassArrayContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
255 #else
256                                 "<xs:schema xmlns:tns=\"NSClassArrayContainer\" targetNamespace=\"NSClassArrayContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
257 #endif
258                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
259                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
260                                 "  <xs:complexType name=\"ClassArrayContainer\">{0}" +
261                                 "    <xs:sequence>{0}" +
262 #if NET_2_0
263                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"items\" type=\"tns:ArrayOfSimpleClass\" />{0}" +
264 #else
265                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"items\" type=\"tns:ArrayOfSimpleClass\" />{0}" +
266 #endif
267  "    </xs:sequence>{0}" +
268                                 "  </xs:complexType>{0}" +
269                                 "  <xs:complexType name=\"ArrayOfSimpleClass\">{0}" +
270                                 "    <xs:complexContent mixed=\"false\">{0}" +
271                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
272                                 "        <xs:attribute d5p1:arrayType=\"tns:SimpleClass[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
273                                 "      </xs:restriction>{0}" +
274                                 "    </xs:complexContent>{0}" +
275                                 "  </xs:complexType>{0}" +
276                                 "  <xs:complexType name=\"SimpleClass\">{0}" +
277                                 "    <xs:sequence>{0}" +
278 #if NET_2_0
279                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"something\" type=\"xs:string\" />{0}" +
280 #else
281                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"something\" type=\"xs:string\" />{0}" +
282 #endif
283                                 "    </xs:sequence>{0}" +
284                                 "  </xs:complexType>{0}" +
285                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
286                 }
287
288                 [Test]
289                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
290                 public void ExportClass_SimpleClassWithXmlAttributes ()
291                 {
292                         XmlSchemas schemas = Export (typeof (SimpleClassWithXmlAttributes), "NSSimpleClassWithXmlAttributes");
293                         Assert.AreEqual (1, schemas.Count, "#1");
294
295                         StringWriter sw = new StringWriter ();
296                         schemas[0].Write (sw);
297
298                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
299                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
300 #if NET_2_0
301                                 "<xs:schema xmlns:tns=\"NSSimpleClassWithXmlAttributes\" elementFormDefault=\"qualified\" targetNamespace=\"NSSimpleClassWithXmlAttributes\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
302 #else
303                                 "<xs:schema xmlns:tns=\"NSSimpleClassWithXmlAttributes\" targetNamespace=\"NSSimpleClassWithXmlAttributes\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
304 #endif
305                                 "  <xs:complexType name=\"SimpleClassWithXmlAttributes\">{0}" +
306                                 "    <xs:sequence>{0}" +
307 #if NET_2_0
308                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"something\" type=\"xs:string\" />{0}" +
309 #else
310                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"something\" type=\"xs:string\" />{0}" +
311 #endif
312                                 "    </xs:sequence>{0}" +
313                                 "  </xs:complexType>{0}" +
314                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
315                 }
316
317                 [Test]
318                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
319                 public void ExportClass_Field ()
320                 {
321                         XmlSchemas schemas = Export (typeof (Field), "NSField");
322                         Assert.AreEqual (1, schemas.Count, "#1");
323
324                         StringWriter sw = new StringWriter ();
325                         schemas[0].Write (sw);
326
327                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
328                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
329 #if NET_2_0
330                                 "<xs:schema xmlns:tns=\"NSField\" elementFormDefault=\"qualified\" targetNamespace=\"NSField\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
331 #else
332                                 "<xs:schema xmlns:tns=\"NSField\" targetNamespace=\"NSField\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
333 #endif
334                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
335                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
336                                 "  <xs:complexType name=\"Field\">{0}" +
337                                 "    <xs:sequence>{0}" +
338 #if NET_2_0
339                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Flags1\" type=\"tns:FlagEnum\" />{0}" +
340                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Flags2\" type=\"tns:FlagEnum\" />{0}" +
341                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Flags3\" type=\"tns:FlagEnum\" />{0}" +
342                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Flags4\" type=\"tns:FlagEnum\" />{0}" +
343                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Modifiers\" type=\"tns:MapModifiers\" />{0}" +
344                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Modifiers2\" type=\"tns:MapModifiers\" />{0}" +
345                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Modifiers3\" type=\"tns:MapModifiers\" />{0}" +
346                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Modifiers4\" type=\"tns:MapModifiers\" />{0}" +
347                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Modifiers5\" type=\"tns:MapModifiers\" />{0}" +
348                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"Names\" type=\"tns:ArrayOfString\" />{0}" +
349                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"Street\" type=\"xs:string\" />{0}" +
350 #else
351                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Flags1\" type=\"tns:FlagEnum\" />{0}" +
352                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Flags2\" type=\"tns:FlagEnum\" />{0}" +
353                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Flags3\" type=\"tns:FlagEnum\" />{0}" +
354                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Flags4\" type=\"tns:FlagEnum\" />{0}" +
355                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Modifiers\" type=\"tns:MapModifiers\" />{0}" +
356                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Modifiers2\" type=\"tns:MapModifiers\" />{0}" +
357                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Modifiers3\" type=\"tns:MapModifiers\" />{0}" +
358                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Modifiers4\" type=\"tns:MapModifiers\" />{0}" +
359                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Modifiers5\" type=\"tns:MapModifiers\" />{0}" +
360                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Names\" type=\"tns:ArrayOfString\" />{0}" +
361                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Street\" type=\"xs:string\" />{0}" +
362 #endif
363                                 "    </xs:sequence>{0}" +
364                                 "  </xs:complexType>{0}" +
365                                 "  <xs:simpleType name=\"FlagEnum\">{0}" +
366                                 "    <xs:list>{0}" +
367                                 "      <xs:simpleType>{0}" +
368                                 "        <xs:restriction base=\"xs:string\">{0}" +
369                                 "          <xs:enumeration value=\"e1\" />{0}" +
370                                 "          <xs:enumeration value=\"e2\" />{0}" +
371                                 "          <xs:enumeration value=\"e4\" />{0}" +
372                                 "        </xs:restriction>{0}" +
373                                 "      </xs:simpleType>{0}" +
374                                 "    </xs:list>{0}" +
375                                 "  </xs:simpleType>{0}" +
376                                 "  <xs:simpleType name=\"MapModifiers\">{0}" +
377                                 "    <xs:list>{0}" +
378                                 "      <xs:simpleType>{0}" +
379                                 "        <xs:restriction base=\"xs:string\">{0}" +
380                                 "          <xs:enumeration value=\"Public\" />{0}" +
381                                 "          <xs:enumeration value=\"Protected\" />{0}" +
382                                 "        </xs:restriction>{0}" +
383                                 "      </xs:simpleType>{0}" +
384                                 "    </xs:list>{0}" +
385                                 "  </xs:simpleType>{0}" +
386                                 "  <xs:complexType name=\"ArrayOfString\">{0}" +
387                                 "    <xs:complexContent mixed=\"false\">{0}" +
388                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
389                                 "        <xs:attribute d5p1:arrayType=\"xs:string[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
390                                 "      </xs:restriction>{0}" +
391                                 "    </xs:complexContent>{0}" +
392                                 "  </xs:complexType>{0}" +
393                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
394                 }
395
396                 [Test]
397                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
398                 public void ExportClass_MyList ()
399                 {
400                         XmlSchemas schemas = Export (typeof (MyList), "NSMyList");
401                         Assert.AreEqual (1, schemas.Count, "#1");
402
403                         StringWriter sw = new StringWriter ();
404                         schemas[0].Write (sw);
405
406                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
407                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
408 #if NET_2_0
409                                 "<xs:schema xmlns:tns=\"NSMyList\" elementFormDefault=\"qualified\" targetNamespace=\"NSMyList\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
410 #else
411                                 "<xs:schema xmlns:tns=\"NSMyList\" targetNamespace=\"NSMyList\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
412 #endif
413                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
414                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
415                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
416                                 "    <xs:complexContent mixed=\"false\">{0}" +
417                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
418                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
419                                 "      </xs:restriction>{0}" +
420                                 "    </xs:complexContent>{0}" +
421                                 "  </xs:complexType>{0}" +
422                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
423                 }
424
425                 [Test]
426                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
427                 public void ExportClass_Container ()
428                 {
429                         XmlSchemas schemas = Export (typeof (Container), "NSContainer");
430                         Assert.AreEqual (1, schemas.Count, "#1");
431
432                         StringWriter sw = new StringWriter ();
433                         schemas[0].Write (sw);
434
435                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
436                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
437 #if NET_2_0
438                                 "<xs:schema xmlns:tns=\"NSContainer\" elementFormDefault=\"qualified\" targetNamespace=\"NSContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
439 #else
440                                 "<xs:schema xmlns:tns=\"NSContainer\" targetNamespace=\"NSContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
441 #endif
442                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
443                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
444                                 "  <xs:complexType name=\"Container\">{0}" +
445                                 "    <xs:sequence>{0}" +
446 #if NET_2_0
447                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"Items\" type=\"tns:ArrayOfAnyType\" />{0}" +
448 #else
449                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Items\" type=\"tns:ArrayOfAnyType\" />{0}" +
450 #endif
451                                 "    </xs:sequence>{0}" +
452                                 "  </xs:complexType>{0}" +
453                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
454                                 "    <xs:complexContent mixed=\"false\">{0}" +
455                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
456                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
457                                 "      </xs:restriction>{0}" +
458                                 "    </xs:complexContent>{0}" +
459                                 "  </xs:complexType>{0}" +
460                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
461                 }
462
463                 [Test]
464                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
465                 public void ExportClass_Container2 ()
466                 {
467                         XmlSchemas schemas = Export (typeof (Container2), "NSContainer2");
468                         Assert.AreEqual (1, schemas.Count, "#1");
469
470                         StringWriter sw = new StringWriter ();
471                         schemas[0].Write (sw);
472
473                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
474                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
475 #if NET_2_0
476                                 "<xs:schema xmlns:tns=\"NSContainer2\" elementFormDefault=\"qualified\" targetNamespace=\"NSContainer2\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
477 #else
478                                 "<xs:schema xmlns:tns=\"NSContainer2\" targetNamespace=\"NSContainer2\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
479 #endif
480                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
481                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
482                                 "  <xs:complexType name=\"Container2\">{0}" +
483                                 "    <xs:sequence>{0}" +
484 #if NET_2_0
485                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"Items\" type=\"tns:ArrayOfAnyType\" />{0}" +
486 #else
487                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Items\" type=\"tns:ArrayOfAnyType\" />{0}" +
488 #endif
489                                 "    </xs:sequence>{0}" +
490                                 "  </xs:complexType>{0}" +
491                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
492                                 "    <xs:complexContent mixed=\"false\">{0}" +
493                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
494                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
495                                 "      </xs:restriction>{0}" +
496                                 "    </xs:complexContent>{0}" +
497                                 "  </xs:complexType>{0}" +
498                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
499                 }
500
501                 [Test]
502                 [ExpectedException (typeof (NotSupportedException))]
503                 public void ExportClass_MyElem ()
504                 {
505                         Export (typeof (MyElem), "NSMyElem");
506                 }
507
508                 [Test]
509                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
510                 [ExpectedException (typeof (NotSupportedException))] // The type System.Xml.XmlCDataSection may not be serialized with SOAP-encoded messages.
511                 public void ExportClass_CDataContainer ()
512                 {
513                         Export (typeof (CDataContainer), "NSCDataContainer");
514                 }
515
516                 [Test]
517                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
518                 [ExpectedException (typeof (NotSupportedException))] // The type System.Xml.XmlCDataSection may not be serialized with SOAP-encoded messages.
519                 public void ExportClass_NodeContainer ()
520                 {
521                         Export (typeof (NodeContainer), "NSNodeContainer");
522                 }
523
524                 [Test]
525                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
526                 public void ExportClass_Choices ()
527                 {
528                         XmlSchemas schemas = Export (typeof (Choices), "NSChoices");
529                         Assert.AreEqual (1, schemas.Count, "#1");
530
531                         StringWriter sw = new StringWriter ();
532                         schemas[0].Write (sw);
533
534                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
535                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
536 #if NET_2_0
537                                 "<xs:schema xmlns:tns=\"NSChoices\" elementFormDefault=\"qualified\" targetNamespace=\"NSChoices\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
538 #else
539                                 "<xs:schema xmlns:tns=\"NSChoices\" targetNamespace=\"NSChoices\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
540 #endif
541                                 "  <xs:complexType name=\"Choices\">{0}" +
542                                 "    <xs:sequence>{0}" +
543 #if NET_2_0
544                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"MyChoice\" type=\"xs:string\" />{0}" +
545                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"ItemType\" type=\"tns:ItemChoiceType\" />{0}" +
546 #else
547                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"MyChoice\" type=\"xs:string\" />{0}" +
548                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"ItemType\" type=\"tns:ItemChoiceType\" />{0}" +
549 #endif
550                                 "    </xs:sequence>{0}" +
551                                 "  </xs:complexType>{0}" +
552                                 "  <xs:simpleType name=\"ItemChoiceType\">{0}" +
553                                 "    <xs:restriction base=\"xs:string\">{0}" +
554                                 "      <xs:enumeration value=\"ChoiceZero\" />{0}" +
555                                 "      <xs:enumeration value=\"StrangeOne\" />{0}" +
556                                 "      <xs:enumeration value=\"ChoiceTwo\" />{0}" +
557                                 "    </xs:restriction>{0}" +
558                                 "  </xs:simpleType>{0}" +
559                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
560                 }
561
562                 [Test]
563                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
564                 public void ExportClass_WrongChoices ()
565                 {
566                         XmlSchemas schemas = Export (typeof (WrongChoices), "NSWrongChoices");
567                         Assert.AreEqual (1, schemas.Count, "#1");
568
569                         StringWriter sw = new StringWriter ();
570                         schemas[0].Write (sw);
571
572                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
573                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
574 #if NET_2_0
575                                 "<xs:schema xmlns:tns=\"NSWrongChoices\" elementFormDefault=\"qualified\" targetNamespace=\"NSWrongChoices\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
576 #else
577                                 "<xs:schema xmlns:tns=\"NSWrongChoices\" targetNamespace=\"NSWrongChoices\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
578 #endif
579                                 "  <xs:complexType name=\"WrongChoices\">{0}" +
580                                 "    <xs:sequence>{0}" +
581 #if NET_2_0
582                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"MyChoice\" type=\"xs:string\" />{0}" +
583                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"ItemType\" type=\"tns:ItemChoiceType\" />{0}" +
584 #else
585                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"MyChoice\" type=\"xs:string\" />{0}" +
586                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"ItemType\" type=\"tns:ItemChoiceType\" />{0}" +
587 #endif
588                                 "    </xs:sequence>{0}" +
589                                 "  </xs:complexType>{0}" +
590                                 "  <xs:simpleType name=\"ItemChoiceType\">{0}" +
591                                 "    <xs:restriction base=\"xs:string\">{0}" +
592                                 "      <xs:enumeration value=\"ChoiceZero\" />{0}" +
593                                 "      <xs:enumeration value=\"StrangeOne\" />{0}" +
594                                 "      <xs:enumeration value=\"ChoiceTwo\" />{0}" +
595                                 "    </xs:restriction>{0}" +
596                                 "  </xs:simpleType>{0}" +
597                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
598                 }
599
600                 [Test]
601                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
602                 public void ExportClass_TestSpace ()
603                 {
604                         XmlSchemas schemas = Export (typeof (TestSpace), "NSTestSpace");
605                         Assert.AreEqual (1, schemas.Count, "#1");
606
607                         StringWriter sw = new StringWriter ();
608                         schemas[0].Write (sw);
609
610                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
611                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
612 #if NET_2_0
613                                 "<xs:schema xmlns:tns=\"NSTestSpace\" elementFormDefault=\"qualified\" targetNamespace=\"NSTestSpace\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
614 #else
615                                 "<xs:schema xmlns:tns=\"NSTestSpace\" targetNamespace=\"NSTestSpace\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
616 #endif
617                                 "  <xs:complexType name=\"TestSpace\">{0}" +
618                                 "    <xs:sequence>{0}" +
619 #if NET_2_0
620                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"elem\" type=\"xs:int\" />{0}" +
621 #else
622                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"elem\" type=\"xs:int\" />{0}" +
623 #endif
624 #if NET_2_0
625                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"attr\" type=\"xs:int\" />{0}" +
626 #else
627                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"attr\" type=\"xs:int\" />{0}" +
628 #endif
629                                 "    </xs:sequence>{0}" +
630                                 "  </xs:complexType>{0}" +
631                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
632                 }
633
634                 [Test]
635                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
636                 public void ExportClass_ReadOnlyProperties ()
637                 {
638                         XmlSchemas schemas = Export (typeof (ReadOnlyProperties), "NSReadOnlyProperties");
639                         Assert.AreEqual (1, schemas.Count, "#1");
640
641                         StringWriter sw = new StringWriter ();
642                         schemas[0].Write (sw);
643
644                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
645                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
646 #if NET_2_0
647                                 "<xs:schema xmlns:tns=\"NSReadOnlyProperties\" elementFormDefault=\"qualified\" targetNamespace=\"NSReadOnlyProperties\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
648 #else
649                                 "<xs:schema xmlns:tns=\"NSReadOnlyProperties\" targetNamespace=\"NSReadOnlyProperties\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
650 #endif
651                                 "  <xs:complexType name=\"ReadOnlyProperties\" />{0}" +
652                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
653                 }
654
655                 [Test]
656                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
657                 public void ExportClass_ListDefaults ()
658                 {
659                         XmlSchemas schemas = Export (typeof (ListDefaults), "NSListDefaults");
660                         Assert.AreEqual (1, schemas.Count, "#1");
661
662                         StringWriter sw = new StringWriter ();
663                         schemas[0].Write (sw);
664
665                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
666                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
667 #if NET_2_0
668                                 "<xs:schema xmlns:tns=\"NSListDefaults\" elementFormDefault=\"qualified\" targetNamespace=\"NSListDefaults\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
669 #else
670                                 "<xs:schema xmlns:tns=\"NSListDefaults\" targetNamespace=\"NSListDefaults\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
671 #endif
672                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
673                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
674                                 "  <xs:complexType name=\"ListDefaults\">{0}" +
675                                 "    <xs:sequence>{0}" +
676 #if NET_2_0
677                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"list2\" type=\"tns:ArrayOfAnyType\" />{0}" +
678                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"list3\" type=\"tns:ArrayOfAnyType\" />{0}" +
679                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"list4\" type=\"tns:ArrayOfString\" />{0}" +
680                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"list5\" type=\"tns:ArrayOfAnyType\" />{0}" +
681                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"ed\" type=\"tns:SimpleClass\" />{0}" +
682                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"str\" type=\"xs:string\" />{0}" +
683 #else
684                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"list2\" type=\"tns:ArrayOfAnyType\" />{0}" +
685                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"list3\" type=\"tns:ArrayOfAnyType\" />{0}" +
686                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"list4\" type=\"tns:ArrayOfString\" />{0}" +
687                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"list5\" type=\"tns:ArrayOfAnyType\" />{0}" +
688                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"ed\" type=\"tns:SimpleClass\" />{0}" +
689                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"str\" type=\"xs:string\" />{0}" +
690 #endif
691                                 "    </xs:sequence>{0}" +
692                                 "  </xs:complexType>{0}" +
693                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
694                                 "    <xs:complexContent mixed=\"false\">{0}" +
695                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
696                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
697                                 "      </xs:restriction>{0}" +
698                                 "    </xs:complexContent>{0}" +
699                                 "  </xs:complexType>{0}" +
700                                 "  <xs:complexType name=\"SimpleClass\">{0}" +
701                                 "    <xs:sequence>{0}" +
702 #if NET_2_0
703                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"something\" type=\"xs:string\" />{0}" +
704 #else
705                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"something\" type=\"xs:string\" />{0}" +
706 #endif
707                                 "    </xs:sequence>{0}" +
708                                 "  </xs:complexType>{0}" +
709                                 "  <xs:complexType name=\"ArrayOfString\">{0}" +
710                                 "    <xs:complexContent mixed=\"false\">{0}" +
711                                 "      <xs:restriction xmlns:q2=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q2:Array\">{0}" +
712                                 "        <xs:attribute d5p1:arrayType=\"xs:string[]\" ref=\"q2:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
713                                 "      </xs:restriction>{0}" +
714                                 "    </xs:complexContent>{0}" +
715                                 "  </xs:complexType>{0}" +
716                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
717                 }
718
719                 [Test]
720                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
721                 public void ExportClass_ClsPerson ()
722                 {
723                         XmlSchemas schemas = Export (typeof (clsPerson), "NSClsPerson");
724                         Assert.AreEqual (1, schemas.Count, "#1");
725
726                         StringWriter sw = new StringWriter ();
727                         schemas[0].Write (sw);
728
729                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
730                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
731 #if NET_2_0
732                                 "<xs:schema xmlns:tns=\"NSClsPerson\" elementFormDefault=\"qualified\" targetNamespace=\"NSClsPerson\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
733 #else
734  "<xs:schema xmlns:tns=\"NSClsPerson\" targetNamespace=\"NSClsPerson\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
735 #endif
736  "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
737                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
738                                 "  <xs:complexType name=\"clsPerson\">{0}" +
739                                 "    <xs:sequence>{0}" +
740 #if NET_2_0
741                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"EmailAccounts\" type=\"tns:ArrayOfAnyType\" />{0}" +
742 #else
743  "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"EmailAccounts\" type=\"tns:ArrayOfAnyType\" />{0}" +
744 #endif
745  "    </xs:sequence>{0}" +
746                                 "  </xs:complexType>{0}" +
747                                 "  <xs:complexType name=\"ArrayOfAnyType\">{0}" +
748                                 "    <xs:complexContent mixed=\"false\">{0}" +
749                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
750                                 "        <xs:attribute d5p1:arrayType=\"xs:anyType[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
751                                 "      </xs:restriction>{0}" +
752                                 "    </xs:complexContent>{0}" +
753                                 "  </xs:complexType>{0}" +
754                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
755                 }
756
757                 [Test]
758                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
759                 public void ExportClass_ArrayClass ()
760                 {
761                         XmlSchemas schemas = Export (typeof (ArrayClass), "NSArrayClass");
762                         Assert.AreEqual (1, schemas.Count, "#1");
763
764                         StringWriter sw = new StringWriter ();
765                         schemas[0].Write (sw);
766
767                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
768                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
769 #if NET_2_0
770                                 "<xs:schema xmlns:tns=\"NSArrayClass\" elementFormDefault=\"qualified\" targetNamespace=\"NSArrayClass\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
771 #else
772                                 "<xs:schema xmlns:tns=\"NSArrayClass\" targetNamespace=\"NSArrayClass\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
773 #endif
774                                 "  <xs:complexType name=\"ArrayClass\">{0}" +
775                                 "    <xs:sequence>{0}" +
776 #if NET_2_0
777                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"names\" type=\"xs:anyType\" />{0}" +
778 #else
779                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"names\" type=\"xs:anyType\" />{0}" +
780 #endif
781                                 "    </xs:sequence>{0}" +
782                                 "  </xs:complexType>{0}" +
783                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#4");
784                 }
785
786                 [Test]
787                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
788                 public void ExportClass_StructContainer ()
789                 {
790                         XmlSchemas schemas = Export (typeof (StructContainer), "NSStructContainer");
791                         Assert.AreEqual (1, schemas.Count, "#1");
792
793                         StringWriter sw = new StringWriter ();
794                         schemas[0].Write (sw);
795
796                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
797                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
798 #if NET_2_0
799                                 "<xs:schema xmlns:tns=\"NSStructContainer\" elementFormDefault=\"qualified\" targetNamespace=\"NSStructContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
800 #else
801                                 "<xs:schema xmlns:tns=\"NSStructContainer\" targetNamespace=\"NSStructContainer\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
802 #endif
803                                 "  <xs:complexType name=\"StructContainer\">{0}" +
804                                 "    <xs:sequence>{0}" +
805 #if NET_2_0
806                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" form=\"unqualified\" name=\"Value\" type=\"tns:EnumDefaultValue\" />{0}" +
807 #else
808                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"Value\" type=\"tns:EnumDefaultValue\" />{0}" +
809 #endif
810                                 "    </xs:sequence>{0}" +
811                                 "  </xs:complexType>{0}" +
812                                 "  <xs:simpleType name=\"EnumDefaultValue\">{0}" +
813                                 "    <xs:list>{0}" +
814                                 "      <xs:simpleType>{0}" +
815                                 "        <xs:restriction base=\"xs:string\">{0}" +
816                                 "          <xs:enumeration value=\"e1\" />{0}" +
817                                 "          <xs:enumeration value=\"e2\" />{0}" +
818                                 "          <xs:enumeration value=\"e3\" />{0}" +
819                                 "        </xs:restriction>{0}" +
820                                 "      </xs:simpleType>{0}" +
821                                 "    </xs:list>{0}" +
822                                 "  </xs:simpleType>{0}" +
823                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
824                 }
825
826                 [Test]
827                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
828 /*
829 #if NET_2_0
830                 [Category ("NotWorking")] // minOccurs is 1 on Mono
831 #endif
832  */
833                 public void ExportClass_SimpleClass_Array ()
834                 {
835                         SoapAttributeOverrides overrides = new SoapAttributeOverrides ();
836                         SoapAttributes attr = new SoapAttributes ();
837                         SoapElementAttribute element = new SoapElementAttribute ();
838                         element.ElementName = "saying";
839                         element.IsNullable = true;
840                         attr.SoapElement = element;
841                         overrides.Add (typeof (SimpleClass), "something", attr);
842
843                         SoapReflectionImporter ri = new SoapReflectionImporter (overrides, "NSSimpleClassArray");
844                         XmlSchemas schemas = new XmlSchemas ();
845                         SoapSchemaExporter sx = new SoapSchemaExporter (schemas);
846                         XmlTypeMapping tm = ri.ImportTypeMapping (typeof (SimpleClass[]));
847                         sx.ExportTypeMapping (tm);
848
849                         Assert.AreEqual (1, schemas.Count, "#1");
850
851                         StringWriter sw = new StringWriter ();
852                         schemas[0].Write (sw);
853
854                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
855                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
856 #if NET_2_0
857                                 "<xs:schema xmlns:tns=\"NSSimpleClassArray\" elementFormDefault=\"qualified\" targetNamespace=\"NSSimpleClassArray\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
858 #else
859                                 "<xs:schema xmlns:tns=\"NSSimpleClassArray\" targetNamespace=\"NSSimpleClassArray\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
860 #endif
861                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
862                                 "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
863                                 "  <xs:complexType name=\"ArrayOfSimpleClass\">{0}" +
864                                 "    <xs:complexContent mixed=\"false\">{0}" +
865                                 "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
866                                 "        <xs:attribute d5p1:arrayType=\"tns:SimpleClass[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
867                                 "      </xs:restriction>{0}" +
868                                 "    </xs:complexContent>{0}" +
869                                 "  </xs:complexType>{0}" +
870                                 "  <xs:complexType name=\"SimpleClass\">{0}" +
871                                 "    <xs:sequence>{0}" +
872 #if NET_2_0
873                                 "      <xs:element minOccurs=\"0\" maxOccurs=\"1\" form=\"unqualified\" name=\"saying\" nillable=\"true\" type=\"xs:string\" />{0}" +
874 #else
875                                 "      <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"saying\" type=\"xs:string\" />{0}" +
876 #endif
877                                 "    </xs:sequence>{0}" +
878                                 "  </xs:complexType>{0}" +
879                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
880                 }
881
882                 [Test]
883                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
884                 public void ExportEnum ()
885                 {
886                         XmlSchemas schemas = Export (typeof (EnumDefaultValue), "NSEnumDefaultValue");
887                         Assert.AreEqual (1, schemas.Count, "#1");
888
889                         StringWriter sw = new StringWriter ();
890                         schemas[0].Write (sw);
891
892                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
893                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
894 #if NET_2_0
895                                 "<xs:schema xmlns:tns=\"NSEnumDefaultValue\" elementFormDefault=\"qualified\" targetNamespace=\"NSEnumDefaultValue\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
896 #else
897                                 "<xs:schema xmlns:tns=\"NSEnumDefaultValue\" targetNamespace=\"NSEnumDefaultValue\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
898 #endif
899                                 "  <xs:simpleType name=\"EnumDefaultValue\">{0}" +
900                                 "    <xs:list>{0}" +
901                                 "      <xs:simpleType>{0}" +
902                                 "        <xs:restriction base=\"xs:string\">{0}" +
903                                 "          <xs:enumeration value=\"e1\" />{0}" +
904                                 "          <xs:enumeration value=\"e2\" />{0}" +
905                                 "          <xs:enumeration value=\"e3\" />{0}" +
906                                 "        </xs:restriction>{0}" +
907                                 "      </xs:simpleType>{0}" +
908                                 "    </xs:list>{0}" +
909                                 "  </xs:simpleType>{0}" +
910                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
911
912                         schemas = Export (typeof (EnumDefaultValueNF), "NSEnumDefaultValueNF");
913                         Assert.AreEqual (1, schemas.Count, "#3");
914
915                         sw = new StringWriter ();
916                         schemas[0].Write (sw);
917
918                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
919                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
920 #if NET_2_0
921                                 "<xs:schema xmlns:tns=\"NSEnumDefaultValueNF\" elementFormDefault=\"qualified\" targetNamespace=\"NSEnumDefaultValueNF\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
922 #else
923                                 "<xs:schema xmlns:tns=\"NSEnumDefaultValueNF\" targetNamespace=\"NSEnumDefaultValueNF\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
924 #endif
925                                 "  <xs:simpleType name=\"EnumDefaultValueNF\">{0}" +
926                                 "    <xs:restriction base=\"xs:string\">{0}" +
927                                 "      <xs:enumeration value=\"e1\" />{0}" +
928                                 "      <xs:enumeration value=\"e2\" />{0}" +
929                                 "      <xs:enumeration value=\"e3\" />{0}" +
930                                 "    </xs:restriction>{0}" +
931                                 "  </xs:simpleType>{0}" +
932                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#4");
933                 }
934
935                 [Test]
936                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
937                 public void ExportXsdPrimitive ()
938                 {
939                         ArrayList types = new ArrayList ();
940                         types.Add (new TypeDescription (typeof (object), true, "anyType", "Object"));
941                         types.Add (new TypeDescription (typeof (byte), true, "unsignedByte", "Byte"));
942                         types.Add (new TypeDescription (typeof (sbyte), true, "byte", "Byte"));
943                         types.Add (new TypeDescription (typeof (bool), true, "boolean", "Boolean"));
944                         types.Add (new TypeDescription (typeof (short), true, "short", "Short"));
945                         types.Add (new TypeDescription (typeof (int), true, "int", "Int"));
946                         types.Add (new TypeDescription (typeof (long), true, "long", "Long"));
947                         types.Add (new TypeDescription (typeof (float), true, "float", "Float"));
948                         types.Add (new TypeDescription (typeof (double), true, "double", "Double"));
949                         types.Add (new TypeDescription (typeof (decimal), true, "decimal", "Decimal"));
950                         types.Add (new TypeDescription (typeof (ushort), true, "unsignedShort", "UnsignedShort"));
951                         types.Add (new TypeDescription (typeof (uint), true, "unsignedInt", "UnsignedInt"));
952                         types.Add (new TypeDescription (typeof (ulong), true, "unsignedLong", "UnsignedLong"));
953                         types.Add (new TypeDescription (typeof (DateTime), true, "dateTime", "DateTime"));
954 #if NET_2_0
955                         types.Add (new TypeDescription (typeof (XmlQualifiedName), true, "QName", "QName", true));
956 #else
957                         types.Add (new TypeDescription (typeof (XmlQualifiedName), true, "QName", "QName"));
958 #endif
959                         types.Add (new TypeDescription (typeof (string), true, "string", "String", true));
960
961                         foreach (TypeDescription typeDesc in types) {
962                                 XmlSchemas schemas = Export (typeDesc.Type, typeDesc.Type.Name);
963                                 Assert.AreEqual (0, schemas.Count, typeDesc.Type.FullName + "#1");
964                         }
965                 }
966
967                 [Test]
968                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
969                 public void ExportXsdPrimitive_ByteArray ()
970                 {
971                         XmlSchemas schemas = Export (typeof (byte[]), "ByteArray");
972                         Assert.AreEqual (0, schemas.Count, "#1");
973                 }
974
975                 [Test]
976                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
977                 public void ExportXsdPrimitive_Arrays ()
978                 {
979                         ArrayList types = new ArrayList ();
980                         types.Add (new TypeDescription (typeof (object[]), true, "anyType", "AnyType"));
981                         types.Add (new TypeDescription (typeof (sbyte[]), true, "byte", "Byte"));
982                         types.Add (new TypeDescription (typeof (bool[]), true, "boolean", "Boolean"));
983                         types.Add (new TypeDescription (typeof (short[]), true, "short", "Short"));
984                         types.Add (new TypeDescription (typeof (int[]), true, "int", "Int"));
985                         types.Add (new TypeDescription (typeof (long[]), true, "long", "Long"));
986                         types.Add (new TypeDescription (typeof (float[]), true, "float", "Float"));
987                         types.Add (new TypeDescription (typeof (double[]), true, "double", "Double"));
988                         types.Add (new TypeDescription (typeof (decimal[]), true, "decimal", "Decimal"));
989                         types.Add (new TypeDescription (typeof (ushort[]), true, "unsignedShort", "UnsignedShort"));
990                         types.Add (new TypeDescription (typeof (uint[]), true, "unsignedInt", "UnsignedInt"));
991                         types.Add (new TypeDescription (typeof (ulong[]), true, "unsignedLong", "UnsignedLong"));
992                         types.Add (new TypeDescription (typeof (DateTime[]), true, "dateTime", "DateTime"));
993 #if NET_2_0
994                         types.Add (new TypeDescription (typeof (XmlQualifiedName[]), true, "QName", "QName", true));
995 #else
996                         types.Add (new TypeDescription (typeof (XmlQualifiedName[]), true, "QName", "QName"));
997 #endif
998                         types.Add (new TypeDescription (typeof (string[]), true, "string", "String", true));
999
1000                         foreach (TypeDescription typeDesc in types) {
1001                                 XmlSchemas schemas = Export (typeDesc.Type, typeDesc.Type.Name);
1002                                 Assert.AreEqual (1, schemas.Count, typeDesc.Type.FullName + "#1");
1003
1004                                 StringWriter sw = new StringWriter ();
1005                                 schemas[0].Write (sw);
1006
1007                                 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1008                                         "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
1009 #if NET_2_0
1010                                         "<xs:schema xmlns:tns=\"{1}\" elementFormDefault=\"qualified\" targetNamespace=\"{1}\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1011 #else
1012                                         "<xs:schema xmlns:tns=\"{1}\" targetNamespace=\"{1}\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1013 #endif
1014                                         "  <xs:import namespace=\"http://schemas.xmlsoap.org/soap/encoding/\" />{0}" +
1015                                         "  <xs:import namespace=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
1016                                         "  <xs:complexType name=\"ArrayOf{2}\">{0}" +
1017                                         "    <xs:complexContent mixed=\"false\">{0}" +
1018                                         "      <xs:restriction xmlns:q1=\"http://schemas.xmlsoap.org/soap/encoding/\" base=\"q1:Array\">{0}" +
1019                                         "        <xs:attribute d5p1:arrayType=\"xs:{3}[]\" ref=\"q1:arrayType\" xmlns:d5p1=\"http://schemas.xmlsoap.org/wsdl/\" />{0}" +
1020                                         "      </xs:restriction>{0}" +
1021                                         "    </xs:complexContent>{0}" +
1022                                         "  </xs:complexType>{0}" +
1023                                         "</xs:schema>", Environment.NewLine, typeDesc.Type.Name, typeDesc.ArrayType, typeDesc.XmlType, 
1024                                         typeDesc.XsdType ? "xs" : "tns", typeDesc.IsNillable ? "nillable=\"true\" " : ""),
1025                                         sw.ToString (), typeDesc.Type.FullName + "#2");
1026                         }
1027                 }
1028
1029                 [Test]
1030                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
1031                 public void ExportNonXsdPrimitive_Guid ()
1032                 {
1033                         XmlSchemas schemas = Export (typeof (Guid), "NSPrimGuid");
1034                         Assert.AreEqual (1, schemas.Count, "#1");
1035
1036                         StringWriter sw = new StringWriter ();
1037                         schemas[0].Write (sw);
1038
1039                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1040                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
1041 #if NET_2_0
1042                                 "<xs:schema xmlns:tns=\"http://microsoft.com/wsdl/types/\" elementFormDefault=\"qualified\" targetNamespace=\"http://microsoft.com/wsdl/types/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1043 #else
1044                                 "<xs:schema xmlns:tns=\"http://microsoft.com/wsdl/types/\" targetNamespace=\"http://microsoft.com/wsdl/types/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1045 #endif
1046                                 "  <xs:simpleType name=\"guid\">{0}" +
1047                                 "    <xs:restriction base=\"xs:string\">{0}" +
1048                                 "      <xs:pattern value=\"[0-9a-fA-F]{{8}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{4}}-[0-9a-fA-F]{{12}}\" />{0}" +
1049                                 "    </xs:restriction>{0}" +
1050                                 "  </xs:simpleType>{0}" +
1051                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
1052                 }
1053
1054                 [Test]
1055                 [Category ("NotWorking")] // mark it NotWorking until fixes have landed in svn
1056                 public void ExportNonXsdPrimitive_Char ()
1057                 {
1058                         XmlSchemas schemas = Export (typeof (Char), "NSPrimChar");
1059                         Assert.AreEqual (1, schemas.Count, "#1");
1060
1061                         StringWriter sw = new StringWriter ();
1062                         schemas[0].Write (sw);
1063
1064                         Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1065                                 "<?xml version=\"1.0\" encoding=\"utf-16\"?>{0}" +
1066 #if NET_2_0
1067                                 "<xs:schema xmlns:tns=\"http://microsoft.com/wsdl/types/\" elementFormDefault=\"qualified\" targetNamespace=\"http://microsoft.com/wsdl/types/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1068 #else
1069                                 "<xs:schema xmlns:tns=\"http://microsoft.com/wsdl/types/\" targetNamespace=\"http://microsoft.com/wsdl/types/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">{0}" +
1070 #endif
1071                                 "  <xs:simpleType name=\"char\">{0}" +
1072                                 "    <xs:restriction base=\"xs:unsignedShort\" />{0}" +
1073                                 "  </xs:simpleType>{0}" +
1074                                 "</xs:schema>", Environment.NewLine), sw.ToString (), "#2");
1075                 }
1076
1077                 public class Employee : IXmlSerializable
1078                 {
1079                         private string _firstName;
1080                         private string _lastName;
1081                         private string _address;
1082
1083                         public XmlSchema GetSchema ()
1084                         {
1085                                 return null;
1086                         }
1087
1088                         public void WriteXml (XmlWriter writer)
1089                         {
1090                                 writer.WriteStartElement ("employee", "urn:devx-com");
1091                                 writer.WriteAttributeString ("firstName", _firstName);
1092                                 writer.WriteAttributeString ("lastName", _lastName);
1093                                 writer.WriteAttributeString ("address", _address);
1094                                 writer.WriteEndElement ();
1095                         }
1096
1097                         public void ReadXml (XmlReader reader)
1098                         {
1099                                 XmlNodeType type = reader.MoveToContent ();
1100                                 if (type == XmlNodeType.Element && reader.LocalName == "employee") {
1101                                         _firstName = reader["firstName"];
1102                                         _lastName = reader["lastName"];
1103                                         _address = reader["address"];
1104                                 }
1105                         }
1106                 }
1107
1108                 public class StructContainer
1109                 {
1110                         public EnumDefaultValue Value;
1111                 }
1112
1113                 private class TypeDescription
1114                 {
1115                         public TypeDescription (Type type, bool xsdType, string xmlType, string arrayType)
1116                                 : this (type, xsdType, xmlType, arrayType, false)
1117                         {
1118                         }
1119
1120                         public TypeDescription (Type type, bool xsdType, string xmlType, string arrayType, bool isNillable)
1121                         {
1122                                 _type = type;
1123                                 _xsdType = xsdType;
1124                                 _xmlType = xmlType;
1125                                 _arrayType = arrayType;
1126                                 _isNillable = isNillable;
1127                         }
1128
1129                         public Type Type
1130                         {
1131                                 get { return _type; }
1132                         }
1133
1134                         public string XmlType
1135                         {
1136                                 get { return _xmlType; }
1137                         }
1138
1139                         public string ArrayType
1140                         {
1141                                 get { return _arrayType; }
1142                         }
1143
1144                         public bool XsdType
1145                         {
1146                                 get { return _xsdType; }
1147                         }
1148
1149                         public bool IsNillable
1150                         {
1151                                 get { return _isNillable; }
1152                         }
1153
1154                         private Type _type;
1155                         private bool _xsdType;
1156                         private string _xmlType;
1157                         private string _arrayType;
1158                         private bool _isNillable;
1159                 }
1160         }
1161 }