public void TestAcceptChangesOnEntity() { aggTest = new AggregateTest(); aggTest.FirstName = "Mike"; aggTest.AcceptChanges(); Assert.IsFalse(aggTest.es.IsAdded); Assert.IsFalse(aggTest.es.IsDeleted); Assert.IsFalse(aggTest.es.IsModified); Assert.IsFalse(aggTest.es.IsDirty); Assert.IsTrue(aggTest.es.ModifiedColumns.Count == 0); Assert.IsTrue(aggTest.es.RowState == esDataRowState.Unchanged); }
public void TestTrueIsDirtyLogicOnEntity() { aggTest = new AggregateTest(); aggTest.FirstName = "Mike"; aggTest.AcceptChanges(); Assert.IsFalse(aggTest.es.IsAdded); Assert.IsFalse(aggTest.es.IsDeleted); Assert.IsFalse(aggTest.es.IsModified); Assert.IsFalse(aggTest.es.IsDirty); Assert.IsTrue(aggTest.es.ModifiedColumns.Count == 0); Assert.IsTrue(aggTest.es.RowState == esDataRowState.Unchanged); // Let's change it aggTest.FirstName = "Joe"; Assert.IsFalse(aggTest.es.IsAdded); Assert.IsFalse(aggTest.es.IsDeleted); Assert.IsTrue(aggTest.es.IsModified); Assert.IsTrue(aggTest.es.IsDirty); Assert.IsTrue(aggTest.es.ModifiedColumns.Count == 1); Assert.IsTrue(aggTest.es.RowState == esDataRowState.Modified); // Now let's set it back to it's original value aggTest.FirstName = "Mike"; Assert.IsFalse(aggTest.es.IsAdded); Assert.IsFalse(aggTest.es.IsDeleted); Assert.IsFalse(aggTest.es.IsModified); Assert.IsFalse(aggTest.es.IsDirty); Assert.IsTrue(aggTest.es.ModifiedColumns.Count == 0); Assert.IsTrue(aggTest.es.RowState == esDataRowState.Unchanged); // Let's change it again, notice we are no longer dirty now aggTest.FirstName = "Joe"; Assert.IsFalse(aggTest.es.IsAdded); Assert.IsFalse(aggTest.es.IsDeleted); Assert.IsTrue(aggTest.es.IsModified); Assert.IsTrue(aggTest.es.IsDirty); Assert.IsTrue(aggTest.es.ModifiedColumns.Count == 1); Assert.IsTrue(aggTest.es.RowState == esDataRowState.Modified); }