title: TDD on C# with Auto-Fixture how to populate big objects with schema validations
body: <p>i m making some tests on my project and using Fixture to populate big objects.
  Those objects make part of an XML that has an schema.</p>
  
  <pre><code>//silly objects 
  Fixture fixture = new Fixture();
  
  boleto = fixture.Create&lt;Boleto&gt;();
  agencia = fixture.Create&lt;Agencia&gt;();
  pasajero = fixture.Create&lt;Pasajero&gt;();
  aerolinea = fixture.Create&lt;Aerolinea&gt;();
  
  //xml build
  XmlMySuite objXmlMySuite = new XmlMySuite();
  
  string strXML = objXmlMySuite.buildXML(aerolinea, pasajero, agencia);
  
  
  //xml validation
  XmlSchemaSet xmlSchema = new XmlSchemaSet();
  xmlSchema .Add("schema.xsd");
  
  bool errors = false;
  
  Console.WriteLine("Attempting to validate");
  XDocument custOrdDoc = XDocument.Load(new XmlTextReader(new System.IO.StringReader(strXML)));
  custOrdDoc.Validate(xmlSchema , (o, e) =&gt;
  {
      Console.WriteLine("{0}", e.Message);
      errors = true;
  });
  Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated");
  Console.WriteLine();
  
  Assert.IsFalse(errors);
  </code></pre>
  
  <p>Is there any way to fill/populate the objects with Fixture validating that schema?</p>
  
  <p>For example, one of the elements tag of the XML Schema is:</p>
  
  <pre><code>&lt;xs:element name="Type"&gt;
      &lt;xs:simpleType&gt;
          &lt;xs:restriction base="xs:token"&gt;
              &lt;xs:enumeration value="CCC"/&gt;
              &lt;xs:enumeration value="AAA"/&gt;
              &lt;xs:enumeration value="BBB"/&gt;
              &lt;xs:enumeration value="QQQQ"/&gt;
          &lt;/xs:restriction&gt;
      &lt;/xs:simpleType&gt;
  &lt;/xs:element&gt;
  </code></pre>