Search code examples
c#testing.net-coreneo4jneo4jclient

Testing Neo4jClient queries on .NET Core (transactions not supported)


I've started to write some tests for my Neo4j queries built using Neo4jClient. On normal .NET, transactions are supported in Neo4jClient, which makes testing easy. Unfortunately, it is not yet supported for .NET Core. Does anyone have any suggestions on what could be done instead? I have repositories with quite complex queries, and need a maintainable simple way of testing these without code repetition. At the moment, I simply clear the database before starting each test. Is this the best solution I will be able to get? It is quite slow, and well, I'd like to keep pre-existing data!


Solution

  • At the moment, you're probably on one of the best routes - largely any suggestion other than this is going to be a hacky solution as well :/

    In terms of keeping your data - the only thing I could think of would be to backup the DB and restore it afterwards as part of a pre/post build phase - but that's not going to be fun to write or maintain.

    What needs to happen is for the client to support tx for core as well. That is planned - but when is not defined.