public GetReferences ( IEnumerable |
||
tokens | IEnumerable |
Tokens for text to be scanned |
desiredKey | string | If you only want instance of a specific key (e.g. one word, /// one punctuation pattern, one character, etc.) place it here. Empty string returns /// all items. |
Résultat | List |
public void ChangeCharacterCategorizerAfterInstantiationOfCheck() { MixedCapitalizationCheck check = new MixedCapitalizationCheck(m_source); m_source.Text = @"\p \v 1 w!Forming"; List <TextTokenSubstring> tts = check.GetReferences(m_source.TextTokens(), null); Assert.AreEqual(0, tts.Count); m_source.m_extraWordFormingCharacters = "!"; tts = check.GetReferences(m_source.TextTokens(), null); Assert.AreEqual(1, tts.Count); Assert.AreEqual("w!Forming", tts[0].Text); }
void Test(string[] result, string text, string desiredKey) { m_source.Text = text; MixedCapitalizationCheck check = new MixedCapitalizationCheck(m_source); List<TextTokenSubstring> tts = check.GetReferences(m_source.TextTokens(), desiredKey); Assert.AreEqual(result.GetUpperBound(0)+1, tts.Count, "A different number of results was returned than what was expected." ); for (int i = 0; i <= result.GetUpperBound(0); ++i) Assert.AreEqual(result[i], tts[i].InventoryText, "Result number: " + i.ToString()); }
void Test(string[] result, string text, string desiredKey) { m_source.Text = text; MixedCapitalizationCheck check = new MixedCapitalizationCheck(m_source); List <TextTokenSubstring> tts = check.GetReferences(m_source.TextTokens(), desiredKey); Assert.AreEqual(result.GetUpperBound(0) + 1, tts.Count, "A different number of results was returned than what was expected."); for (int i = 0; i <= result.GetUpperBound(0); ++i) { Assert.AreEqual(result[i], tts[i].InventoryText, "Result number: " + i.ToString()); } }
public void ChangeCharacterCategorizerAfterInstantiationOfCheck() { MixedCapitalizationCheck check = new MixedCapitalizationCheck(m_source); m_source.Text = @"\p \v 1 w!Forming"; List<TextTokenSubstring> tts = check.GetReferences(m_source.TextTokens(), null); Assert.AreEqual(0, tts.Count); m_source.m_extraWordFormingCharacters = "!"; tts = check.GetReferences(m_source.TextTokens(), null); Assert.AreEqual(1, tts.Count); Assert.AreEqual("w!Forming", tts[0].Text); }