test: 添加 CLI 命令单元测试

This commit is contained in:
Scottxjw
2026-08-17 09:24:57 +08:00
parent d45d9f4ca3
commit 759da546ee
14 changed files with 950 additions and 1 deletions

View File

@@ -48,6 +48,21 @@
| ORM | Entity Framework Core | 8.0 |
| 数据库 | SQLite / PostgreSQL | - |
| CLI | System.CommandLine | 2.0-beta4 |
| 测试 | NUnit | 4.2 |
---
## 测试
CLI 单元测试项目位于 `tests/Gpulse.WCT.DataAnalyzer.Tests`,使用 NUnit + 内存 SQLite
- 直接实例化 `ParseCommand` / `AggregateCommand` / `ExportCommand` / `CleanCommand` / `AnalyzeCommand`(构造方式与 `Program.Main` 一致),验证命令绑定、参数解析与输出。
- 每个测试独立的「本地库/发布库」内存连接 + 临时日志 fixture 目录,互不污染。
- 不启动完整 Host/Serilog仅覆盖 CLI 命令层行为。
```bash
dotnet test Gpulse.WCT.DataAnalyzer.sln
```
---