This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Verify.Cosmos is a Verify extension that adds snapshot testing support for Azure Cosmos DB response types (Response<T>, FeedResponse<T>, Headers). It serializes Cosmos DB responses into a deterministic, diffable format by stripping volatile fields (ETags, diagnostics, x-ms-* headers, dates) and rounding request charges.
All commands run from the src/ directory. The solution uses .NET SDK 10.0 (preview) with latestFeature roll-forward.
# Build
dotnet build src
# Run all tests (requires Cosmos DB Emulator running on https://localhost:8081)
dotnet test src/Tests
# Run a single test
dotnet test src/Tests --filter "FullyQualifiedName~Tests.ItemResponse"Tests use xUnit v3 with Verify.XunitV3. They require the Azure Cosmos DB Emulator running locally — tests connect to https://localhost:8081 with the well-known emulator key.
-
src/Verify.Cosmos/— The NuGet library. Targetsnet8.0.VerifyCosmos.cs— Entry point.Initialize()registers ignored members (ETag, CosmosDiagnostics, IndexingPolicy, etc.) and adds the custom JSON converters. Must be called once via[ModuleInitializer]before any Verify assertions.Converters/ResponseConverter.cs— HandlesResponse<T>: serializes RequestCharge (rounded), Headers, StatusCode, Resource.Converters/FeedResponseConverter.cs— HandlesFeedResponse<T>: same as above plus Count. UsesCanConvertto walk the type hierarchy for generic type matching.Converters/HeadersConverter.cs— Filters outx-ms-*,etag,date, andlsnheaders from snapshots.
-
src/Tests/— Integration tests against the Cosmos DB Emulator. Verified snapshots are*.verified.txtfiles adjacent to the test file.
- Central Package Management: Package versions are in
src/Directory.Packages.props. Never add version attributes directly toPackageReferencein.csprojfiles. - C# language version:
preview(set inDirectory.Build.props). - Code style:
vareverywhere, expression-bodied members, file-scoped namespaces, no explicit access modifiers. Enforced via.editorconfig. - Verify snapshots:
*.verified.txtfiles use UTF-8 BOM, LF line endings, no final newline, and no indentation rules (configured in.editorconfig). Never hand-edit verified files — they are generated by running tests with Verify. - Strong naming: The library is strong-named (
src/key.snk) withInternalsVisibleTogranting test access.