@Arnold Zokas,
I know this is a wee bit late, but (i'm pretty sure) the NoStaleQueriesListener doesn't work for indexes.
Why is this important?
With your unit tests, each Fact/Test should be independent of each other .. and therefore the embedded ravendb should be seeding some fake data .. for each test :)
Now, the test/fact which is being asserted -might- require a static index. now, it's possible that the index required might be stale .. because the test is running so fast, that the index hasn't had a chance to complete.
As such, I do your 'Sleep' thing.
So, whenever i SEED some data, i then sleep while the indexes are stale.
This also has a SECOND bonus reason. For my actual website, i -love- using fake data for my development and when i need to get some hard manual testing, i switch the db over to a copy of a real db snapshot. Now, in dev mode, cause i'm using fake data .. the web site might fire off the indexing, but the main web page might show so quickly, that the index (which the home page needed) was still stale .. as therefore nothing showed on the homepage.
for example : RavenOverlflow demo app. The homepage uses 2 indexex. When i first ran the website on my development localhost box, it seeded data, starting indexing .. but the homepage was always -empty- or blank. I hit refresh and viola! data now showed. This meant that my computer was running so fast, the indexes didn't get a chance to complete before the normal
ASP.NET lifecycle completed :P Or more to the point, the ravendb session which queried the indexes in the ActionMethod was getting called so quickly .. the index (or indexes) was/were still stale!
So i've updated my RavenOverflow demo project with code that shows how my unit tests take leverage of this.
Check out the global.asax and RavenDbFactBase.cs files to see how i leverage both the Listener and the Sleeping technique when seeding.