Пример #1
0
        public double Distance_WhenCalled_ShouldReturnExpectedResult(string first, string second)
        {
            // arrange
            IFuzzyMatchingService fuzzyMatchingService = new FuzzyMatchingService(0.1, 3);

            // act and assert
            return(fuzzyMatchingService.Distance(first, second));
        }
Пример #2
0
        public double GetWeight_WhenCalled_ShouldReturnExpectedResult(string first, string second, int matchingCharacters, int halfTransposed)
        {
            // arrange
            FuzzyMatchingService fuzzyMatchingService = new FuzzyMatchingService(0.3, 4);

            // act and assert
            return(fuzzyMatchingService.GetWeight(first, second, matchingCharacters, halfTransposed));
        }
Пример #3
0
        public int GetMatchingCharacters_WhenCalled_ShouldReturnExpectedResult(string first, string second, int searchRange)
        {
            // arrange
            bool[] firstMatching  = new bool[first.Length];
            bool[] secondMatching = new bool[second.Length];

            // act and assert
            return(FuzzyMatchingService.GetMatchingCharacters(first, second, searchRange, firstMatching, secondMatching));
        }
Пример #4
0
        public int GetTransposed_WhenCalled_ShouldReturnExpectedResult(string first, string second, int numberOfFirstMatching, int numberOfSecondMatching)
        {
            // arrange
            bool[] firstMatching  = new bool[first.Length];
            bool[] secondMatching = new bool[second.Length];

            for (var i = 0; i < numberOfFirstMatching; i++)
            {
                firstMatching[i] = true;
            }

            for (var i = 0; i < numberOfSecondMatching; i++)
            {
                secondMatching[i] = true;
            }

            // act and assert
            return(FuzzyMatchingService.GetTransposed(first, second, firstMatching, secondMatching));
        }