예제 #1
0
        public void CanRemove()
        {
            DataRelationCollection drcol     = _dataset.Relations;
            DataColumn             parentCol = _dataset.Tables["Customer"].Columns["custid"];
            DataColumn             childCol  = _dataset.Tables["Order"].Columns["custid"];
            DataRelation           dr        = new DataRelation("CustOrder", parentCol, childCol);

            drcol.Add(dr);
            Assert.True(drcol.CanRemove(dr));
            Assert.False(drcol.CanRemove(null));
            DataRelation dr2 = new DataRelation("ItemOrder"
                                                , _dataset.Tables["Item"].Columns["itemid"]
                                                , _dataset.Tables["Order"].Columns["custid"]);

            Assert.False(drcol.CanRemove(dr2));
        }