Unit testing RavenDb queries

ε祈祈猫儿з 提交于 2019-12-22 05:23:53

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/8368674/unit-testing-ravendb-queries

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!