一键导入
integration-testing
Guidelines for cross-layer testing (Hooks + UI + Services) using real logic and MSW for network interception.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guidelines for cross-layer testing (Hooks + UI + Services) using real logic and MSW for network interception.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Mandatory rule requiring a corresponding test file for every business logic file and UI component.
Guidelines for naming test folders and namespaces following the Unit.[Component] convention.
Catalog of all specialized skills used across the FinanzApp project (Frontend & Backend).
Guidelines for clean code, readability, and the "No Comments" policy.
Mandatory rule for EF Core migrations and database updates.
Mandatory rules for automatically updating README.md when creating files or tests.
| name | integration-testing |
| description | Guidelines for cross-layer testing (Hooks + UI + Services) using real logic and MSW for network interception. |
This skill defines how to implement and organize integration tests that validate the interaction between Endpoints, Services, and the Database.
Unlike unit tests that mock dependencies, integration tests in FinanzApp Backend use:
WebAPI/Endpoints/ are executed via HttpClient.Services/ is executed fully.Moq or a mock server (like WireMock.Net) to intercept external calls (CoinGecko, Yahoo Finance).All integration tests MUST be located in the global tests directory:
Tests/Integration/[Module]/[Feature]IntegrationTests.csMoq while keeping core internal logic untouched.AuthenticationHandler or a test JWT generator to simulate authenticated requests.// Tests/Integration/Auth/LoginFlowTests.cs
[Fact]
public async Task Login_ValidCredentials_ReturnsTokenAndUser()
{
// 1. Arrange: Prepare client and mock dependencies if needed
var client = _factory.CreateClient();
var loginDto = new LoginDto { Email = "test@example.com", Password = "Password123" };
// 2. Act: Call the real API endpoint
var response = await client.PostAsJsonAsync("/api/auth/login", loginDto);
// 3. Assert: Verify status code and content
response.EnsureSuccessStatusCode();
var result = await response.Content.ReadFromJsonAsync<LoginResultDto>();
Assert.NotNull(result.Token);
Assert.Equal("Agus", result.User.Name);
}