Esempio n. 1
0
        /// <summary>
        /// Returns a errors list after numbers are normalized
        /// </summary>
        /// <param name="sourceText"></param>
        /// <param name="targetText"></param>
        /// <param name="sourceExcludedRanges"></param>
        /// <param name="targetExcludedRanges"></param>
        /// <param name="segmentPair"></param>
        /// <returns></returns>
        public void CheckSequences(string sourceText, string targetText, List <ExcludedRange> sourceExcludedRanges, List <ExcludedRange> targetExcludedRanges, ISegmentPair segmentPair = null)
        {
            _numberValidator.Verify(sourceText, targetText, VerificationSettings, out var sourceNumbers, out var targetNumbers, sourceExcludedRanges, targetExcludedRanges);

            if (segmentPair is not null)
            {
                ReportErrors(sourceNumbers, targetNumbers, segmentPair);
            }
        }
Esempio n. 2
0
        public static List <ErrorReporting> CheckSourceAndTarget(this NumberVerifierMain numberVerifierMain, string source, string target, [CallerMemberName] string caller = null)
        {
            if (caller?.Contains("Alphanumeric") ?? false)
            {
                return(numberVerifierMain.CheckSegmentPair(source, target));
            }

            var numberVerifierSettings = numberVerifierMain.VerificationSettings;

            Setup();
            _numberValidator.Verify(source, target, numberVerifierSettings, out var sourceNumbersNormalized, out var targetNumbersNormalized, null, null);

            var sourceErrorList = CreateSimplifiedErrorReport(sourceNumbersNormalized, true);
            var targetErrorList = CreateSimplifiedErrorReport(targetNumbersNormalized, false);

            return(sourceErrorList.Concat(targetErrorList).ToList());
        }
        public NumberTexts GetNormalizedNumberWhenLeadingZeroOmittedAndNotAllowed(string text)
        {
            var iMockSettings = NumberVerifierLocalizationsSettings.AllowLocalization();

            iMockSettings.Setup(s => s.SourceDecimalPeriod).Returns(true);

            NumberVerifierLocalizationsSettings.InitSeparators(iMockSettings);

            _numberValidator.Verify(text, null, iMockSettings.Object, out var normalizedNumber, out _);

            return(normalizedNumber);
        }