Created
December 6, 2012 15:28
-
-
Save felipeleusin/4225324 to your computer and use it in GitHub Desktop.
RavenDb simple test helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RavenMemoryBaseTest : RavenBaseTest { | |
protected override void ModifyConfiguration(Raven.Database.Config.RavenConfiguration configuration) | |
{ | |
configuration.RunInMemory = true; | |
} | |
protected override void ModifyStore(EmbeddableDocumentStore documentStore) | |
{ | |
documentStore.RegisterListener(new NonStaleQueriesListener()); | |
} | |
private class NonStaleQueriesListener : Raven.Client.Listeners.IDocumentQueryListener | |
{ | |
public void BeforeQueryExecuted(IDocumentQueryCustomization queryCustomization) | |
{ | |
queryCustomization.WaitForNonStaleResults(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RavenSimpleBaseTest | |
{ | |
public IDocumentStore NewDocumentStore(Action<EmbeddableDocumentStore> extraSteps = null) | |
{ | |
var store = new EmbeddableDocumentStore() | |
{ | |
RunInMemory = true | |
}; | |
store.RegisterListener(new NonStaleQueriesListener()); | |
if (extraSteps != null) | |
{ | |
extraSteps(store); | |
} | |
return store.Initialize(); | |
} | |
private class NonStaleQueriesListener : Raven.Client.Listeners.IDocumentQueryListener | |
{ | |
public void BeforeQueryExecuted(IDocumentQueryCustomization queryCustomization) | |
{ | |
queryCustomization.WaitForNonStaleResults(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment