示例#1
0
        private DiscrepancyType RecordsAreEqual(string[] first, string[] second)
        {
            DiscrepancyType result = DiscrepancyType.NONE;

            string[] comparedRecord = new string[first.Length];
            for (int i = 0; i < first.Length; i++)
            {
                string value1 = first[i];
                string value2 = second[i];

                string value1Formatted = string.Empty,
                       value2Formatted = string.Empty;

                bool            columnIsIgnored = ColumnIsIgnored(i);
                DiscrepancyType type;
                if (columnIsIgnored)
                {
                    type = DiscrepancyType.NONE;
                }
                else
                {
                    type = ValuesAreEqual(value1, value2, out value1Formatted, out value2Formatted);
                }

                if (type == DiscrepancyType.DISCREPANCY)
                {
                    comparedRecord[i] = string.Format("'{0}|{1}'", value1Formatted, value2Formatted);
                }
                else if (type == DiscrepancyType.ROUNDING)
                {
                    comparedRecord[i] = string.Format("'{0}||{1}'", value1Formatted, value2Formatted);
                }
                else
                {
                    if (columnIsIgnored)
                    {
                        comparedRecord[i] = value1;
                    }
                    else
                    {
                        comparedRecord[i] = value1Formatted;
                    }
                }


                if (i == ID_COLUMN_INDEX)
                {
                    type = DiscrepancyType.NONE;
                }

                if (type > result)
                {
                    result = type;
                }
            }
            outputter.Record(comparedRecord, result);

            return(result);
        }