示例#1
0
        public void DmTable_GetChanges()
        {
            tbl.AcceptChanges();

            tbl.Rows[0]["CustomerID"] = 100;
            tbl.Rows[1]["Title"]      = "trololoo";
            tbl.Rows[4].SetAdded();
            tbl.Rows[5].SetModified();
            tbl.Rows[6].Delete();

            var changes = tbl.GetChanges();

            Assert.NotSame(tbl, changes);
            Assert.Equal(5, changes.Rows.Count);

            var changes2 = tbl.GetChanges(DmRowState.Added);

            Assert.NotSame(tbl, changes2);
            Assert.Single(changes2.Rows);

            var changes3 = tbl.GetChanges(DmRowState.Added | DmRowState.Modified);

            Assert.NotSame(tbl, changes3);
            Assert.Equal(4, changes3.Rows.Count);

            var changes4 = tbl.GetChanges(DmRowState.Deleted);

            Assert.NotSame(tbl, changes4);
            Assert.Single(changes4.Rows);
        }