|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Verify.ImageSharp is a .NET library that extends the [Verify](https://github.com/VerifyTests/Verify) snapshot testing framework to support image verification via [SixLabors.ImageSharp](https://github.com/SixLabors/ImageSharp). It registers stream/file converters so that Verify can compare image files (BMP, GIF, JPEG, PNG, TIFF) and `Image` objects, producing both metadata (`.txt`) and image (`.ext`) verified files. |
| 8 | + |
| 9 | +## Build and Test Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Build |
| 13 | +dotnet build src --configuration Release |
| 14 | + |
| 15 | +# Run all tests |
| 16 | +dotnet test src --configuration Release |
| 17 | + |
| 18 | +# Run a single test |
| 19 | +dotnet test src/Tests --filter "FullyQualifiedName~Samples.VerifyImageFile" |
| 20 | +``` |
| 21 | + |
| 22 | +The solution file is `src/Verify.ImageSharp.slnx`. Both projects target .NET 8.0 and require .NET SDK 10.0.200 (preview, see `src/global.json`). |
| 23 | + |
| 24 | +## Architecture |
| 25 | + |
| 26 | +The library consists of three files in `src/Verify.ImageSharp/`: |
| 27 | + |
| 28 | +- **VerifyImageSharp.cs** — The single public API surface. `Initialize()` registers stream converters for each image format and a file converter for `Image` objects. Extension methods (`EncodeAsPng`, `EncodeAsJpeg`, etc.) on `VerifySettings`/`SettingsTask` allow tests to override the output encoding. Encoder/extension overrides are passed via the Verify context dictionary. |
| 29 | +- **InfoBuilder.cs** — `GetInfo(Image)` extension that extracts metadata (dimensions, resolution) for the verified `.txt` output. |
| 30 | +- **GlobalUsings.cs** — Imports for SixLabors.ImageSharp format namespaces. |
| 31 | + |
| 32 | +Tests are in `src/Tests/` using NUnit. The `[ModuleInitializer]` pattern in `ModuleInit.cs` calls `VerifyImageSharp.Initialize()` before any test runs. |
| 33 | + |
| 34 | +## Code Style |
| 35 | + |
| 36 | +- `var` everywhere (enforced at error level) |
| 37 | +- Expression-bodied members preferred |
| 38 | +- File-scoped namespaces |
| 39 | +- No accessibility modifiers on non-public members (`dotnet_style_require_accessibility_modifiers = never`) |
| 40 | +- Private fields use camelCase |
| 41 | +- Braces required for all control flow |
| 42 | +- Warnings treated as errors; code style enforced in build |
| 43 | +- LF line endings, 4-space indent for C#, 2-space for XML/JSON |
| 44 | + |
| 45 | +## NuGet Package Management |
| 46 | + |
| 47 | +Uses central package version management via `src/Directory.Packages.props`. Do not add `Version` attributes to `PackageReference` in `.csproj` files — versions are declared centrally. |
0 commit comments