public static MockedIndex GetSimpleDataServiceMock( MockIndexFieldList standardFields, MockIndexFieldList userFields, IEnumerable<string> indexTypes, IEnumerable<string> includeNodeTypes, IEnumerable<string> excludeNodeTypes) { var index = new MockedIndex { StandardFields = standardFields, UserFields = userFields, IncludeNodeTypes = includeNodeTypes.ToArray(), ExcludeNodeTypes = excludeNodeTypes.ToArray(), SimpleDataService = Substitute.For<ISimpleDataService>(), LuceneDir = new RAMDirectory() }; index.IndexCriteria = new IndexCriteria(standardFields, userFields, index.IncludeNodeTypes, index.ExcludeNodeTypes, -1); index.Analyzer = new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29); index.Indexer = new SimpleDataIndexer(index.IndexCriteria, index.LuceneDir, index.Analyzer, index.SimpleDataService, indexTypes, false); index.Searcher = new UmbracoExamineSearcher(index.LuceneDir, new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29)); return index; }
public void TestsSetUp() { var fields = typeof (BaseUmbracoIndexer).GetFields(BindingFlags.NonPublic | BindingFlags.Static); var disableInitializationCheckField = fields.SingleOrDefault(x => x.Name == "DisableInitializationCheck"); if (disableInitializationCheckField == null) { Assert.Fail("Could Not Set DisableInitializationCheck"); } disableInitializationCheckField.SetValue(null, true); MockedIndex = MockIndexFactory.GetSimpleDataServiceMock( new MockIndexFieldList().AddIndexField("id", "Number", true), new MockIndexFieldList(), new[] {"test"}, new string[] {}, new string[] {}); NodeFactoryFacade = Substitute.For<INodeFactoryFacade>(); DataService = Substitute.For<IDataService>(); MockedContentService = new MockedContentService(); Sut = new Umbraco.Examine.Indexer( MockedIndex.IndexCriteria, MockedIndex.LuceneDir, DataService, MockedIndex.Analyzer, false, NodeFactoryFacade); }