Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit testing RavenDb queries

Tags:

ravendb

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

like image 311
mattcole Avatar asked Dec 03 '11 15:12

mattcole


1 Answers

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

like image 67
Ayende Rahien Avatar answered Sep 28 '22 00:09

Ayende Rahien