public void TestTopByPrefix( IReadOnlyList <string> phrases, string prefix, int count, string[] expectedTopWords) { var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); CollectionAssert.AreEqual(actualTopWords, expectedTopWords); }
public void TopByPrefix_IsEmpty_WhenNoPhrases() { var topWords = AutocompleteTask.GetTopByPrefix(new List <string> { }, "a", 1); CollectionAssert.IsEmpty(topWords); }
public void TopByPrefix_IsEmpty_WhenNoPhrases_CounterNonZero() { var phrases = new List <string>(); var result = AutocompleteTask.GetTopByPrefix(phrases, "C#", 1); CollectionAssert.IsEmpty(result); }
public void CountByPrefix_IsZero_WhenNoPhrases() { var phrases = new List <string>(); var result = AutocompleteTask.GetCountByPrefix(phrases, "q"); Assert.AreEqual(0, result); }
public void TopByPrefix_IsEmpty_WhenNoPhrases_AndCountIsGreaterThanZero() { var phrases = new List <string>(); var result = AutocompleteTask.GetTopByPrefix(phrases, "q", 5); CollectionAssert.IsEmpty(result); }
public void TestCountByPrefix( IReadOnlyList <string> phrases, string prefix, int expectedCount) { var actualCount = AutocompleteTask.GetCountByPrefix(phrases, prefix); Assert.AreEqual(actualCount, expectedCount); }
public void TopByPrefixUniversalTest(string[] nonParsedPhrases, string prefix, int count, string[] expectedTopWords) { var phrases = nonParsedPhrases.ToList().AsReadOnly(); var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); Assert.AreEqual(expectedTopWords, actualTopWords); }
public void CountByPrefix_IsTotalCount_WhenEmptyPrefix() { var topWords = AutocompleteTask.GetTopByPrefix(new List <string> { "a", "b" }, "", 1); Assert.AreEqual(topWords, 0); }
public void CountByPrefixUniversalTest(IReadOnlyList <string> nonPaArsedPhrases, string prefix, int expectedCount) { var phrases = nonPaArsedPhrases.ToList().AsReadOnly(); var actualCount = AutocompleteTask.GetCountByPrefix(phrases, prefix); Assert.AreEqual(expectedCount, actualCount); }
public void CountByPrefix_IsTotalCount_WhenMultipleResult() { var phrases = new string[] { "a", "ab", "abc", "def" }; var prefix = "a"; var expectedCount = 3; var actualCount = AutocompleteTask.GetCountByPrefix(phrases, prefix); Assert.AreEqual(expectedCount, actualCount); }
public void TopByPrefix_IsEmpty_WhenNoPhrases() { var phrases = new List <string>(); var count = 2; var prefix = "ab"; var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); CollectionAssert.IsEmpty(actualTopWords); }
public void TopByPrefix_IsEmpty_WhenNoPhrases() { var phrases = new string[] { "a", "ab", "abc", "def" }; var prefix = "zzz"; int count = 10; var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); CollectionAssert.IsEmpty(actualTopWords); }
public void CountByPrefix_IsTotalCount_WhenEmptyPrefix() { var list = new List <string> { "aa", "ab", "bc", "bd", "be", "ca", "cb" }; var actualCount = AutocompleteTask.GetCountByPrefix(list, "a"); Assert.AreEqual(2, actualCount); }
public void TopByPrefix_IsEmpty_WhenNoPhrases() { var list = new List <string> { "aa", "ab", "bc", "bd", "be", "ca", "cb" }; var actualTopWords = AutocompleteTask.GetTopByPrefix(list, "z", 2); CollectionAssert.IsEmpty(actualTopWords); }
public void TopByPrefix_IsEmpty_WhenCounterZero() { var phrases = new List <string> { "a", "ab" }; var result = AutocompleteTask.GetTopByPrefix(phrases, "a", 0); CollectionAssert.IsEmpty(result); }
public void CountByPrefix_IsTotalCount_WhenAllContainPrefix() { var phrases = new List <string>() { "mmcs", "mmc", "mm", "m" }; var result = AutocompleteTask.GetCountByPrefix(phrases, "m"); Assert.AreEqual(4, result); }
public void CountByPrefix_IsTotalCount() { var phrases = new List <string>() { "m", "m", "c", "s" }; var result = AutocompleteTask.GetCountByPrefix(phrases, "m"); Assert.AreEqual(2, result); }
public void TopByPrefix() { var phrases = new List <string> { "a", "ab", "ab" }; var result = AutocompleteTask.GetTopByPrefix(phrases, "a", 10); Assert.AreEqual(3, result.Length); CollectionAssert.AreEqual(phrases, result); }
public void TopByPrefix_MultipleResult_Uncutted() { var phrases = new string[] { "a", "ab", "abc", "def" }; var prefix = "ab"; int count = 10; var expectedResult = new string[] { "ab", "abc" }; var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); CollectionAssert.Equals(expectedResult, actualTopWords); }
public void TopByPrefix_IsEmpty_WhenPhrasesNotContainPrefix_AndCountIsGreaterThanZero() { var phrases = new List <string>() { "nig", "nigg", "n***a" }; var result = AutocompleteTask.GetTopByPrefix(phrases, "a", phrases.Count); CollectionAssert.IsEmpty(result); }
public void CountByPrefix_IsZero_WhenNoEntries() { var phrases = new List <string>() { "a", "hitler", "super", "test" }; var result = AutocompleteTask.GetCountByPrefix(phrases, "hitla"); Assert.AreEqual(0, result); }
public void CountByPrefix_IsTotalCount_WhenEmptyPhrases() { var phrases = new List <string>() { }; var prefix = "ab"; var actualTopWords = AutocompleteTask.GetCountByPrefix(phrases, prefix); var expectedCount = 0; Assert.AreEqual(expectedCount, actualTopWords); }
public void GetCountByPrefixEmptyTest() { var phrases = new List <string> { "a", "ab", "abc", "b" }; var prefix = "c"; var expectedResult = 0; var result = AutocompleteTask.GetCountByPrefix(phrases, prefix); Assert.AreEqual(expectedResult, result); }
public void CountByPrefix_IsTotalCount_WhenAllPhrasesContainPrefix() { var phrases = new List <string>() { "he", "hell", "hello", "help" }; var totalCount = phrases.Count; var result = AutocompleteTask.GetCountByPrefix(phrases, "he"); Assert.AreEqual(totalCount, result); }
public void CountByPrefix_IsTotalCount_WhenEmptyPrefix() { var phrases = new List <string>() { "i", "love", "programming" }; var totalCount = phrases.Count; var result = AutocompleteTask.GetCountByPrefix(phrases, ""); Assert.AreEqual(totalCount, result); }
public void CountByPrefix_IsN_WhenHaveNEntries() { var phrases = new List <string>() { "alrite", "another", "hitler", "hitt" }; var n = 2; var result = AutocompleteTask.GetCountByPrefix(phrases, "hit"); Assert.AreEqual(n, result); }
public void GetTopByPrefixTestLessThanCount() { var phrases = new List <string> { "a", "ab", "abc", "b" }; var prefix = "a"; var count = 4; var expectedResult = new[] { "a", "ab", "abc" }; var result = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); Assert.AreEqual(expectedResult, result); }
public void TopByPrefix_IsEmpty_WhenCountIsZero() { var phrases = new List <string>() { "aa", "ab", "abb", "abc", "ac", "csa" }; var prefix = "ab"; var count = 0; var actualTopWords = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); CollectionAssert.IsEmpty(actualTopWords); }
public void GetTopByPrefixTestEmpty() { var phrases = new List <string> { "a", "ab", "abc", "b" }; var prefix = "c"; var count = 2; var expectedResult = new string[0]; var result = AutocompleteTask.GetTopByPrefix(phrases, prefix, count); Assert.AreEqual(expectedResult, result); }
public void TopByPrefix_IsTotalCount_WhenPhrasesContainPrefix_AndCountIsGreaterThanTotal() { var phrases = new List <string>() { "nig", "nigg", "n***a" }; var totalCount = phrases.Count; var result = AutocompleteTask.GetTopByPrefix(phrases, "n", 42); Assert.AreEqual(totalCount, result.Length); CollectionAssert.AreEqual(phrases, result); }