diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2004-04-13 06:25:56 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2004-04-13 06:25:56 +0400 |
commit | 00ae95648a3cd2198c4215079e5da9046d982bab (patch) | |
tree | a516a4262133b6c680d57efba2586365870b9c88 /mcs/class | |
parent | 6b5e609d9148cac042a7822f676d57680a3e6795 (diff) |
2004-04-13 Atsushi Enomoto <atsushi@ximian.com>
* Added XmlDataDocumentTest2.cs (XmlDataDocumentTest.cs is too big)
svn path=/trunk/mcs/; revision=25377
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/System.Data/Test/System.Xml/ChangeLog | 4 | ||||
-rwxr-xr-x | mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest2.cs | 75 |
2 files changed, 79 insertions, 0 deletions
diff --git a/mcs/class/System.Data/Test/System.Xml/ChangeLog b/mcs/class/System.Data/Test/System.Xml/ChangeLog index ce66738a746..fe9777ec48f 100644 --- a/mcs/class/System.Data/Test/System.Xml/ChangeLog +++ b/mcs/class/System.Data/Test/System.Xml/ChangeLog @@ -1,3 +1,7 @@ +2004-04-13 Atsushi Enomoto <atsushi@ximian.com> + + * Added XmlDataDocumentTest2.cs (XmlDataDocumentTest.cs is too big) + 2004-03-18 Atsushi Enomoto <atsushi@ximian.com> * XmlDataDocumentTest.cs : file path fixes. diff --git a/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest2.cs b/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest2.cs new file mode 100755 index 00000000000..641cc6d5d63 --- /dev/null +++ b/mcs/class/System.Data/Test/System.Xml/XmlDataDocumentTest2.cs @@ -0,0 +1,75 @@ +// +// XmlDataDocumentTest2.cs +// +// Author: +// Atsushi Enomoto <atsushi@ximian.com> +// +// (C)2004 Novell Inc. +// +using System; +using System.Data; +using System.Xml; +using NUnit.Framework; + +namespace MonoTests.System.Xml +{ + [TestFixture] + public class XmlDataDocumentTest2 : Assertion + { + string xml = "<NewDataSet><table><row><col1>1</col1><col2>2</col2></row></table></NewDataSet>"; + + [Test] + [ExpectedException (typeof (ArgumentException))] + public void TestCtorNullArgs () + { + new XmlDataDocument (null); + } + + [Test] + public void TestDefaultCtor () + { + XmlDataDocument doc = new XmlDataDocument (); + AssertNotNull (doc.DataSet); + AssertEquals ("NewDataSet", doc.DataSet.DataSetName); + } + + [Test] + [ExpectedException (typeof (InvalidOperationException))] + public void TestMultipleLoadError () + { + DataSet ds = new DataSet (); + ds.ReadXml (new XmlTextReader (xml, XmlNodeType.Document, null)); + // If there is already data element, Load() fails. + XmlDataDocument doc = new XmlDataDocument (ds); + doc.LoadXml (xml); + } + + [Test] + public void TestMultipleLoadNoError () + { + DataSet ds = new DataSet (); + DataTable dt = new DataTable (); + dt.Columns.Add ("col1"); + ds.Tables.Add (dt); + + XmlDataDocument doc = new XmlDataDocument (ds); + doc.LoadXml (xml); + } + + [Test] + [ExpectedException (typeof (ArgumentException))] + public void TestMultipleDataDocFromDataSet () + { + DataSet ds = new DataSet (); + XmlDataDocument doc = new XmlDataDocument (ds); + XmlDataDocument doc2 = new XmlDataDocument (ds); + } + + [Test] + public void TestLoadXml () + { + XmlDataDocument doc = new XmlDataDocument (); + doc.LoadXml ("<NewDataSet><TestTable><TestRow><TestColumn>1</TestColumn></TestRow></TestTable></NewDataSet>"); + } + } +} |