public void InitEmeddedDocumentStore(string dataDirectory,IDocumentQueryListener queryListener) { var mockRavenDBConfigurationInstance = MockRepository.GenerateStub<RavenDBConfiguration>(); Func<IDocumentStore> setDocumentStore = () => { var documentStore = new EmbeddableDocumentStore { DataDirectory = dataDirectory }; if (queryListener != null) documentStore.RegisterListener(queryListener); return documentStore; }; mockRavenDBConfigurationInstance.Stub(x => x.GetDocumentStore()).Do(setDocumentStore); RavenDBConfiguration.Instance(mockRavenDBConfigurationInstance).Init(); //RavenDBConfiguration.Instance().CreateIndex(typeof (Package_CurrentInventory).Assembly); }