Azure / azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
MIT License
579 stars 837 forks source link

[Feature] InMemoryDocumentClient #318

Open ChristopherHaws opened 7 years ago

ChristopherHaws commented 7 years ago

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

kirankumarkolli commented 7 years ago

@ChristopherHaws emulator can be leveraged as a workaround meanwhile.

ChristopherHaws commented 7 years ago

@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.

kirankumarkolli commented 7 years ago

@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.

MovGP0 commented 6 years ago

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

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).