public IEnumerable <JsonObjectDto> IntersectChangedValues(CompareJsonObjects compareObjects)
        {
            var jsonA         = compareObjects.JsonA;
            var jsonB         = compareObjects.JsonB;
            var changedValues = new Dictionary <JsonPkDto, JsonValueDto>();

            foreach (var a in jsonA)
            {
                //if have same keys and different values
                if (jsonB.ContainsKey(a.Key) && !a.Value.Equals(jsonB[a.Key]))
                {
                    var mergedValue = a.Value.Merge(jsonB[a.Key]);
                    if (mergedValue.HasValue())
                    {
                        changedValues.Add(a.Key, mergedValue);
                    }
                }
            }
            var jsonObjects = changedValues.Select(c => new JsonObjectDto
            {
                PrimaryKey = c.Key,
                Values     = c.Value
            });

            return(jsonObjects);
        }
        public ComparePkDto IntersectPrimaryKeys(CompareJsonObjects compareObjects)
        {
            var jsonA = compareObjects.JsonA;
            var jsonB = compareObjects.JsonB;

            var compPk = new ComparePkDto();

            foreach (var a in jsonA)
            {
                if (!jsonB.ContainsKey(a.Key))
                {
                    compPk.JsonAPrimaryKeys.Add(a.Key);
                }
            }

            foreach (var b in jsonB)
            {
                if (!jsonA.ContainsKey(b.Key))
                {
                    compPk.JsonBPrimaryKeys.Add(b.Key);
                }
            }

            return(compPk);
        }
        public bool TryParseJsonFiles(string fileA, string fileB, out CompareJsonObjects compareObjects)
        {
            var serializer = new JsonSerializer();

            try
            {
                compareObjects = new CompareJsonObjects
                {
                    JsonA = DeserializeFile(fileA, serializer),
                    JsonB = DeserializeFile(fileB, serializer)
                };

                return(true);
            } catch
            {
                compareObjects = null;
                return(false);
            }
        }
 public Dictionary <PrimaryKeyDto, ValueDto> IntersectByPrimaryKey(CompareJsonObjects compareObjects, bool shouldLeaveOnlyChangedValues)
 {
     throw new NotImplementedException();
 }
 public CompareJsonObjects ExceptIntersect(CompareJsonObjects compareObjects)
 {
     throw new NotImplementedException();
 }