Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-webapi-integration-testingnpx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-advanced-webapi-integration-testinggit clone --depth 1 https://github.com/kevintsengtw/dotnet-testing-agent-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-webapi-integration-testing)<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-webapi-integration-testing"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-webapi-integration-testing.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00201 | $0.02080 |
| Opus 5 | $0.00101 | $0.01040 |
| Sonnet 5 | $0.00040 | $0.00416 |
| Haiku 4.5 | $0.00020 | $0.00208 |
Grade A, and why
dotnet-testing-advanced-webapi-integration-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 171 lines — stays where its author put it; the contents beside it link to each section on GitHub.
WebApi 整合測試
學習目標
完成本技能學習後,您將能夠:
- 建立完整的 WebApi 整合測試架構
- 使用
IExceptionHandler實作現代化異常處理 - 驗證
ProblemDetails和ValidationProblemDetails標準格式 - 使用 Flurl 簡化 HTTP 測試的 URL 建構
- 使用 AwesomeAssertions 進行精確的 HTTP 回應驗證
- 建立多容器 (PostgreSQL + Redis) 測試環境
核心概念
IExceptionHandler - 現代化異常處理
ASP.NET Core 8+ 引入的 IExceptionHandler 介面提供了比傳統 middleware 更優雅的錯誤處理方式。GlobalExceptionHandler 依據例外類型(KeyNotFoundException → 404、ArgumentException → 400、其他 → 500)產生對應的 ProblemDetails 回應。
ProblemDetails 標準格式
RFC 7807 定義的統一錯誤回應格式:
| 欄位 | 說明 |
|---|---|
type |
問題類型的 URI |
title |
簡短的錯誤描述 |
status |
HTTP 狀態碼 |
detail |
詳細的錯誤說明 |
instance |
發生問題的實例 URI |
ValidationProblemDetails - 驗證錯誤專用
繼承自 ProblemDetails,額外包含 errors 字典,記錄每個欄位的驗證錯誤訊息。
FluentValidation 異常處理器
FluentValidation 異常處理器實作 IExceptionHandler 介面,專門處理 ValidationException,將驗證錯誤轉換為標準的 ValidationProblemDetails 格式回應。處理器之間按照註冊順序執行,特定處理器(如 FluentValidation)必須在全域處理器之前註冊。
完整實作程式碼請參閱 references/exception-handler-details.md
整合測試基礎設施
測試基礎設施由三個核心組件構成:
- TestWebApplicationFactory:繼承
WebApplicationFactory<Program>,配置多容器(PostgreSQL + Redis)與 DI 替換(如 FakeTimeProvider) - IntegrationTestCollection:Collection Fixture 定義,確保容器共享
- IntegrationTestBase:測試基底類別,提供 HttpClient、DatabaseManager、FlurlClient 與時間控制方法
完整基礎設施程式碼請參閱 references/test-infrastructure.md
Flurl 簡化 URL 建構
// 傳統方式
var url = $"/products?pageSize={pageSize}&page={page}&keyword={keyword}";
// 使用 Flurl
var url = "/products"
.SetQueryParam("pageSize", 5)
.SetQueryParam("page", 2)
.SetQueryParam("keyword", "特殊");
測試範例
涵蓋成功建立產品(201 Created)、驗證錯誤(400 BadRequest + ValidationProblemDetails)、資源不存在(404 NotFound + ProblemDetails)、分頁查詢(200 OK + PagedResult)等完整測試範例,以及 TestHelpers 資料管理策略。
完整測試範例與資料管理程式碼請參閱 references/test-examples.md
What ships with it
11 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/exception-handler-details.md 2.4 KB
- references/test-examples.md 3.3 KB
- references/test-infrastructure.md 3.8 KB
- templates/create-products-table.sql 732 B
- templates/database-manager.cs 4.5 KB
- templates/fluent-validation-exception-handler.cs 2.7 KB
- templates/global-exception-handler.cs 3.3 KB
- templates/integration-test-base.cs 2.8 KB
- templates/products-controller-tests.cs 9.4 KB
- templates/test-project.csproj 2.3 KB
- templates/test-web-application-factory.cs 3.8 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 171 lines · 201 tokens per session scan A 3a1bcf6f2b90
dotnet-testing-advanced-webapi-integration-testing is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 20d ago), licensed MIT. It adds 201 tokens to every session and 2,080 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
clean-architecture-dotnet
Use when domain logic leaks into API/Infrastructure, project references violate layer boundaries, or you need to decide between CQS (always), CQRS bus (complex domains), and DDD patterns (invariants and events).
creating-dotnet-mcp-servers
Use when building Model Context Protocol (MCP) servers in .NET, configuring tools, transports (SSE/stdio), JSON serialization for AOT, or testing MCP endpoints.
dpg-migration
Migration logic for Azure SDK for .NET data-plane libraries migrating from AutoRest/Swagger to TypeSpec-based generation. Uses MCP tools from the generator-agent server for automated deterministic fixes.
mitigate-breaking-changes
Patterns and techniques for mitigating breaking changes in Azure management-plane SDKs. Covers SDK-side customizations (partial classes, CodeGenType, CodeGenSuppress) and TypeSpec decorator customizations (clientName, access, markAsPageable, alternateType, hierarchyBuilding).
generate-code-cs
Generate the code from typespec for C#. Parameter: C# SDK repository root location .
author-test
Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.