sakthivel-p-cse/codex/agui-dotnet-unit-tests
- community
Checking that the SKILL.md file is still in the repository.
Author unit tests for the AG-UI .NET SDK (the *.UnitTests projects), following the SDK's serialization and compatibility conventions. USE FOR: adding unit-test coverage for a new type/method in AGUI.Abstractions/Formatting/Protobuf/Client/Server, event serialization round-trips, JsonDocument property-name assertions, backward-compatibility fixtures against TypeScript JSON, protobuf codec round-trips, client builder/handler tests, server ChatResponseUpdate conversion tests, SSE formatter tests. DO NOT USE FOR: HTTP pipeline / WebApplicationFactory end-to-end tests (use the agui-dotnet-integration-tests skill), cross-language TS↔C# server-parity tests (use the cross-language test skill).
Install
npx vskill@latest install sakthivel-p-cse/codex/agui-dotnet-unit-testsSKILL.md
The same SKILL.md was published earlier as gabrielmoreira/agent-skills-mirror/agui-dotnet-unit-tests.
AG-UI .NET Unit Tests
Conventions for the tests/*.UnitTests projects. Mined from sdks/dotnet/AGENTS.md and existing tests. An agent gets these wrong by default: asserting on deserialized objects (misses naming bugs), comparing full JSON strings (fragile), using reflection, or skipping the FixtureLoader compatibility pattern.
All commands run from sdks/dotnet/.
Unit-test projects
| Project | Focus | |
|---|---|---|
tests/AGUI.Abstractions.UnitTests/ | Event serialization round-trips; backward compat vs TypeScript fixtures (Compatibility/) | |
tests/AGUI.Protobuf.UnitTests/ | Protobuf codec round-trips; JsonElement↔protobuf Value conversion | |
tests/AGUI.Client.UnitTests/ | Client builders, content-negotiation handler, transport, protocol rules | |
tests/AGUI.Server.UnitTests/ | ChatResponseUpdate → AG-UI event conversion | |
tests/AGUI.Formatting.UnitTests/ | SSE event-stream formatter (read/write, media type) |
Run one project: dotnet test tests/AGUI.Abstractions.UnitTests/
Conventions
- Test files live directly under the project root (not mirrored into
Events/subfolders).
Compatibility tests go in the Compatibility/ subfolder.
- Test class name:
{TypeUnderTest}Test(RunStartedEventTest,ToolCallBuilderTest).
Compatibility class: {Category}CompatibilityTest (RunEventsCompatibilityTest).
public sealed class, one class per file, file name matches type.[Fact]for single cases,[Theory]+[InlineData]for parameterized cases.- Serialize via the source-generated context:
AGUIJsonSerializerContext.Default.{Type}—
never JsonSerializer.Serialize<object>(...) or hand-rolled options.
Pattern 1 — Event serialization round-trip (Abstractions)
Serialize via the source-gen context, parse with JsonDocument, assert each camelCase property name AND the type discriminator. This is what catches [JsonPropertyName] bugs.
Pattern 2 — Backward-compatibility fixtures (Abstractions/Compatibility)
Compatibility/Fixtures/*.json are produced by the TypeScript reference implementation. Deserialize them into .NET types and assert the values — this catches wire-format drift. Load arrays with FixtureLoader; write one test method per event shape.
Adding a fixture: place the TS-produced JSON array under Compatibility/Fixtures/ (embedded resource), then index into the loaded array per shape.
Pattern 3 — Protobuf codec round-trip (Protobuf)
Encode→decode and assert typed values. Compare JsonElement payloads with JsonTestHelpers.AssertEqual (deep-equals), not string compare. ProtoValueConverter tests verify JsonElement↔Value for each ValueKind.
Pattern 4 — Client builders / handler (Client)
Drive the builder/handler through its real API and assert the produced MEAI types. ToolCallBuilder/TextMessageBuilder: feed events, flush, assert FunctionCallContent, ConversationId, ResponseId. AGUIEventStreamHandler: assert content-negotiation Accept header ordering via a test inner handler. Standard xunit assertions.
Pattern 5 — Server conversion (Server)
Convert a ChatResponseUpdate stream to AG-UI events and assert the sequence with Assert.Collection, type-checking each event and its fields (e.g. run lifecycle wraps content with RunStartedEvent/RunFinishedEvent).
Pattern 6 — SSE formatter (Formatting)
Assert MediaType, CanRead(contentType) (use [Theory]/[InlineData] for case and null/empty handling), and that WriteAsync produces the data: {json} shape per event.
❌ Critical anti-patterns
- Never assert only on the deserialized object for serialization tests. Round-trip
through your own type hides [JsonPropertyName] mistakes. Parse the JSON with JsonDocument and assert the literal camelCase property names + type discriminator.
- Never compare full JSON strings — fragile against property ordering/whitespace.
Parse and check individual properties (or JsonTestHelpers.AssertEqual for payloads).
- Never use reflection to enumerate types or verify membership. Write explicit
per-type / per-shape tests.
- Never use ad-hoc serializer options. Serialize through
AGUIJsonSerializerContext.Default.{Type} so tests exercise the real AOT context.
- Never collapse compatibility shapes into one loop-only assertion. Keep one test
method per event shape so a drift failure names the exact event.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingreferences/ui/agent-ui-libs/ag-ui/.github/skills/agui-dotnet-unit-tests/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sakthivel-p-cse/codex/agui-dotnet-unit-tests)