public void ShouldLeaveDetachedEntityDetached() { var detector = new TestEntityChangeDetector(); EntityChangeTracker <TestEntity> tracker = new EntityChangeTracker <TestEntity>(detector); TestEntity entity = new TestEntity(); // Do not attach the entit, so Detach does nothing Assert.IsFalse(tracker.Detach(entity), "Should not be indicating the item was detached."); var change = tracker.DetectChanges(entity); Assert.AreEqual(EntityState.Detached, change.State, "Detaching a Detached entity should leave it Detached."); }
public void ShouldDetachUnmodifiedEntity() { var detector = new TestEntityChangeDetector(); EntityChangeTracker <TestEntity> tracker = new EntityChangeTracker <TestEntity>(detector); TestEntity entity = new TestEntity(); tracker.Attach(entity); tracker.Detach(entity); var change = tracker.DetectChanges(entity); Assert.AreEqual(EntityState.Detached, change.State, "Detaching an Unmodified entity should make it Detached."); }