I started to look into doing some testing this morning using the MiniNode class in EventStore.Core.Tests.Helpers
Is this what people are using for testing the EventStore? I just want to write some simple tests to verify that what I can save and reload some aggregates and everything works as expected.
This is the code I have (in a base class for ES testing):
If I reference the EventStore.Core and EventStore.Core.Tests in isolation, I start getting errors such as:
SetUp : System.TypeInitializationException : The type initializer for ‘EventStore.Core.Tests.Helpers.MiniNode’ threw an exception.
----> System.TypeInitializationException : The type initializer for ‘EventStore.Common.Log.LogManager’ threw an exception.
----> System.IO.FileNotFoundException : Could not load file or assembly ‘NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c’ or one of its dependencies. The system cannot find the file specified.
If I reference EventStore.Core and EventStore.Core.Tests in the directory in which I am running EventStore, everything works as expected. So it looks like i need the full directory for testing.
Is this how other people are testing?
cheers
Tom
(in reality I am really integration testing repository code, where I serialize aggregates, reload them and read/write streams etc…)
I would avoid doing this - as of the v3 RCs we support entirely in-memory operation using the “–mem-db” flag - for meaningful integration tests your best bet is to use Process.Start to bring up an in-memory server and then use it with the actual client API
in your tests.
That seems reasonable - at that point you can easily test projections as well, which might be useful. You can just post and control them using ProjectionsManager.
Yep. That's the next thing on my list! I only have a single projection at the moment but want to get the testing infrastructure in place before adding any more.
I am launching the EventStore once for all tests in my assembly, then killing the process when they complete. I am then connecting to the EventStore as before in the [TestFixtureSetUp] and closing the connection in the [TestFixtureTearDown]