Exemple #1
0
 public void ReportChanges(string before, string after, Output output, ChangeReportOptions changeReportOptions = ChangeReportOptions.Default)
 {
     lock (_lock)
     {
         ConfigureCollection();
         _collection.ReportChanges(before, after, output, changeReportOptions);
     }
 }
Exemple #2
0
        public void ReportChanges(string beforeSnapshot, string afterSnapshot, Output output, ChangeReportOptions compareOptions = ChangeReportOptions.Default)
        {
            if (!_snapshots.TryGetValue(beforeSnapshot, out var before))
            {
                throw new SnapshotNotFoundException(beforeSnapshot);
            }

            if (!_snapshots.TryGetValue(afterSnapshot, out var after))
            {
                throw new SnapshotNotFoundException(afterSnapshot);
            }

            SnapshotComparer.ReportDifferences(this, before, after, output, compareOptions);
        }
Exemple #3
0
        private static void ReportDifferences(ReportParameters <RowDifference> rep, SnapshotTableDifferences tableDifferences, Output output, ChangeReportOptions changeReportOptions)
        {
            var differenceCols
                = tableDifferences.RowDifferences
                  .Where(r => r.Differences?.Differences != null)
                  .SelectMany(r => r.Differences.Differences.Select(d => d.Name)).Distinct();

            var allCols = tableDifferences.TableDefinition.Columns.Where(c => differenceCols.Contains(c.Name)).Select(c => c.Name);

            rep.Title(tableDifferences.TableDefinition.TableName);
            rep.RemoveBufferLimit();

            rep.AddColumn(rd => rd.DifferenceType.ToString(), cc => cc.Heading("Difference"));

            foreach (var col in allCols)
            {
                rep.AddColumn(rep.Lambda(rd => DifferenceDisplay(rd, col)), cc => cc.Heading(col));
            }
        }
Exemple #4
0
        internal static SnapshotDifferences ExtractDifferences(SnapshotCollection collection, Snapshot before, Snapshot after, ChangeReportOptions changeReportOptions = ChangeReportOptions.Default)
        {
            var tableDiffs = SnapshotDifferenceCalculator.GetDifferences(collection, before, after);

            tableDiffs = SnapshotDifferenceSorter.SortDifferences(collection, tableDiffs);
            tableDiffs = DifferenceRegulator.CleanDifferences(collection, tableDiffs, before, (changeReportOptions & ChangeReportOptions.NoSubs) == 0);
            return(new SnapshotDifferences(tableDiffs));
        }
Exemple #5
0
        internal static void ReportDifferences(SnapshotCollection collection, Snapshot before, Snapshot after, Output output, ChangeReportOptions changeReportOptions = ChangeReportOptions.Default)
        {
            var differences = SnapshotDifferenceAnalyser.ExtractDifferences(collection, before, after, changeReportOptions);
            var first       = true;

            foreach (var tableDifference in differences.TableDifferences)
            {
                var report = tableDifference.RowDifferences.AsReport(rep => ReportDifferences(rep, tableDifference, output, changeReportOptions));
                if (!first)
                {
                    output.WriteLine();
                }

                output.FormatTable(report);
                first = false;
            }

            if ((changeReportOptions & ChangeReportOptions.ReportDateDiagnostics) != 0)
            {
                output.WriteLine();
                DateDiagnosticReporter.Report(output, TimeRangeExtractor.Extract(collection), before, after, differences);
            }
        }