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)); }
public void GivenEmptyDictionaryNode_WhenFindCalled_ShouldReturnNull() { var dictionary = new TreeBasedDictionary(); var aNode = dictionary.Find("a"); Assert.That(aNode, Is.Null); }
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 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" })); }