CosmosDB.InMemoryEmulator
2.0.87
See the version list below for details.
dotnet add package CosmosDB.InMemoryEmulator --version 2.0.87
NuGet\Install-Package CosmosDB.InMemoryEmulator -Version 2.0.87
<PackageReference Include="CosmosDB.InMemoryEmulator" Version="2.0.87" />
<PackageVersion Include="CosmosDB.InMemoryEmulator" Version="2.0.87" />
<PackageReference Include="CosmosDB.InMemoryEmulator" />
paket add CosmosDB.InMemoryEmulator --version 2.0.87
#r "nuget: CosmosDB.InMemoryEmulator, 2.0.87"
#:package CosmosDB.InMemoryEmulator@2.0.87
#addin nuget:?package=CosmosDB.InMemoryEmulator&version=2.0.87
#tool nuget:?package=CosmosDB.InMemoryEmulator&version=2.0.87
CosmosDB.InMemoryEmulator
A high-fidelity, in-memory implementation of the Azure Cosmos DB SDK for .NET — purpose-built for fast, reliable component and integration testing.
Drop-in replacements for CosmosClient, Database, and Container — full CRUD, SQL queries, LINQ, patch, batches, change feed, and more. No network, no emulator process, no Docker, no Azure subscription required.
Core Types
| Type | Purpose |
|---|---|
InMemoryContainer |
Drop-in Container replacement with full CRUD, queries, patch, batches, change feed |
FakeCosmosHandler |
HTTP-level interceptor — zero production code changes, full SDK fidelity |
InMemoryCosmosClient |
Drop-in CosmosClient replacement with database/container management |
Quick Start
using CosmosDB.InMemoryEmulator;
using Microsoft.Azure.Cosmos;
// Direct usage
var container = new InMemoryContainer("my-container", "/partitionKey");
await container.CreateItemAsync(
new { id = "1", partitionKey = "pk1", name = "Alice" },
new PartitionKey("pk1"));
var iterator = container.GetItemQueryIterator<dynamic>(
"SELECT * FROM c WHERE c.name = 'Alice'");
FakeCosmosHandler (Zero Code Changes)
var inMemoryContainer = new InMemoryContainer("orders", "/customerId");
var handler = new FakeCosmosHandler(inMemoryContainer);
var client = new CosmosClient(
"AccountEndpoint=https://localhost:9999/;AccountKey=dGVzdGtleQ==;",
new CosmosClientOptions
{
ConnectionMode = ConnectionMode.Gateway,
HttpClientFactory = () => new HttpClient(handler)
});
var container = client.GetContainer("db", "orders");
// All operations work through the same Container reference:
await container.CreateItemAsync(order, new PartitionKey(order.CustomerId));
var query = container.GetItemLinqQueryable<Order>()
.Where(o => o.Status == "active")
.ToFeedIterator();
Features
Full CRUD, 120+ SQL functions, LINQ, bulk operations, transactional batches, change feed, patch operations, ETag concurrency, partition keys, TTL, fault injection, DI integration, state persistence, point-in-time restore, unique key policies, computed properties.
Documentation
Full documentation: GitHub Wiki
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CosmosDB.InMemoryEmulator.ProductionExtensions (>= 2.0.87)
- Microsoft.Azure.Cosmos (>= 3.58.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Newtonsoft.Json (>= 13.0.4)
- NSubstitute (>= 5.3.0)
- Superpower (>= 3.1.0)
-
net8.0
- CosmosDB.InMemoryEmulator.ProductionExtensions (>= 2.0.87)
- Microsoft.Azure.Cosmos (>= 3.58.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Newtonsoft.Json (>= 13.0.4)
- NSubstitute (>= 5.3.0)
- Superpower (>= 3.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CosmosDB.InMemoryEmulator:
| Package | Downloads |
|---|---|
|
CosmosDB.InMemoryEmulator.JsTriggers
JavaScript trigger body interpretation for CosmosDB.InMemoryEmulator. Uses Jint to execute real Cosmos DB trigger JavaScript (getContext, getRequest, getResponse, getBody, setBody) inside your in-memory tests. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.90 | 0 | 4/8/2026 |
| 2.0.89 | 0 | 4/8/2026 |
| 2.0.88 | 4 | 4/8/2026 |
| 2.0.87 | 32 | 4/7/2026 |
| 2.0.85 | 30 | 4/7/2026 |
| 2.0.84 | 31 | 4/7/2026 |
| 2.0.83 | 32 | 4/7/2026 |
| 2.0.82 | 28 | 4/7/2026 |
| 2.0.81 | 32 | 4/7/2026 |
| 2.0.80 | 32 | 4/7/2026 |
| 2.0.79 | 42 | 4/7/2026 |
| 2.0.78 | 25 | 4/7/2026 |
| 2.0.77 | 31 | 4/7/2026 |
| 2.0.76 | 26 | 4/7/2026 |
| 2.0.72 | 91 | 4/6/2026 |
| 2.0.71 | 85 | 4/6/2026 |
| 2.0.70 | 86 | 4/6/2026 |
| 2.0.69 | 84 | 4/6/2026 |
| 2.0.68 | 89 | 4/6/2026 |
| 2.0.59 | 103 | 4/5/2026 |