public void Rebuild_Index() { var contentRebuilder = IndexInitializer.GetContentIndexRebuilder(Factory.GetInstance <PropertyEditorCollection>(), IndexInitializer.GetMockContentService(), ScopeProvider.SqlContext, false); var mediaRebuilder = IndexInitializer.GetMediaIndexRebuilder(Factory.GetInstance <PropertyEditorCollection>(), IndexInitializer.GetMockMediaService()); using (var luceneDir = new RandomIdRamDirectory()) using (var indexer = IndexInitializer.GetUmbracoIndexer(ProfilingLogger, luceneDir, validator: new ContentValueSetValidator(false))) using (indexer.ProcessNonAsync()) { var searcher = indexer.GetSearcher(); //create the whole thing contentRebuilder.Populate(indexer); mediaRebuilder.Populate(indexer); var result = searcher.CreateQuery().All().Execute(); Assert.AreEqual(29, result.TotalItemCount); } }