コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        protected override void DoEndOfFile()
        {
            foreach (KeyValuePair <RecordIndex, bool> entry in _recordDefinitionsInUse)
            {
                RecordIndex index   = entry.Key;
                bool        isInUse = entry.Value;

                if (!isInUse)
                {
                    _testResults.Add(new TestResult(ResultType.Error, AddmlLocation.FromRecordIndex(entry.Key),
                                                    Messages.ControlNotUsedRecordDefMessage));
                }
            }

            _recordDefinitionsInUse.Clear();
        }
コード例 #4
0
        protected override void DoEndOfFile()
        {
            foreach (KeyValuePair <FieldIndex, HashSet <string> > entry in _valuesPerField)
            {
                FieldIndex       fieldIndex  = entry.Key;
                HashSet <string> fieldValues = entry.Value;

                if (fieldValues != null)
                {
                    _testResults.Add(new TestResult(ResultType.Success, AddmlLocation.FromFieldIndex(fieldIndex),
                                                    string.Format(Messages.ControlUniquenessMessage1)));
                }
            }

            _valuesPerField.Clear();
        }
コード例 #5
0
        protected override void DoEndOfFile()
        {
            foreach (KeyValuePair <FieldIndex, FrequencyList> entry in _frequenceListPerField)
            {
                FieldIndex    index         = entry.Key;
                FrequencyList frequencyList = entry.Value;

                foreach (KeyValuePair <string, BigInteger> e in frequencyList.Get())
                {
                    string     word  = e.Key;
                    BigInteger count = e.Value;

                    _testResults.Add(new TestResult(ResultType.Success, AddmlLocation.FromFieldIndex(index),
                                                    string.Format(Messages.AnalyseAllFrequenceListMessage, count, word)));
                }
            }

            _frequenceListPerField.Clear();
        }
コード例 #6
0
ファイル: ControlFixedLength.cs プロジェクト: halsov/arkade5
        protected override void DoRun(Record record)
        {
            int?specifiedLength = record.Definition.RecordLength;

            if (!specifiedLength.HasValue)
            {
                return;
            }

            var actualLength = record.Value.Length;

            if (actualLength == specifiedLength)
            {
                return;
            }

            // actual record length is different than specified
            RecordIndex index = record.Definition.GetIndex();

            _testResults.Add(new TestResult(ResultType.Error, AddmlLocation.FromRecordIndex(index),
                                            string.Format(Messages.ControlFixedLengthMessage, specifiedLength, actualLength)));
        }
コード例 #7
0
        protected override List <TestResult> GetTestResults()
        {
            var results = new List <TestResult>();

            foreach (KeyValuePair <string, AddmlForeignKey> item in _foreignKeys)
            {
                string          index      = item.Key;
                AddmlForeignKey foreignKey = item.Value;
                if (CollectedPrimaryKeys.ContainsKey(index))
                {
                    foreach (string value in foreignKey.Values)
                    {
                        HashSet <string> primaryKeyValues = CollectedPrimaryKeys[index];
                        if (!primaryKeyValues.Contains(value))
                        {
                            string errorMessageTemplate = Messages.ControlForeignKeyMessage1;
                            if (foreignKey.IsCombinedForeignKey())
                            {
                                errorMessageTemplate = Messages.ControlForeignKeyMessage1Combined;
                            }

                            results.Add(new TestResult(ResultType.Error,
                                                       AddmlLocation.FromFieldIndex(foreignKey.ForeignKeyIndexes),
                                                       string.Format(errorMessageTemplate,
                                                                     PrettyPrintValue(value),
                                                                     AddmlLocation.FromFieldIndex(foreignKey.ForeignKeyReferenceIndexes))));
                        }
                    }
                }
                else
                {
                    results.Add(new TestResult(ResultType.Error, AddmlLocation.FromFieldIndex(foreignKey.ForeignKeyIndexes),
                                               string.Format(Messages.ControlForeignKeyMessage2,
                                                             AddmlLocation.FromFieldIndex(foreignKey.ForeignKeyReferenceIndexes))));
                }
            }
            return(results);
        }
コード例 #8
0
 private static TestResult CreateInvalidForeignKeyError(ForeignKeyValue foreignKeyValue)
 {
     return(new TestResult(ResultType.Error, AddmlLocation.FromFieldIndex(foreignKeyValue.Field),
                           string.Format(Messages.ControlForeignKeyMessage1, foreignKeyValue.Value,
                                         foreignKeyValue.ReferencingField)));
 }