CosmosDB.InMemoryEmulator 2.0.88

There is a newer version of this package available.
See the version list below for details.
dotnet add package CosmosDB.InMemoryEmulator --version 2.0.88
                    
NuGet\Install-Package CosmosDB.InMemoryEmulator -Version 2.0.88
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CosmosDB.InMemoryEmulator" Version="2.0.88" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CosmosDB.InMemoryEmulator" Version="2.0.88" />
                    
Directory.Packages.props
<PackageReference Include="CosmosDB.InMemoryEmulator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CosmosDB.InMemoryEmulator --version 2.0.88
                    
#r "nuget: CosmosDB.InMemoryEmulator, 2.0.88"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CosmosDB.InMemoryEmulator@2.0.88
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CosmosDB.InMemoryEmulator&version=2.0.88
                    
Install as a Cake Addin
#tool nuget:?package=CosmosDB.InMemoryEmulator&version=2.0.88
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed