Azure-cosmos-dotnet-v2: [Feature] InMemoryDocumentClient

Created on 10 Aug 2017  路  4Comments  路  Source: Azure/azure-cosmos-dotnet-v2

Hello!

For unit testing purposes it would be really nice to have an InMemoryDocumentClient that mostly acts the same as a document client.

Thanks,
Chris

backlog enhancement

Most helpful comment

@ChristopherHaws just want to make sure that you were unblocked. Totally agree its close to 'integration test' part. Marking it as backlog but this will be a low priority.

All 4 comments

@ChristopherHaws emulator can be leveraged as a workaround meanwhile.

@kirankumarkolli That is what we are using right now, however it does make tests non-atomic (test data might conflict with previous test data). It turns the test into more of an integration test than a unit test.

@ChristopherHaws just want to make sure that you were unblocked. Totally agree its close to 'integration test' part. Marking it as backlog but this will be a low priority.

I have the same issue. I want a test instance that I can include as a NuGet package and instantiate and throw away in my integration tests. Similar to Microsoft.AspNetCore.TestHost.TestServer in ASP.NET Core.

Having the emulator is not a real solution, because

  • it needs to be installed on the CI server
  • it needs to be cleaned after each test
  • it requires additional work when testing in the cloud, where the emulator is not available
  • it does not work well with concurrently running tests

Because of this additional overhead, I don't bother with it and currently use an additional Azure instance of CosmosDB. However, I don't like it because it is more expensive to run and still suffers from the concurrency issues (ie. when multiple users inclusive-or CI-servers run tests at the same time).

Was this page helpful?
0 / 5 - 0 ratings