public void GetSuggestionCountTest() { try { SwipeType.SwipeType swipeType = new DistanceSwipeType(File.ReadAllLines("EnglishDictionary.txt")); string[] testing = { "heqerqllo", "qwertyuihgfcvbnjk", "wertyuioiuytrtghjklkjhgfd", "dfghjioijhgvcftyuioiuytr", "aserfcvghjiuytedcftyuytre", "asdfgrtyuijhvcvghuiklkjuytyuytre", "mjuytfdsdftyuiuhgvc", "vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty" }; foreach (var s in testing) { const int count = 3; var x = swipeType.GetSuggestion(s, count); if (x.Count() < count) { Assert.Fail("GetSuggestionTest fail with no match"); } } } catch (Exception ex) { Assert.Fail($"GetSuggestionTest fail with exception: {ex}"); } }
private static void Main() { SwipeType simpleSwipeType = new MatchSwipeType(File.ReadAllLines("EnglishDictionary.txt")); SampleUsingSwipeType(simpleSwipeType); Console.ReadKey(true); SwipeType distanceSwipeType = new DistanceSwipeType(File.ReadAllLines("EnglishDictionary.txt")); SampleUsingSwipeType(distanceSwipeType); Console.ReadKey(true); }
public void SimpleSwipeTypeTest() { try { SwipeType.SwipeType swipeType = new DistanceSwipeType(File.ReadAllLines("EnglishDictionary.txt")); } catch (OutOfMemoryException e) { Assert.Fail($"GetSuggestionTest fail with OutOfMemoryException: {e}"); } catch (Exception ex) { Assert.Fail($"GetSuggestionTest fail with Exception: {ex}"); } }