一键导入
test
Add or modify tests for PhotoManager following project conventions. Use this skill when asked to write tests, add test coverage, or fix failing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Add or modify tests for PhotoManager following project conventions. Use this skill when asked to write tests, add test coverage, or fix failing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add or modify tests following project conventions. Use when asked to write tests, add test coverage, or fix failing tests.
Avalonia UI reference guide for PhotoManager: UI conventions, MVVM patterns, and cross-platform UI patterns. Use this skill when working on UI code, adding image-processing methods, or needing to understand the Avalonia UI layer of the application.
Refactor code following Clean Architecture patterns. Use when asked to restructure, extract, move, or reorganize code while preserving behavior.
Avalonia UI reference guide for PhotoManager: UI conventions, MVVM patterns, and cross-platform UI patterns. Use this skill when working on UI code, adding image-processing methods, or needing to understand the Avalonia UI layer of the application.
Refactor PhotoManager code following Clean Architecture patterns. Use this skill when asked to restructure, extract, move, or reorganize code while preserving behavior.
Implement a new feature for PhotoManager with full workflow. Use when asked to add new functionality, implement a user story, or add a new capability.
| name | test |
| description | Add or modify tests for PhotoManager following project conventions. Use this skill when asked to write tests, add test coverage, or fix failing tests. |
You are adding or modifying tests for PhotoManager.
Follow this workflow in order:
Read existing tests to understand patterns in PhotoManager.Tests/.
Use this exact test structure:
[TestFixture]
public class ClassNameTests
{
private string? _assetsDirectory;
private string? _databaseDirectory;
private TestLogger<ClassName> _testLogger = new();
[OneTimeSetUp]
public void OneTimeSetUp()
{
_assetsDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, Directories.TEST_FILES);
_databaseDirectory = Path.Combine(_assetsDirectory, Directories.DATABASE_TESTS);
}
[SetUp]
public void SetUp()
{
_testLogger = new TestLogger<ClassName>();
}
[TearDown]
public void TearDown()
{
_testableAssetRepository?.Dispose();
TearDownHelper.DeleteTempDbDirectories(_databaseDirectory!);
_testLogger.LoggingAssertTearDown();
}
[Test]
public void MethodName_Situation_ExpectedResult()
{
// Arrange / Act / Assert
_testLogger.AssertLogExceptions([], typeof(ClassName));
}
}
For static methods, use TestLogger<ClassNameTests> instead.
Check GlobalUsings.cs before adding any using directives.
Use existing helpers only — never duplicate:
TestLogger<T> — logging verificationDirectoryHelper — directory access controlImageHelper — creating invalid test imagesPhotoManager.Tests.Unit.ConstantsTest naming (NON-NEGOTIABLE): MethodName_Situation_ExpectedResult
CalculateHash_ValidFile_ReturnsHashValue, DeleteAsset_AssetExists_RemovesAssetFromDatabaseAlways verify logs in assertions and always cleanup in finally blocks.
100% coverage for all new code — every branch, exception path, and edge case.
Cross-platform (NON-NEGOTIABLE): tests run on Windows, Linux, and macOS CI and must pass on all three. On Linux/macOS \ is not a path separator and C:\... is not rooted, so Path.* calls diverge from Windows.
Never assert on a Windows-only absolute path routed through a Path API — wrap it with PathHelper.ToPlatformAbsolutePath(@"C:\Dir") (or PathHelper.ToResolvedConfigPath(...) for a resolved config path), build expected paths with Path.Combine exactly as production does, and reference test files with their exact on-disk case.
Opaque path strings (stored/asserted verbatim, e.g. config values or sync definitions) are fine.
Build: dotnet build PhotoManager/PhotoManager.slnx — zero warnings.
Run: dotnet test --filter "FullyQualifiedName~ClassName" PhotoManager/PhotoManager.slnx