private DataMatch MatchValue(IDataVisitNode node1, object value1, IDataVisitNode node2, object value2) { // Match null vs non null and types if (value1 == null || value2 == null || value1.GetType() != value2.GetType()) { return(ReferenceEquals(value1, value2) ? DataMatch.MatchOne : UnMatched(node1, node2)); } // Match value (only for value types) // Matching of members is done in Match(DataVisitNode, DataVisitNode) var type = descriptorFactory.Find(value1.GetType()); if (DataVisitNode.IsComparableOnlyType(value1, type)) { return(Equals(value1, value2) ? DataMatch.MatchOne : UnMatched(node1, node2)); } // Empty match return(DataMatch.Empty); }
private static DataMatch UnMatched(IDataVisitNode node1, IDataVisitNode node2) { return(new DataMatch(0, Math.Max(node1 != null ? node1.CountNodes() : 0, node2 != null ? node2.CountNodes() : 0))); }