Faking IEventStoreConnection for unit tests

Hi

I’m using the .net client api and was wondering how people have gone about making fake event store connections to test related logic?

I get stuck with creating instances of the classes that the IEventStoreConnection methods return, for example the EventReadResult, StreamEventsSlice and the ResolvedEvent classes all have only internal constructors.

Do people bother faking the store for testing and just use the real thing?

Thanks

Matt

It’s a pretty hard class to fake overall - all the operations are asynchronous and the behaviours are fairly complex.

If you’re testing your application logic you probably want to be faking the repository (or whatever other abstraction you’ve built over the event store) instead, and when it comes to actually testing that abstraction you probably want to be using the real thing. In recent versions you can use the `--mem-db` option to avoid creating files on disk while doing this - I’d just use Process.Start (if you’re on .NET) for this, or the equivalent on other platforms.

Cheers,

James

Thanks James, that was sort of the conclusion I was coming to! :slight_smile:

Matt

Also you can check out MiniNode in its own test suite. I believe that Yves has also done some work in wrapping MiniNode