[Mono-bugs] [Bug 650391] DataSet.Clone doesn't clone some DataRelation and DataColumn properties

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Dec 25 08:14:40 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=650391

https://bugzilla.novell.com/show_bug.cgi?id=650391#c2


--- Comment #2 from Clinton Volzke <cvolzke at live.com.au> 2010-12-25 13:14:39 UTC ---
    [TestFixture]
    public class DataSetTests
    {
        DataSet data;
        DataRelation relation;

        [Setup]
        public void Setup()
        {
            base.SetupCore();
            data = new DataSet();

            DataTable parentTable = data.Tables.Add("parent");
            DataTable childTable = data.Tables.Add("child");
            DataColumn parentColumn = parentTable.Columns.Add("parent");
            DataColumn childColumn = childTable.Columns.Add("child");
            parentTable.PrimaryKey = new[] { parentColumn };

            relation = new DataRelation("relation", parentColumn, childColumn);
            data.Relations.Add(relation);
        }

        [Test]
        public void Test_DataRelation_Clone_ChildKeyConstraint()
        {
            DataSet clonedData = data.Clone();
            DataRelation clonedRelation = clonedData.Relations["relation"];
            AssertEquals(relation.ChildKeyConstraint.ConstraintName,
clonedRelation.ChildKeyConstraint.ConstraintName, "ChildKeyConstraint cloned");
        }

        [Test]
        public void Test_DataRelation_Clone_Nested()
        {
            relation.Nested = true;
            DataSet clonedData = data.Clone();
            DataRelation clonedRelation = clonedData.Relations["relation"];
            AssertEquals(relation.Nested, clonedRelation.Nested, "Nested
cloned");
        }

        [Test]
        public void Test_DataRelation_Clone_ExtendedProperties()
        {
            relation.ExtendedProperties["key"] = "value";
            DataSet clonedData = data.Clone();
            DataRelation clonedRelation = clonedData.Relations["relation"];
            AssertEquals(relation.ExtendedProperties["key"],
clonedRelation.ExtendedProperties["key"], "ExtendedProperties cloned");
        }

        [Test]
        public void Test_DataColumn_Clone_ExtendedProperties()
        {
            DataSet data = new DataSet();
            DataTable table = data.Tables.Add("table");
            DataColumn column = table.Columns.Add("column");

            column.ExtendedProperties["key"] = "value";
            DataSet clonedData = data.Clone();
            DataColumn clonedColumn =
clonedData.Tables["table"].Columns["column"];
            AssertEquals(column.ExtendedProperties["key"],
clonedColumn.ExtendedProperties["key"], "ExtendedProperties cloned");
        }
    }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list