public void CorrelateString() { var string1 = "abc"; var string2 = "ac"; var expectedResult = new CorrelaterResult <char>(removalCost, string1.ToCharArray(), "a\0c".ToCharArray()); stringCorrelater.AssertComparision(string1, string2, expectedResult); }
public void CorrelateEmptyArrayToFullArray() { var array1 = new string[0]; var array2 = new[] { "A", "B", "C" }; var expectedResult = new CorrelaterResult <string>(insertionCost * array2.Length, new string[3], array2); correlater.AssertComparision(array1, array2, expectedResult); }
public void Correlate_Transposition3() { var correlater = new DamerauLevenshteinCorrelater <string>(20, 10, 15, 15); var array1 = new[] { "A", "D", "B" }; var array2 = new[] { "B", "D" }; var expectedResult = new CorrelaterResult <string>(25, array1, new [] { null, "B", "D" }); correlater.AssertComparision(array1, array2, expectedResult); }
public void DifrentTranspositionCosts(int transpositionCost) { var transpositionCalculator = A.Fake <ITranspositionCalculator <string> >(); var correlater = new DamerauLevenshteinCorrelater <string>(new BasicDistanceCalculator <string>(20), transpositionCalculator, 20, 20); A.CallTo(() => transpositionCalculator.TranspositionCost(A <string> ._, A <string> ._)).Returns((uint)transpositionCost); var array1 = new[] { "V", "E" }; var array2 = new[] { "E", "V" }; var expectedResult = new CorrelaterResult <string>(transpositionCost, array1, array2); correlater.AssertComparision(array1, array2, expectedResult); }