mattcole
mattcole

Reputation: 1229

Unit testing RavenDb queries

Is there a sensible way to stub/mock the results of a call to IDocumentSession.Query()?

I have a command where I'd like to verify that methods are called on objects (that is the "unit" being tested is the command NOT the objects the command orchestrates). I can't save Mock objects (via RhinoMocks) into an embedded db instance, so at the moment and being forced to verify state on the objects being called, rather than just verifying that the correct methods have been called.

Thanks, Matt

Upvotes: 6

Views: 1090

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

You are better of when using EmbeddableDocumentStore { RunInMemory = true} for unit testing. That said, IDocumentSession should be very easy to mock.

Upvotes: 6

Related Questions