Exemple #1
0
        public void IndexerCanReturnCountOfWords()
        {
            var indexer = new DocumentIndex();

            indexer.IndexEntry(new Entry("quick brown fox"));
            indexer.IndexEntry(new Entry("come here quick"));

            Assert.Equal(2, indexer.WordCount("quick"));
        }
Exemple #2
0
        public void IndexingASecondEntry_RecordsAdditionalWordAppearences()
        {
            var indexer = new DocumentIndex();

            var entry  = new Entry("The quick brown fox jumps over the lazy dog");
            var entry2 = new Entry("Come here quick");

            indexer.IndexEntry(entry);
            indexer.IndexEntry(entry2);

            Assert.Equal(2, indexer["quick"]);
        }
Exemple #3
0
        public void IndexerReturnsZeroForWordsItHasntSeen()
        {
            var indexer = new DocumentIndex();

            indexer.IndexEntry(new Entry("come here quick"));

            Assert.Equal(0, indexer.WordCount("foo"));
        }
Exemple #4
0
        public void IndexingAnEntry_RecordsUniqueWords()
        {
            var entry   = new Entry("The quick brown fox jumps over the lazy dog");
            var indexer = new DocumentIndex();

            indexer.IndexEntry(entry);

            Assert.Equal(1, indexer["quick"]);
        }
Exemple #5
0
        public void IndexingAnEntry_IncrementsDocumentCountForIndex()
        {
            var entry = new Entry("The quick brown fox jumps over the lazy dog");

            var indexer = new DocumentIndex();

            indexer.IndexEntry(entry);

            Assert.Equal(1, indexer.DocumentCount);
        }