protected override void DoEndOfFile() { foreach (KeyValuePair <RecordIndex, MinAndMax> entry in _minAndMaxRecordLength) { RecordIndex index = entry.Key; MinAndMax minAndMaxValue = entry.Value; string minLengthString = minAndMaxValue.GetMin()?.ToString() ?? "<no value>"; string maxLengthString = minAndMaxValue.GetMax()?.ToString() ?? "<no value>"; _testResults.Add(new TestResult(ResultType.Success, AddmlLocation.FromRecordIndex(index), string.Format(Messages.AnalyseFindExtremeRecordsMessage, maxLengthString, minLengthString))); } _minAndMaxRecordLength.Clear(); }
protected override void DoEndOfFile() { foreach (KeyValuePair <FieldIndex, MinAndMax> entry in _minAndMaxValuesPerField) { FieldIndex fieldIndex = entry.Key; MinAndMax minAndMaxValue = entry.Value; string minValueString = minAndMaxValue.GetMin()?.ToString() ?? "<no value>"; string maxValueString = minAndMaxValue.GetMax()?.ToString() ?? "<no value>"; _testResults.Add(new TestResult(ResultType.Success, AddmlLocation.FromFieldIndex(fieldIndex), string.Format(Messages.AnalyseFindMinMaxValuesMessage, minValueString, maxValueString))); } _minAndMaxValuesPerField.Clear(); }
protected override void DoRun(Field field) { int valueLength = field.Value.Length; FieldIndex fieldIndeks = field.Definition.GetIndex(); if (!_minAndMaxLengthPerField.ContainsKey(fieldIndeks)) { _minAndMaxLengthPerField.Add(fieldIndeks, new MinAndMax()); } MinAndMax minAndMaxValue = _minAndMaxLengthPerField[fieldIndeks]; minAndMaxValue.NewValue(valueLength); }
protected override void DoRun(Record record) { string recordValue = record.Value; int recordLength = recordValue.Length; RecordIndex index = record.Definition.GetIndex(); if (!_minAndMaxRecordLength.ContainsKey(index)) { _minAndMaxRecordLength.Add(index, new MinAndMax()); } MinAndMax minAndMaxValue = _minAndMaxRecordLength[index]; minAndMaxValue.NewValue(recordLength); }
protected override void DoRun(Field field) { BigInteger value; if (!BigInteger.TryParse(field.Value, out value)) { return; } FieldIndex fieldIndeks = field.Definition.GetIndex(); if (!_minAndMaxValuesPerField.ContainsKey(fieldIndeks)) { _minAndMaxValuesPerField.Add(fieldIndeks, new MinAndMax()); } MinAndMax minAndMaxValue = _minAndMaxValuesPerField[fieldIndeks]; minAndMaxValue.NewValue(value); }