2 // XsdDataContractImporterTest.cs
5 // Ankit Jain <jankit@novell.com>
7 // Copyright (C) 2006 Novell, Inc. http://www.novell.com
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // This test code contains tests for both DataContractSerializer and
32 // NetDataContractSerializer. The code could be mostly common.
39 using System.CodeDom.Compiler;
40 using System.Collections.Generic;
43 using System.Runtime.Serialization;
44 using System.ServiceModel.Description;
46 using System.Xml.Schema;
47 using System.Xml.Serialization;
48 using Microsoft.CSharp;
49 using NUnit.Framework;
51 using QName = System.Xml.XmlQualifiedName;
53 namespace MonoTests.System.Runtime.Serialization
56 public class XsdContractImporterTest
64 XmlReader xr = XmlTextReader.Create ("Test/System.Runtime.Serialization/one.xml");
65 metadata = MetadataSet.ReadFrom (xr);
69 private XmlSchemaSet NewXmlSchemaSet ()
71 xss = new XmlSchemaSet ();
72 foreach (MetadataSection section in metadata.MetadataSections)
73 if (section.Metadata is XmlSchema)
74 xss.Add (section.Metadata as XmlSchema);
76 Assert.AreEqual (3, xss.Schemas ().Count, "#1");
80 private XsdDataContractImporter GetImporter ()
82 CodeCompileUnit ccu = new CodeCompileUnit ();
83 return new XsdDataContractImporter (ccu);
87 public void CtorTest ()
89 XsdDataContractImporter xi = new XsdDataContractImporter ();
90 Assert.IsNotNull (xi.CodeCompileUnit, "#c01");
92 xi = new XsdDataContractImporter (null);
93 Assert.IsNotNull (xi.CodeCompileUnit, "#c02");
95 xi = new XsdDataContractImporter (new CodeCompileUnit ());
100 [ExpectedException (typeof (InvalidOperationException))]
101 public void GetCodeTypeReferenceTest ()
103 XsdDataContractImporter xsdi = GetImporter ();
104 xsdi.GetCodeTypeReference (new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
108 public void GetCodeTypeReferenceTest2 ()
112 Assert.IsFalse (xss.IsCompiled, "#g01");
114 XsdDataContractImporter xsdi = GetImporter ();
115 xsdi.Import (xss, new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
116 Assert.IsTrue (xss.IsCompiled, "#g02");
118 CodeTypeReference type = xsdi.GetCodeTypeReference (new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
120 //FIXME: How should this type ref be checked?
121 Assert.IsNotNull (type, "#g03");
122 Assert.AreEqual (type.BaseType, "dc", "#g04");
126 public void CanImportTest ()
129 XsdDataContractImporter xsdi = GetImporter ();
131 Assert.IsFalse (xss.IsCompiled, "#ci01");
133 Assert.IsTrue (xsdi.CanImport (xss, new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/")), "#ci02");
134 Assert.IsTrue (xss.IsCompiled, "#ci03");
136 Assert.IsFalse (xsdi.CanImport (xss, new XmlQualifiedName ("Echo", "http://myns/echo")), "#ci04");
137 Assert.IsTrue (xsdi.CanImport (xss, new XmlQualifiedName ("int", "http://www.w3.org/2001/XMLSchema")), "#ci05");
139 Assert.IsTrue (xsdi.CanImport (xss), "#ci06");
141 Assert.IsTrue (xsdi.CanImport (xss,
142 xss.GlobalElements [new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/")] as XmlSchemaElement),
145 Assert.IsTrue (xsdi.CanImport (xss,
146 xss.GlobalElements [new XmlQualifiedName ("Echo", "http://myns/echo")] as XmlSchemaElement),
151 public void CanImportTest2 ()
154 XsdDataContractImporter xsdi = GetImporter ();
156 List<XmlQualifiedName> names = new List<XmlQualifiedName> ();
157 names.Add (new XmlQualifiedName ("Echo", "http://myns/echo"));
158 Assert.IsFalse (xsdi.CanImport (xss, names), "#ci20");
160 names.Add (new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
161 Assert.IsFalse (xsdi.CanImport (xss, names), "#ci21");
164 names.Add (new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
165 Assert.IsTrue (xsdi.CanImport (xss, names), "#ci22");
169 [ExpectedException (typeof (ArgumentNullException))]
170 public void CanImportNullTest1 ()
172 XsdDataContractImporter xsdi = GetImporter ();
173 xsdi.CanImport (null);
177 [ExpectedException (typeof (ArgumentNullException))]
178 public void CanImportNullTest2 ()
180 XsdDataContractImporter xsdi = GetImporter ();
181 xsdi.CanImport (xss, (XmlQualifiedName) null);
185 [ExpectedException (typeof (ArgumentNullException))]
186 public void CanImportNullTest3 ()
188 XsdDataContractImporter xsdi = GetImporter ();
189 xsdi.CanImport (xss, (XmlSchemaElement) null);
193 [ExpectedException (typeof (ArgumentNullException))]
194 public void ImportTestNullSchemas ()
196 XsdDataContractImporter xsdi = GetImporter ();
201 [ExpectedException (typeof (ArgumentNullException))]
202 public void ImportTestNullSchemas2 ()
204 XsdDataContractImporter xsdi = GetImporter ();
205 xsdi.Import (null, new XmlQualifiedName ("foo"));
209 [ExpectedException (typeof (ArgumentNullException))]
210 public void ImportTestNullSchemas3 ()
212 XsdDataContractImporter xsdi = GetImporter ();
213 xsdi.Import (null, new List<XmlQualifiedName> ());
217 [ExpectedException (typeof (ArgumentNullException))]
218 public void ImportTestNullTypeName ()
220 XsdDataContractImporter xsdi = GetImporter ();
221 xsdi.Import (new XmlSchemaSet (), (XmlQualifiedName) null);
225 [ExpectedException (typeof (ArgumentNullException))]
226 public void ImportTestNullElement ()
228 XsdDataContractImporter xsdi = GetImporter ();
229 xsdi.Import (new XmlSchemaSet (), (XmlSchemaElement) null);
233 [ExpectedException (typeof (ArgumentNullException))]
234 public void ImportTestNullCollection ()
236 XsdDataContractImporter xsdi = GetImporter ();
237 xsdi.Import (new XmlSchemaSet (), (ICollection<XmlQualifiedName>) null);
241 [Category ("NotWorking")] // importing almost-invalid element. This test is almost missing the point.
242 public void ImportTest ()
244 XsdDataContractImporter xsdi = GetImporter ();
245 XmlSchemaElement element = new XmlSchemaElement();
246 Assert.IsTrue (xsdi.CanImport (xss, new QName ("dc", "http://schemas.datacontract.org/2004/07/")), "#i01");
247 Assert.IsTrue (xsdi.CanImport (xss, element), "#i01-2");
248 Assert.AreEqual (new XmlQualifiedName ("anyType", XmlSchema.Namespace), xsdi.Import (xss, element), "#i02");
250 CodeCompileUnit ccu = xsdi.CodeCompileUnit;
251 Assert.AreEqual (1, ccu.Namespaces.Count, "#i03");
252 Assert.AreEqual ("", ccu.Namespaces [0].Name, "#i04");
254 Assert.AreEqual (1, ccu.Namespaces [0].Types.Count, "#i05");
256 Dictionary<string, string> mbrs = new Dictionary<string, string> ();
257 mbrs.Add ("foo", "System.String");
258 CheckDC (ccu.Namespaces [0].Types [0], "dc", mbrs, "#i06");
262 public void ImportDataContract1 ()
265 Assert.IsFalse (xss.IsCompiled, "#i20");
267 XsdDataContractImporter xsdi = GetImporter ();
269 xsdi.Import (xss, new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
270 Assert.IsTrue (xss.IsCompiled, "#i21");
271 CodeCompileUnit ccu = xsdi.CodeCompileUnit;
273 Assert.AreEqual (1, ccu.Namespaces.Count, "#i22");
274 Assert.AreEqual ("", ccu.Namespaces [0].Name, "#i23");
276 Assert.AreEqual (1, ccu.Namespaces [0].Types.Count, "#i24");
278 Dictionary<string, string> mbrs = new Dictionary<string, string> ();
279 mbrs.Add ("foo", "System.String");
280 CheckDC (ccu.Namespaces [0].Types [0], "dc", mbrs, "#i25");
282 ccu.Namespaces.Clear ();
283 xsdi.Import (xss, new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
284 //Importing same data contract again with same importer
285 Assert.AreEqual (0, ccu.Namespaces.Count, "#i26");
289 public void ImportDataContract2 ()
292 XsdDataContractImporter xsdi = GetImporter ();
295 xsdi.Import (xss, xss.GlobalElements [new XmlQualifiedName ("Echo", "http://myns/echo")] as XmlSchemaElement);
296 CodeCompileUnit ccu = xsdi.CodeCompileUnit;
298 Assert.AreEqual (2, ccu.Namespaces.Count, "#i29");
299 Dictionary<string, string> args = new Dictionary<string, string> ();
300 args.Add ("msg", "System.String");
301 args.Add ("num", "System.Int32");
302 args.Add ("d", "dc");
304 CheckDC (ccu.Namespaces [0].Types [0], "Echo", args, "#i30");
307 args.Add ("foo", "System.String");
308 CheckDC (ccu.Namespaces [1].Types [0], "dc", args, "#i31");
310 ccu.Namespaces.Clear ();
311 xsdi.Import (xss, new XmlQualifiedName ("dc", "http://schemas.datacontract.org/2004/07/"));
312 Assert.AreEqual (0, ccu.Namespaces.Count);
316 [ExpectedException (typeof (InvalidDataContractException))]
317 public void ImportMessageEcho ()
319 XsdDataContractImporter xsdi = GetImporter ();
320 xsdi.Import (xss, new XmlQualifiedName ("Echo", "http://myns/echo"));
324 public void ImportAll ()
327 XsdDataContractImporter xsdi = GetImporter ();
329 CodeCompileUnit ccu = xsdi.CodeCompileUnit;
332 Assert.AreEqual (2, ccu.Namespaces.Count, "#i40");
333 Assert.AreEqual ("myns.echo", ccu.Namespaces [0].Name, "#i41");
334 Assert.AreEqual ("", ccu.Namespaces [1].Name, "#i42");
336 Assert.AreEqual (4, ccu.Namespaces [0].Types.Count, "#i43");
340 Dictionary <string, string> args = new Dictionary <string, string> ();
341 args.Add ("msg", "System.String");
342 args.Add ("num", "System.Int32");
343 args.Add ("d", "dc");
345 CheckDC (ccu.Namespaces [0].Types [0], "Echo", args, "#i44");
348 args.Add ("EchoResult", "System.String");
349 CheckDC (ccu.Namespaces [0].Types [1], "EchoResponse", args, "#i45");
352 args.Add ("it", "System.Int32");
353 args.Add ("prefix", "System.String");
354 CheckDC (ccu.Namespaces [0].Types [2], "DoubleIt", args, "#i46");
357 args.Add ("DoubleItResult", "System.String");
358 CheckDC (ccu.Namespaces [0].Types [3], "DoubleItResponse", args, "#i47");
362 args.Add ("foo", "System.String");
363 CheckDC (ccu.Namespaces [1].Types [0], "dc", args, "#i48");
365 ccu.Namespaces.Clear ();
367 //Importing same data contract again with same importer
368 Assert.AreEqual (0, ccu.Namespaces.Count, "#i49");
372 public void ImportSkipArrayOfPrimitives ()
374 var ccu = new CodeCompileUnit ();
375 var xdi = new XsdDataContractImporter (ccu);
376 var xss = new XmlSchemaSet ();
377 xss.Add (null, "Test/Resources/Schemas/schema1.xsd");
378 xss.Add (null, "Test/Resources/Schemas/schema2.xsd");
380 var sw = new StringWriter ();
381 new CSharpCodeProvider ().GenerateCodeFromCompileUnit (ccu, sw, null);
382 Assert.IsTrue (sw.ToString ().IndexOf ("ArrayOfint") < 0, "#1");
386 public void ImportGivesAppropriateNamespaces ()
388 var ccu = new CodeCompileUnit ();
389 var xdi = new XsdDataContractImporter (ccu);
390 var xss = new XmlSchemaSet ();
391 xss.Add (null, "Test/Resources/Schemas/schema1.xsd");
392 xss.Add (null, "Test/Resources/Schemas/schema2.xsd");
393 xss.Add (null, "Test/Resources/Schemas/schema3.xsd");
395 var sw = new StringWriter ();
396 bool t = false, te = false;
397 foreach (CodeNamespace cns in ccu.Namespaces) {
398 if (cns.Name == "tempuri.org")
400 else if (cns.Name == "tempuri.org.ext")
402 Assert.AreEqual ("GetSearchDataResponse", cns.Types [0].Name, "#1." + cns.Name);
404 Assert.IsTrue (t, "t");
405 Assert.IsTrue (t, "te");
408 CodeCompileUnit DoImport (params string [] schemaFiles)
410 return DoImport (false, schemaFiles);
413 CodeCompileUnit DoImport (bool xmlType, params string [] schemaFiles)
415 var ccu = new CodeCompileUnit ();
416 var xdi = new XsdDataContractImporter (ccu);
418 xdi.Options = new ImportOptions () { ImportXmlType = true };
419 var xss = new XmlSchemaSet ();
420 foreach (var schemaFile in schemaFiles)
421 xss.Add (null, schemaFile);
427 void DoCanImport (bool result, params string [] schemaFiles)
429 var ccu = new CodeCompileUnit ();
430 var xdi = new XsdDataContractImporter (ccu);
431 var xss = new XmlSchemaSet ();
432 foreach (var schemaFile in schemaFiles)
433 xss.Add (null, schemaFile);
434 Assert.AreEqual (result, xdi.CanImport (xss));
437 string GenerateCode (CodeCompileUnit ccu)
439 var sw = new StringWriter ();
440 new CSharpCodeProvider ().GenerateCodeFromCompileUnit (ccu, sw, null);
441 return sw.ToString ();
444 // FIXME: this set of tests need further assertion in each test case. Right now it just checks if things import or fail just fine.
447 public void ImportTestX0 ()
449 DoImport ("Test/Resources/Schemas/ns0.xsd");
453 public void ImportTestX0_2 ()
455 var ccu = DoImport (true, "Test/Resources/Schemas/ns0.xsd");
456 Assert.IsTrue (GenerateCode (ccu).IndexOf ("class") < 0, "#1");
460 public void ImportTestX1 ()
462 DoImport ("Test/Resources/Schemas/ns1.xsd");
466 public void ImportTestX1_2 ()
468 Assert.AreEqual (GenerateCode (DoImport ("Test/Resources/Schemas/ns1.xsd")), GenerateCode (DoImport (true, "Test/Resources/Schemas/ns1.xsd")), "#1");
472 public void ImportTestX2 ()
474 DoImport ("Test/Resources/Schemas/ns2.xsd");
478 public void ImportTestX2_2 ()
480 Assert.AreEqual (GenerateCode (DoImport ("Test/Resources/Schemas/ns2.xsd")), GenerateCode (DoImport (true, "Test/Resources/Schemas/ns2.xsd")), "#1");
484 [ExpectedException (typeof (InvalidDataContractException))]
485 public void ImportTestX3 ()
487 DoImport ("Test/Resources/Schemas/ns3.xsd");
491 [Category ("NotWorking")]
492 public void ImportTestX3_2 ()
494 var ccu = DoImport (true, "Test/Resources/Schemas/ns3.xsd");
495 var code = GenerateCode (ccu);
496 Assert.IsTrue (code.IndexOf ("class T2") > 0, "#1");
497 Assert.IsTrue (code.IndexOf ("IXmlSerializable") > 0, "#2");
498 Assert.IsTrue (code.IndexOf ("WriteXml") > 0, "#3");
499 Assert.IsTrue (code.IndexOf ("XmlRootAttribute(ElementName=\"E2\", Namespace=\"urn:bar\"") > 0, "#4");
500 Assert.IsTrue (code.IndexOf ("XmlSchemaProviderAttribute(\"ExportSchema\")") > 0, "#5");
504 [ExpectedException (typeof (InvalidDataContractException))]
505 public void ImportTestX4 ()
507 DoImport ("Test/Resources/Schemas/ns4.xsd");
511 [ExpectedException (typeof (InvalidDataContractException))]
512 public void ImportTestX5 ()
514 DoImport ("Test/Resources/Schemas/ns5.xsd");
518 public void ImportTestX6 ()
520 DoImport ("Test/Resources/Schemas/ns6.xsd",
521 "Test/Resources/Schemas/ns0.xsd");
525 [ExpectedException (typeof (InvalidDataContractException))]
526 public void ImportTestX7 ()
528 DoImport ("Test/Resources/Schemas/ns7.xsd",
529 "Test/Resources/Schemas/ns0.xsd");
533 [ExpectedException (typeof (InvalidDataContractException))]
534 public void ImportTestX8 ()
536 DoImport ("Test/Resources/Schemas/ns8.xsd");
540 [ExpectedException (typeof (InvalidDataContractException))]
541 public void ImportTestX9 ()
543 DoImport ("Test/Resources/Schemas/ns9.xsd");
547 public void ImportTestX10 ()
549 DoImport ("Test/Resources/Schemas/ns10.xsd");
553 [ExpectedException (typeof (InvalidDataContractException))]
554 public void ImportTestX11 ()
556 DoImport ("Test/Resources/Schemas/ns11.xsd");
560 [ExpectedException (typeof (InvalidDataContractException))]
561 public void ImportTestX12 ()
563 DoImport ("Test/Resources/Schemas/ns12.xsd");
567 [ExpectedException (typeof (InvalidDataContractException))]
568 public void ImportTestX13 ()
570 DoImport ("Test/Resources/Schemas/ns13.xsd");
574 public void ImportTestX14 ()
576 DoImport ("Test/Resources/Schemas/ns14.xsd");
580 [ExpectedException (typeof (InvalidDataContractException))]
581 public void ImportTestX15 ()
583 DoImport ("Test/Resources/Schemas/ns15.xsd");
587 public void ImportTestX16 ()
589 DoImport ("Test/Resources/Schemas/ns16.xsd");
593 [ExpectedException (typeof (InvalidDataContractException))]
594 public void ImportTestX17 ()
596 DoImport ("Test/Resources/Schemas/ns17.xsd");
600 public void ImportTestX18 ()
602 DoImport ("Test/Resources/Schemas/ns18.xsd");
606 [ExpectedException (typeof (InvalidDataContractException))]
607 public void ImportTestX19 ()
609 DoImport ("Test/Resources/Schemas/ns19.xsd");
613 [ExpectedException (typeof (InvalidDataContractException))]
614 public void ImportTestX20 ()
616 DoImport ("Test/Resources/Schemas/ns20.xsd");
620 public void ImportTestX21 ()
622 DoImport ("Test/Resources/Schemas/ns21.xsd");
626 public void ImportTestX22 ()
628 DoImport ("Test/Resources/Schemas/ns22.xsd");
632 public void ImportTestX23 ()
634 DoImport ("Test/Resources/Schemas/ns23.xsd");
637 [ExpectedException (typeof (InvalidDataContractException))]
639 public void ImportTestX24 ()
641 DoImport ("Test/Resources/Schemas/ns24.xsd");
645 public void ImportTestX25 ()
647 DoImport ("Test/Resources/Schemas/ns25.xsd");
651 public void ImportTestX26 ()
653 DoImport ("Test/Resources/Schemas/ns26.xsd");
657 public void ImportTestX27 ()
659 DoImport ("Test/Resources/Schemas/ns27.xsd");
663 public void ImportTestX28 ()
665 DoImport ("Test/Resources/Schemas/ns28.xsd");
669 [ExpectedException (typeof (InvalidDataContractException))]
670 public void ImportTestX29 ()
672 DoImport ("Test/Resources/Schemas/ns29.xsd");
676 public void ImportTestX30 ()
678 DoImport ("Test/Resources/Schemas/ns30.xsd");
682 public void ImportTestX31 ()
684 DoImport ("Test/Resources/Schemas/ns31.xsd");
688 public void ImportTestX32 ()
690 DoImport ("Test/Resources/Schemas/ns32.xsd");
694 public void ImportTestX33 ()
696 DoImport ("Test/Resources/Schemas/ns33.xsd");
700 public void ImportTestX34 ()
702 DoImport (true, "Test/Resources/Schemas/ns34.xsd", "Test/Resources/Schemas/ns34_2.xsd");
706 public void CanImportTestX34 ()
708 DoCanImport (false, "Test/Resources/Schemas/ns34.xsd", "Test/Resources/Schemas/ns34_2.xsd");
712 private void CheckDC (CodeTypeDeclaration type, string name, Dictionary<string, string> members, string msg)
715 Assert.AreEqual (name, type.Name, msg + "d");
716 //FIXME: Assert.AreEqual (MemberAttributes.Public, type.Attributes);
717 Assert.IsTrue (type.IsClass, msg + "e");
718 Assert.IsTrue (type.IsPartial, msg + "f");
720 CheckDataContractAttribute (type, msg);
721 CheckExtensionData (type, msg);
723 foreach (KeyValuePair<string, string> pair in members)
724 CheckDataMember (type, pair.Key, pair.Value, true, msg);
727 private void CheckExtensionData (CodeTypeDeclaration type, string msg)
729 CheckDataMember (type, "extensionDataField", "ExtensionData", "System.Runtime.Serialization.ExtensionDataObject", false, msg);
732 private void CheckDataMember (CodeTypeDeclaration type, string name, string type_name, bool check_attr, string msg)
734 CheckDataMember (type, name + "Field", name, type_name, check_attr, msg);
737 private void CheckDataMember (CodeTypeDeclaration type, string field_name, string prop_name, string type_name, bool check_attr, string msg)
740 CodeMemberProperty p = FindMember (type, prop_name) as CodeMemberProperty;
741 Assert.IsNotNull (p, msg + "-dm0");
742 Assert.IsTrue (p.HasGet, msg + "-dm1");
743 Assert.IsTrue (p.HasSet, msg + "-dm2");
744 Assert.AreEqual (type_name, p.Type.BaseType, msg + "-dm3");
746 CodeMemberField f = FindMember (type, field_name) as CodeMemberField;
747 Assert.IsNotNull (f, msg + "-dm4");
748 Assert.AreEqual (type_name, f.Type.BaseType, "-dm5");
751 CheckDataContractAttribute (type, msg);
754 private void CheckDataContractAttribute (CodeTypeDeclaration type, string msg)
756 // DebuggerStepThrouAttribute is insignificant. So, no reason to check the attribute count.
757 // Assert.AreEqual (3, type.CustomAttributes.Count, msg + "a");
759 // DebuggerStepThroughAttribute - skip it
761 //GeneratedCodeAttribute
762 var l = new List<CodeAttributeDeclaration> ();
763 foreach (CodeAttributeDeclaration a in type.CustomAttributes)
765 Assert.IsTrue (l.Any (a => a.Name == "System.CodeDom.Compiler.GeneratedCodeAttribute"), msg + "b");
767 var ca = l.FirstOrDefault (a => a.Name == "System.Runtime.Serialization.DataContractAttribute");
768 Assert.IsNotNull (ca, msg + "b");
769 Assert.AreEqual (2, ca.Arguments.Count, msg + "d");
772 CodeTypeMember FindMember (CodeTypeDeclaration type, string name)
774 foreach (CodeTypeMember m in type.Members)
781 public void ImportXsdBuiltInTypes ()
783 DoImport ("Test/Resources/Schemas/xml.xsd");