System.Data.Tests.DataTableTest4.XmlTest3 C# (CSharp) Метод

XmlTest3() приватный Метод

private XmlTest3 ( ) : void
Результат void
        public void XmlTest3()
        {
            //Make a table without any Relations
            MakeParentTable1();
            _dataSet.Tables.Remove(_parentTable1);

            using (FileStream stream = new FileStream(_tempFile, FileMode.Create))
            {
                //Write the Xml and the Schema
                _parentTable1.WriteXml(stream, XmlWriteMode.WriteSchema);
            }

            DataTable table = new DataTable();
            _dataSet.Tables.Add(table);

            //Read the Xml and the Schema into a table which already belongs to a DataSet
            //and the table name does not match with the table ion the source XML 
            try
            {
                table.ReadXml(_tempFile);
                Assert.False(true);
            }
            catch (ArgumentException ex)
            {
                // DataTable 'Table1' does not match to any
                // DataTable in source
                Assert.Equal(typeof(ArgumentException), ex.GetType());
                Assert.Null(ex.InnerException);
                Assert.NotNull(ex.Message);
                Assert.True(ex.Message.IndexOf("'Table1'") != -1);
                Assert.Null(ex.ParamName);
            }
        }