public void GivenDictionaryWithBluesAndBlues_WhenWordsCalled_ShouldReturnBothWords() { var dictionary = new TreeBasedDictionary(); dictionary.Add("blues"); dictionary.Add("blue"); var words = dictionary.Words(); Assert.That(words, Is.EquivalentTo(new[] { "blue", "blues" })); }
public void GivenDictionaryWithGrayAndGreen_WhenWordsCalledBeginningWithGre_ShouldReturnOnly_en() { var dictionary = new TreeBasedDictionary(); dictionary.Add("gray"); dictionary.Add("green"); var node = dictionary.Find("gre"); var words = node.Words(string.Empty); Assert.That(words, Is.EquivalentTo(new[] { "en" })); }
public void GivenDictionaryWithNodeAdded_WhenFindCalled_ShouldReturnNotNull() { var dictionary = new TreeBasedDictionary(); dictionary.Add("a"); var aNode = dictionary.Find("a"); Assert.That(aNode, Is.Not.Null); }
public void GivenDictionaryWithNodeAddedForWord_WhenWordsCalled_ShouldReturnTheWord() { var dictionary = new TreeBasedDictionary(); dictionary.Add("an"); var words = dictionary.Words(); Assert.That(words, Is.EquivalentTo(new [] { "an" })); }
public void GivenDictionaryWithNodeAddedForTwoCharWord_WhenFindCalledOnceOnEachChar_ShouldReturnSameNodeAsFindCalledOnceOnWholeWord() { var dictionary = new TreeBasedDictionary(); dictionary.Add("an"); var anNodeReachedBySingleCall = dictionary.Find("an"); var anNodeReachedyTwoCalls = dictionary.Find("a").FindNodeOrNull('n'); Assert.That(anNodeReachedBySingleCall, Is.EqualTo(anNodeReachedyTwoCalls)); }