public void ShouldNotDetectAddedAfterCommitting()
        {
            var detector = new TestEntityChangeDetector();
            EntityChangeTracker <TestEntity> tracker = new EntityChangeTracker <TestEntity>(detector);

            TestEntity entity = new TestEntity();

            tracker.Add(entity);

            tracker.CommitChanges();
            var change = tracker.DetectChanges(entity);

            Assert.AreEqual(EntityState.Unmodified, change.State, "The entity should be Unmodified after committing.");
        }
        public void ShouldMarkRemovedAsDetachedAfterCommitting()
        {
            var detector = new TestEntityChangeDetector();
            EntityChangeTracker <TestEntity> tracker = new EntityChangeTracker <TestEntity>(detector);

            TestEntity entity = new TestEntity();

            tracker.Attach(entity);
            tracker.Remove(entity);

            tracker.CommitChanges();
            var change = tracker.DetectChanges(entity);

            Assert.AreEqual(EntityState.Detached, change.State, "The entity should be Detached after committing.");
        }
        public void ShouldNotDetectChangesAfterCommitting()
        {
            var detector = new TestEntityChangeDetector();
            EntityChangeTracker <TestEntity> tracker = new EntityChangeTracker <TestEntity>(detector);

            TestEntity entity = new TestEntity()
            {
                IntValue = 1234
            };

            tracker.Attach(entity);
            entity.IntValue = 234;  // Should make the entity Modified

            tracker.CommitChanges();
            var change = tracker.DetectChanges(entity);

            Assert.AreEqual(EntityState.Unmodified, change.State, "The entity should be Unmodified after committing.");
        }