public void AddResult(CompareBsonDocumentsResult result) { _nbDocumentsCompared++; if (result.Equal) _nbDocumentsEqual++; else _nbDocumentsNotEqual++; switch (result.DocumentsType) { case DocumentsType.Document1AndDocument2AreNotNull: _nbDocument1AndDocument2NotNull++; break; case DocumentsType.Document1AndDocument2AreNull: _nbDocument1AndDocument2Null++; break; case DocumentsType.Document1IsNull: _nbDocument1Null++; break; case DocumentsType.Document2IsNull: _nbDocument2Null++; break; } foreach (ElementResult element in result.Elements) { ElementResultAggregate elementAggregate; if (_elementsAggregate.ContainsKey(element.Name)) elementAggregate = _elementsAggregate[element.Name]; else { elementAggregate = new ElementResultAggregate(); elementAggregate.Name = element.Name; _elementsAggregate.Add(element.Name, elementAggregate); } elementAggregate.NbValues++; if (element.CompareResult == CompareElementResult.Equal) elementAggregate.NbValuesEqual++; else if (element.CompareResult == CompareElementResult.NotEqual) elementAggregate.NbValuesNotEqual++; else if (element.CompareResult == CompareElementResult.OnlyValue1) elementAggregate.NbNoValue2++; else if (element.CompareResult == CompareElementResult.OnlyValue2) elementAggregate.NbNoValue1++; } }
public void AddResult(CompareDocumentResult result, bool keepResult) { _nbDocumentsCompared++; if (result.Equal) { _nbDocumentsEqual++; } else { _nbDocumentsNotEqual++; } switch (result.DocumentsType) { case DocumentsType.Document1AndDocument2AreNotNull: _nbDocument1AndDocument2NotNull++; break; case DocumentsType.Document1AndDocument2AreNull: _nbDocument1AndDocument2Null++; break; case DocumentsType.Document1IsNull: _nbDocument1Null++; break; case DocumentsType.Document2IsNull: _nbDocument2Null++; break; } foreach (ElementResult element in result.Elements) { ElementResultAggregate elementAggregate; if (_elementsAggregate.ContainsKey(element.Name)) { elementAggregate = _elementsAggregate[element.Name]; } else { elementAggregate = new ElementResultAggregate(); elementAggregate.Name = element.Name; _elementsAggregate.Add(element.Name, elementAggregate); } elementAggregate.NbValues++; if (element.CompareResult == CompareElementResult.Equal) { elementAggregate.NbValuesEqual++; } else if (element.CompareResult == CompareElementResult.NotEqual) { elementAggregate.NbValuesNotEqual++; } else if (element.CompareResult == CompareElementResult.OnlyValue1) { elementAggregate.NbNoValue2++; } else if (element.CompareResult == CompareElementResult.OnlyValue2) { elementAggregate.NbNoValue1++; } } if (keepResult) { _compareDocumentResults.Add(result); } }