public void InferXmlSchema_inferringColumns2()
{
//ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconinferringcolumns.htm
//If an element has no child elements or attributes, it will be inferred as a column.
//The ColumnMapping property of the column will be set to MappingType.Element.
//The text for child elements is stored in a row in the table
// inferringColumns2
StringBuilder sb = new StringBuilder();
sb.Append("<DocumentElement>");
sb.Append("<Element1>");
sb.Append("<ChildElement1>Text1</ChildElement1>");
sb.Append("<ChildElement2>Text2</ChildElement2>");
sb.Append("</Element1>");
sb.Append("</DocumentElement>");
var ds = new DataSet();
MemoryStream myStream = new MemoryStream(new ASCIIEncoding().GetBytes(sb.ToString()));
ds.InferXmlSchema(myStream, null);
Assert.Equal("DocumentElement", ds.DataSetName);
Assert.Equal("Element1", ds.Tables[0].TableName);
Assert.Equal(1, ds.Tables.Count);
Assert.Equal("ChildElement1", ds.Tables[0].Columns["ChildElement1"].ColumnName);
Assert.Equal("ChildElement2", ds.Tables[0].Columns["ChildElement2"].ColumnName);
Assert.Equal(MappingType.Element, ds.Tables[0].Columns["ChildElement1"].ColumnMapping);
Assert.Equal(MappingType.Element, ds.Tables[0].Columns["ChildElement2"].ColumnMapping);
Assert.Equal(typeof(string), ds.Tables[0].Columns["ChildElement1"].DataType);
Assert.Equal(typeof(string), ds.Tables[0].Columns["ChildElement2"].DataType);
}