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 DoEndOfFile() { foreach (KeyValuePair <FieldIndex, MinAndMax> entry in _minAndMaxLengthPerField) { FieldIndex fieldIndex = 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.FromFieldIndex(fieldIndex), string.Format(Messages.AnalyseFindExtremeValuesMessage, maxLengthString, minLengthString))); } _minAndMaxLengthPerField.Clear(); }
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); }