예제 #1
0
        /// <summary>
        /// Combines the content of the current SnapshotDifference with the one given.
        /// </summary>
        /// <param name="difference">SnapshotDifference to combine with</param>
        /// <returns>SnapshotDifference with data combined.</returns>
        public SnapshotDifference CombineWith(SnapshotDifference difference)
        {
            var existingKeys = new HashSet <DeserializerKey>(_missingItems.Select(item => item.Key));
            var result       = new List <MissingDeserializerInfo>(_missingItems);

            result.AddRange(difference._missingItems.Where(item => !existingKeys.Contains(item.Key)));
            return(new SnapshotDifference(result));
        }
예제 #2
0
        /// <summary>
        /// Compares the snapshot (considered as actual) to the given base snapshots and returns the differences as a <see cref="SnapshotDifference"/>.
        /// </summary>
        /// <param name="snapshots">The list of base snapshots.</param>
        /// <returns>The difference between the snapshots.</returns>
        public SnapshotDifference CompareToBase(IEnumerable <Snapshot> snapshots)
        {
            SnapshotDifference result = SnapshotDifference.Empty;

            foreach (Snapshot snapshot in snapshots.OrderByDescending(item => item.TakenDate))
            {
                result = result.CombineWith(CompareToBase(snapshot));
            }

            return(result);
        }