예제 #1
0
        public void ComputeChanges_SetsAllEntriesToUnmodified()
        {
            //Arrange
            ChangeTracker ct    = new ChangeTracker();
            var           phot  = GetPhotographer();
            var           phot2 = GetPhotographer();
            var           phot3 = GetPhotographer();
            var           phot4 = GetPhotographer();

            ct.Insert(phot);
            ct.Track(phot2);
            ct.Track(phot3);
            ct.Insert(phot4);
            ct.Delete(phot2);
            phot3.Name = "OtherName";

            //Act
            var changes = ct.DetectChanges();

            ct.ComputeChanges();
            var changes2 = ct.DetectChanges();

            //Assert
            Assert.Equal(4, changes.Count);
            Assert.Empty(changes2);

            //Cleanup
            ct.Clear();
        }
예제 #2
0
        public void Delete_DetectsChangesAsDeleted()
        {
            //Arrange
            ChangeTracker ct   = new ChangeTracker();
            var           phot = GetPhotographer();

            ct.Insert(phot);
            ct.DetectChanges();
            ct.ComputeChanges();

            //Act
            ct.Delete(phot);
            var changes = ct.DetectChanges();

            //Assert
            Assert.Single(changes);
            Assert.Equal(ChangeTrackerEntry.States.Deleted, changes[0].State);

            //Cleanup
            ct.Clear();
        }