예제 #1
0
        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" }));
        }
예제 #2
0
        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" }));
        }
예제 #3
0
        public void GivenDictionaryWithNodeAdded_WhenFindCalled_ShouldReturnNotNull()
        {
            var dictionary = new TreeBasedDictionary();

            dictionary.Add("a");
            var aNode = dictionary.Find("a");

            Assert.That(aNode, Is.Not.Null);
        }
예제 #4
0
        public void GivenDictionaryWithNodeAddedForWord_WhenWordsCalled_ShouldReturnTheWord()
        {
            var dictionary = new TreeBasedDictionary();

            dictionary.Add("an");
            var words = dictionary.Words();

            Assert.That(words, Is.EquivalentTo(new [] { "an" }));
        }
예제 #5
0
        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));
        }