public void ReadConstraints()
{
const string Schema =
@"<?xml version=""1.0"" encoding=""utf-8""?>
<xs:schema id=""NewDataSet"" xmlns="""" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:msdata=""urn:schemas-microsoft-com:xml-msdata"">
<xs:element name=""NewDataSet"" msdata:IsDataSet=""true"" msdata:Locale=""en-US"">
<xs:complexType>
<xs:choice maxOccurs=""unbounded"">
<xs:element name=""Table1"">
<xs:complexType>
<xs:sequence>
<xs:element name=""col1"" type=""xs:int"" minOccurs=""0"" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=""Table2"">
<xs:complexType>
<xs:sequence>
<xs:element name=""col1"" type=""xs:int"" minOccurs=""0"" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name=""Constraint1"">
<xs:selector xpath="".//Table1"" />
<xs:field xpath=""col1"" />
</xs:unique>
<xs:keyref name=""fk1"" refer=""Constraint1"" msdata:ConstraintOnly=""true"">
<xs:selector xpath="".//Table2"" />
<xs:field xpath=""col1"" />
</xs:keyref>
</xs:element>
</xs:schema>";
var ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables.Add(new DataTable());
ds.Tables[0].ReadXmlSchema(new StringReader(Schema));
ds.Tables[1].ReadXmlSchema(new StringReader(Schema));
Assert.Equal(0, ds.Relations.Count);
Assert.Equal(1, ds.Tables[0].Constraints.Count);
Assert.Equal(0, ds.Tables[1].Constraints.Count);
Assert.Equal("Constraint1", ds.Tables[0].Constraints[0].ConstraintName);
}
}