public static void ClassCleanup() { stringMatcher = null; phoneticMatcher = null; hybridMatcher = null; normalizedMatchers = null; }
public void GivenEmptyQuery_ExpectNormalizedResult() { const string Query = "random string"; string[] targets = new string[] { Query }; var matcher = new StringFuzzyMatcher <string>(targets); var match = matcher.FindNearest(string.Empty); // this is the regular matcher equivalent (an empty string threshold scale is 1) Assert.AreEqual(Query.Length, match.Distance); Assert.AreEqual(Query, match.Element); }
public void GivenMissingTransformation_ExpectException() { Assert.ThrowsException <InvalidCastException>(() => { var matcher = new StringFuzzyMatcher <MyTargetType>(Targets); }); Assert.ThrowsException <InvalidCastException>(() => { var matcher = new EnPhoneticFuzzyMatcher <MyTargetType>(Targets); }); Assert.ThrowsException <InvalidCastException>(() => { var matcher = new EnHybridFuzzyMatcher <MyTargetType>(Targets, PhoneticWeightPercentage); }); }