public void XmlTest1()
{
MakeParentTable1();
_dataSet.Tables.Remove(_parentTable1);
using (FileStream stream = new FileStream(_tempFile, FileMode.Create))
{
//Write the XML without any Schema information
_parentTable1.WriteXml(stream);
}
DataTable table = new DataTable();
using (FileStream stream = new FileStream(_tempFile, FileMode.Open))
{
try
{
table.ReadXml(stream);
//Should throw an exception if the Xml
// File has no schema and target table
// too does not define any schema
Assert.False(true);
}
catch (InvalidOperationException ex)
{
Assert.Equal(typeof(InvalidOperationException), ex.GetType());
Assert.Null(ex.InnerException);
Assert.NotNull(ex.Message);
}
}
}