dotnet-testing-advanced-aspnet-integration-testing

dotnet-testing-advanced-aspnet-integration-testing is a skill for Claude Code, Codex from kevintsengtw/dotnet-testing-agent-skills. It costs 210 tokens per session (2,776 once invoked), scanned A, original, MIT.

Guidance for ASP.NET Core integration tests, which test several web application parts together through HTTP requests and responses.

In plain words
What is it for?
Use it to build tests with WebApplicationFactory, TestServer, and HttpClient, including test services and in-memory data.
Why use it?
It helps verify routing, middleware, dependency injection, configuration, and error handling in an environment close to the running application.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build tests with WebApplicationFactory, TestServer, and HttpClient, including test services and in-memory data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing
Install

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.

Any agent
npx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-advanced-aspnet-integration-testing
Clone the repo
git clone --depth 1 https://github.com/kevintsengtw/dotnet-testing-agent-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for dotnet-testing-advanced-aspnet-integration-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing/github.svg)](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing)
Your own site
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dotnet-testing-advanced-aspnet-integration-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-aspnet-integration-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 210 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,776 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00210 $0.02776
Opus 5 $0.00105 $0.01388
Sonnet 5 $0.00042 $0.00555
Haiku 4.5 $0.00021 $0.00278

Measured 9d ago against content hash d197d0a1be98, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

dotnet-testing-advanced-aspnet-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 9d 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.

skills/dotnet-testing-advanced-aspnet-integration-testing/SKILL.md · 213 lines

How it starts

The opening of the file, as written. The whole thing — 213 lines — stays where its author put it; the contents beside it link to each section on GitHub.

ASP.NET Core 整合測試指南

核心概念

整合測試的兩種定義

  1. 多物件協作測試 — 將兩個以上的類別做整合,測試它們之間的運作是否正確
  2. 外部資源整合測試 — 使用到資料庫、外部服務、檔案等外部資源的測試

為什麼需要整合測試?

  • 確保多個模組整合後能正確工作
  • 單元測試無法涵蓋的整合點:Routing、Middleware、Request/Response Pipeline
  • 確認 WebApplication 的整合與設定是否正確
  • 確認異常處理是否完善

測試金字塔定位

測試類型 測試範圍 執行速度 維護成本 建議比例
單元測試 單一類別/方法 很快 70%
整合測試 多個元件 中等 中等 20%
端對端測試 完整流程 10%

原則一:使用 WebApplicationFactory 建立測試環境

透過 WebApplicationFactory<Program> 建立記憶體中的 TestServer,搭配 IClassFixture 在測試類別間共享。

基本流程

  1. 測試類別實作 IClassFixture<WebApplicationFactory<Program>>
  2. 透過建構函式注入 Factory
  3. 使用 factory.CreateClient() 建立 HttpClient
  4. 對 API 端點發送請求並驗證回應

自訂 Factory

繼承 WebApplicationFactory<Program> 並覆寫 ConfigureWebHost

  • 移除原本的 DbContextOptions,改用 UseInMemoryDatabase
  • 使用 services.Replace() 替換外部服務為測試版本
  • 設定 builder.UseEnvironment("Testing") 使用測試環境

測試基底類別

建立 IntegrationTestBase 封裝共用邏輯:

  • Factory 與 HttpClient 初始化
  • SeedShipperAsync() 等資料準備方法
  • CleanupDatabaseAsync() 清理方法
  • 實作 IDisposable 確保資源釋放

完整程式碼範例(基本使用、自訂 Factory、測試基底類別)請參考 references/webapplicationfactory-examples.md

原則二:使用 AwesomeAssertions.Web 驗證 HTTP 回應

提供流暢的 HTTP 狀態碼斷言與強型別回應驗證:

  • 狀態碼斷言Be200Ok()Be201Created()Be400BadRequest()Be404NotFound()
  • Satisfy 驗證response.Should().Be200Ok().And.Satisfy<T>(result => { ... })
  • 優勢:取代手動 ReadAsStringAsync() + JsonSerializer.Deserialize<T>() 的冗長程式碼

原則三:使用 System.Net.Http.Json 簡化 JSON 操作

  • PostAsJsonAsync(url, object) — 取代手動 JsonSerializer.Serialize + new StringContent
  • ReadFromJsonAsync<T>() — 取代手動 ReadAsStringAsync + JsonSerializer.Deserialize

完整斷言與 JSON 操作範例請參考 references/assertion-and-json-examples.md

三個層級的整合測試策略

Read the full file on GitHub · 213 lines

Changes

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.

  1. 9d ago First seen · 213 lines · 210 tokens per session scan A d197d0a1be98

Subscribe to this mod's changes

dotnet-testing-advanced-aspnet-integration-testing is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 23d ago), licensed MIT. It adds 210 tokens to every session and 2,776 once invoked, about $0.0011 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.

Related

Other skills, from other repositories

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.

Azure/azure-sdk-for-net · 68 tokens

migrate-mstest-v3-to-v4

Use this skill before answering, planning, or editing any MSTest 3.x-to-4.x upgrade or post-upgrade failure. Triggers include "MSTest v4 breaking changes"; CS0507/CS0103/CS1061/CS1615; ExecuteAsync, CallerInfo, DisplayName, or custom TestMethodAttribute; ClassCleanupBehavior; ContainsKey; ThrowsExactly or…

managedcode/dotnet-skills · 179 tokens

migrate-xunit-to-mstest

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…

managedcode/dotnet-skills · 141 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

aspire-integration-testing

Write integration tests using .NET Aspire's testing facilities with xUnit. Covers test fixtures, distributed application setup, endpoint discovery, and patterns for testing ASP.NET Core apps with real dependencies.

Aaronontheweb/dotnet-skills · 43 tokens

archunitnet

Use the open-source free ArchUnitNET library for architecture rules in .NET tests. Use when a repo needs richer architecture assertions than lightweight fluent rule libraries usually provide. USE FOR: the repo uses or wants ArchUnitNET; architecture testing needs richer modeling than simple dependency checks. DO NOT…

managedcode/dotnet-skills · 104 tokens