public void AddCollectionChangedItem_Prevents_Unneccessary_Changes(CollectionChangeType changeType)
        {
            // arrange
            var entity = TestHelper.CreateEntityWithId <Artist>(1);
            var propertyChangeTracker = new PropertyChangeTracker(entity);
            var oppositeChangeType    = changeType == CollectionChangeType.Added ? CollectionChangeType.Removed : CollectionChangeType.Added;
            var statisticValue        = new ArtistStatisticValues();

            // act
            propertyChangeTracker.AddCollectionChangedItem(new CollectionChangedItem("StatisticValues", statisticValue, changeType));
            propertyChangeTracker.AddCollectionChangedItem(new CollectionChangedItem("StatisticValues", statisticValue, oppositeChangeType));

            // assert
            Assert.False(propertyChangeTracker.HasChanged <Artist>(x => x.StatisticValues));
        }
        public void AddCollectionChangedItem_Adds_ChangedItem(CollectionChangeType changeType)
        {
            // arrange
            var entity = TestHelper.CreateEntityWithId <Artist>(1);
            var propertyChangeTracker = new PropertyChangeTracker(entity);

            // act
            propertyChangeTracker.AddCollectionChangedItem(new CollectionChangedItem("StatisticValues", null, changeType));

            // assert
            Assert.True(propertyChangeTracker.HasChanged <Artist>(x => x.StatisticValues));
        }
        public void AddCollectionChangedItem_Does_Nothing_When_Tracking_Is_Disabled(bool disableChangeTracking)
        {
            // arrange
            var entity = TestHelper.CreateEntityWithId <Artist>(1);
            var propertyChangeTracker = new PropertyChangeTracker(entity)
            {
                DisableChangeTracking = disableChangeTracking
            };

            // act
            propertyChangeTracker.AddCollectionChangedItem(new CollectionChangedItem("StatisticValues", null, CollectionChangeType.Added));

            // assert
            Assert.Equal(!disableChangeTracking, propertyChangeTracker.HasChanged <Artist>(x => x.StatisticValues));
        }