Пример #1
0
        public void Should_Check_Contains_Word()
        {
            //arrange
            var trie = new MyTrie.MyTrie();

            trie.Insert("abc");
            trie.Insert("abgl");
            trie.Insert("cdf");
            trie.Insert("abcd");
            trie.Insert("lmn");

            //act

            //assert
            trie.ContainsWord("abc").ShouldBeEquivalentTo(true);
            trie.ContainsWord("ab").ShouldBeEquivalentTo(false);
            trie.ContainsWord("").ShouldBeEquivalentTo(false);
            trie.ContainsWord("abcd").ShouldBeEquivalentTo(true);
            trie.ContainsWord("abcc").ShouldBeEquivalentTo(false);
        }
Пример #2
0
        public void Should_Check_Contains_Word_Throw_If_Null()
        {
            //arrange
            var trie = new MyTrie.MyTrie();

            trie.Insert("abc");
            trie.Insert("abgl");
            trie.Insert("cdf");
            trie.Insert("abcd");
            trie.Insert("lmn");

            //act
            Action act = () => trie.ContainsWord(null);

            //assert
            act.ShouldThrow <ArgumentNullException>();
        }