Skip to content
Aryeh Citron edited this page Apr 20, 2026 · 16 revisions

A fully featured, in-process fake for the Azure Cosmos DB SDK for .NET — purpose-built for fast, reliable component and integration testing.

No external processes, no Docker, no network — just add the NuGet package and go:

// Dependency Injection (WebApplicationFactory / integration tests)
serviceCollection.UseInMemoryCosmosDB();

// Direct instantiation (full SDK fidelity, recommended for non-Dependency Injection tests)
using var cosmos = InMemoryCosmos.Create("my-container", "/partitionKey");

Full support for CRUD, SQL querying (120+ functions), LINQ, change feed, transactional batches, patch operations, ETags, TTL, stored procedures & triggers, full-text search, vector search, and more.

Documentation

Guide Description
Getting Started Installation, quick start with Dependency Injection, first test
Unit Testing InMemoryCosmos.Create() usage without Dependency Injection
Choosing Your Approach Comparison of all three approaches with decision flowchart
Setup Guide Step-by-step setup for all patterns (Dependency Injection, typed clients, custom factories, direct)
How Does ToFeedIterator() Work? How .ToFeedIterator() works with FakeCosmosHandler
Multi-Database Using AddDatabase() for multi-database setups with overlapping container names
SQL Queries Full SQL reference — clauses, operators, 120+ built-in functions
Features Patch, batches, change feed, ETags, TTL, stored procs, full-text & vector search, and more
API Reference Complete class and method reference
Feature Comparison vs Official Emulator, vs Real Azure, vs community alternatives
Known Limitations Limitations, behavioural differences, and intentionally out-of-scope areas
Troubleshooting Common errors and how to fix them
Seeding Data Dependency Injection callbacks, SDK methods, snapshots, bulk seeding
State Persistence Export/import, automatic persistence between runs, point-in-time restore
What's New in 3.0 New unified API, multi-database support, dynamic containers, and migration guide
Migration Guide (2.x → 3.0) Breaking changes and upgrade instructions for v3.0.0

Clone this wiki locally