private static List <FieldDifference> SubstitutedDifferences(TableDefinition table, RowDataCompareResult rowDifferences, List <SubstituteValues> substituteValues)
 {
     return(rowDifferences.Differences.Select(fd => SubstituteField(table, fd, substituteValues)).ToList());
 }
 private static SubstituteValues GetColumnSubstitutions(TableDefinition table, FieldDifference fieldDifference, List <SubstituteValues> substituteValues)
 {
     return(substituteValues.SingleOrDefault(sv => sv.ColumnValueSet.Table.TableName == table.TableName &&
                                             sv.ColumnValueSet.Column.Name == fieldDifference.Name));
 }
Exemplo n.º 3
0
        public static List <SnapshotTableDifferences> RequireColumns(SnapshotCollection collection, List <SnapshotTableDifferences> diffs, TableDefinition table, IEnumerable <string> requiredColumns, Snapshot before)
        {
            var result     = new List <SnapshotTableDifferences>();
            var columnList = requiredColumns.ToList();

            foreach (var differences in diffs)
            {
                if (differences.TableDefinition.TableName == table.TableName)
                {
                    var rowDiffs = differences.RowDifferences.Select(r => RequireColumns(r, columnList)).ToList();
                    var newDiffs = new SnapshotTableDifferences(rowDiffs, differences.TableDefinition);
                    result.Add(newDiffs);
                }
                else
                {
                    result.Add(differences);
                }
            }

            return(result);
        }
        private static RowDifference SubstituteRowDiffs(TableDefinition table, RowDifference row, List <SubstituteValues> substituteValues)
        {
            var compareResult = new RowDataCompareResult(row.Differences.Matched, SubstitutedDifferences(table, row.Differences, substituteValues), row.Before, row.After);

            return(new RowDifference(row.Key, compareResult, row.DifferenceType));
        }
Exemplo n.º 5
0
 internal TableDefiner(TableDefinition tableDefinition)
 {
     _tableDefinition = tableDefinition;
 }
 public SnapshotTableDifferences(IList <RowDifference> rowDiffs, TableDefinition tableDefinition)
 {
     TableDefinition = tableDefinition;
     RowDifferences  = new ReadOnlyCollection <RowDifference>(rowDiffs);
 }
Exemplo n.º 7
0
 private static void MergeReferences(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     foreach (var reference in main.References.Concat(changes.References))
     {
         tableDefinition.SetReference(reference.OurField, reference.TargetTable, reference.TargetField);
     }
 }
 internal static void Report(TableDefinition tableDefinition, Output output)
 {
     Report(new [] { tableDefinition }, output);
 }
Exemplo n.º 9
0
 private static void GetUnpredictableFields(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     foreach (var required in main.Unpredictable.Concat(changes.Unpredictable).Distinct().Except(changes.Predictable))
     {
         tableDefinition.SetUnpredictable(required);
     }
 }
Exemplo n.º 10
0
 private static void GetRequiredFields(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     foreach (var required in main.RequiredColumns.Concat(changes.RequiredColumns))
     {
         tableDefinition.SetRequired(required);
     }
 }
Exemplo n.º 11
0
 private static void GetExclusion(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     if (changes.IncludeInComparison)
     {
         tableDefinition.IncludeInComparison = true;
     }
     else if (changes.ExcludeFromComparison)
     {
         tableDefinition.ExcludeFromComparison = true;
     }
     else
     {
         tableDefinition.IncludeInComparison   = main.IncludeInComparison;
         tableDefinition.ExcludeFromComparison = main.ExcludeFromComparison;
     }
 }
Exemplo n.º 12
0
 private static void GetDateKinds(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     foreach (var dateField in main.LocalDates.Concat(main.UtcDates).Concat(changes.LocalDates).Concat(changes.UtcDates).Distinct())
     {
         if (changes.LocalDates.Contains(dateField))
         {
             tableDefinition.SetDateType(dateField, DateTimeKind.Local);
         }
         else if (changes.UtcDates.Contains(dateField))
         {
             tableDefinition.SetDateType(dateField, DateTimeKind.Utc);
         }
         else if (main.LocalDates.Contains(dateField))
         {
             tableDefinition.SetDateType(dateField, DateTimeKind.Local);
         }
         else if (main.UtcDates.Contains(dateField))
         {
             tableDefinition.SetDateType(dateField, DateTimeKind.Utc);
         }
     }
 }
Exemplo n.º 13
0
 private static void GetExcludedFields(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
 {
     foreach (var fieldName in main.ExcludedColumns.Concat(changes.ExcludedColumns).Except(changes.IncludedColumns))
     {
         tableDefinition.ExcludeColumnFromComparison(fieldName);
     }
 }
Exemplo n.º 14
0
        private static void GetSortFields(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
        {
            var source = changes.SortColumns.Any() ? changes : main;

            foreach (var sortField in source.SortColumns)
            {
                tableDefinition.SetSortColumn(sortField.Field, sortField.SortOrder, sortField.SortIndex);
            }
        }
Exemplo n.º 15
0
        private static void GetCompareKey(TableDefinition main, TableDefinition changes, TableDefinition tableDefinition)
        {
            var source = changes.CompareKeys.Any() ? changes : main;

            foreach (var key in source.CompareKeys)
            {
                tableDefinition.SetCompareKey(key);
            }
        }