Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit Testing RavenDB

In my unit tests I am setting up each test to have a totally empty IDocumentSession. I do it like this:

[SetUp] public void SetUp() {   _store = new EmbeddableDocumentStore   {      RunInMemory = true   };    _store.Initialize();    Session = _store.OpenSession(); } 

But I think this might be the reason my tests are a little slow. I was wondering if there is a simple command to delete all documents from the database.

What I want is to know is: if I can do this, and if it would improve performance.

like image 431
nick Avatar asked Sep 23 '11 18:09

nick


Video Answer


2 Answers

This is the recommended approach for unit testing with ravendb The not recommended for production basically runs in the in memory mode If you find this to be slow, try profiling and figuring out what exactly is slowing things down

like image 162
Ayende Rahien Avatar answered Sep 29 '22 06:09

Ayende Rahien


Try to use RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true.

        var _store = new EmbeddableDocumentStore()         {             Configuration =                 {                     RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,                     RunInMemory = true,                 }         }; 
like image 41
Daniel Lang Avatar answered Sep 29 '22 07:09

Daniel Lang