示例#1
0
        private bool ShouldUpdateSnapshot(object currentSnapshot, object newSnapshot)
        {
            var snapshotsAreEqual = currentSnapshot != null &&
                                    _snapshotComparer.CompareSnapshots(currentSnapshot, newSnapshot);

            if (!snapshotsAreEqual && _snapshotUpdateDecider.ShouldUpdateSnapshot())
            {
                return(true);
            }

            // Create snapshot if it doesn't currently exist and its not a CI env
            if (currentSnapshot == null)
            {
                return(!CiEnvironmentDetector.IsCiEnv());
            }

            return(false);
        }
示例#2
0
        protected SnapResult Snap(SnapshotId snapshotId, object newSnapshot)
        {
            var currentSnapshot   = _snapshotStore.GetSnapshot(snapshotId);
            var areSnapshotsEqual = currentSnapshot != null &&
                                    _snapshotComparer.CompareSnapshots(currentSnapshot, newSnapshot);

            if (!areSnapshotsEqual && _snapshotUpdateDecider.ShouldUpdateSnapshot())
            {
                _snapshotStore.StoreSnapshot(snapshotId, newSnapshot);
                return(SnapResult.SnapshotUpdated(currentSnapshot, newSnapshot));
            }

            if (currentSnapshot == null)
            {
                return(SnapResult.SnapshotDoesNotExist(newSnapshot));
            }

            return(areSnapshotsEqual
                ? SnapResult.SnapshotsMatch(currentSnapshot, newSnapshot)
                : SnapResult.SnapshotsDoNotMatch(currentSnapshot, newSnapshot));
        }