CodeVetter · Repo Unpack · Testing signals
2dust/v2rayN
Tests live exclusively in ServiceLib.Tests and use TUnit (not xUnit/NUnit) with TUnit.Assertions.Should fluent assertions. Coverage concentrates on the pure/parsing layers: Fmt share-URI round-trips, V2ray and sing-box config generation, CoreConfigContextBuilder behavior, HTTP request-header parsing, a regex guard, and CoreManager helpers. The CI test workflow runs 'dotnet test' on ubuntu-latest against .NET 10.x and publishes TRX results to PRs. There are no UI tests for either shell and no tests over SQLite persistence, process spawning, sysproxy, or the updater.
- ServiceLib.Tests targets net10.0 with TUnit + TUnit.Assertions.Should packages and ProjectReference to ServiceLib; tests use [Test] attributes and 'await x.Should().BeEqualTo(...)' assertions.
- CI test job (.github/workflows/test.yml) runs only when ServiceLib, ServiceLib.UdpTest, ServiceLib.Tests, Directory.Build.*, Directory.Packages.props, global.json or the workflow itself change — edits confined to v2rayN/ or v2rayN.Desktop/ UI code never trigger tests.
- FmtHandlerTests contains a coverage contract: ShareProfileFactories must match Global.ProtocolShares keys exactly, then every exportable protocol is round-tripped ExportThenImport asserting ConfigType/Address/Port survive — so adding a new protocol without a test fails the suite.
- Core config generation has dedicated large suites: CoreConfigV2rayServiceTests (~716 lines) and CoreConfigSingboxServiceTests (~755 lines) plus CoreConfigContextBuilderTests and a shared CoreConfigTestFactory for building test configs.
- Other covered units: per-Fmt tests (InnerFmtTests, WireguardFmtTests, ShareUriQueryTests, Hysteria2FmtTests, HyRealmTests), HttpRequestHeadersHelperTests, RegexGuardTests, DownloadServiceHeadersTests and CoreManagerTests (which can exercise ShouldRunAsSudo logic).
- Untested surfaces include both UI shells (no test project references v2rayN or v2rayN.Desktop), SQLite migrations in AppManager.MigrateProfileExtra*, SysProxyHandler/PacManager OS integration, ProcessService/WindowsJobService process lifecycle, AmazTool, and UpdateService download/upgrade — none have test files.
- ServiceLib.UdpTest is a referenced library project (not a test suite despite the name) providing Socks5UdpChannel used by SpeedtestService for UDP testing.
- Test results are published back to PRs as TRX via EnricoMi/publish-unit-test-result-action with comment_mode 'failures'; the test command is 'dotnet test --project ./v2rayN/ServiceLib.Tests -c Release'.
- No lint/static-analysis workflow exists beyond a CodeFactor badge in the README; there is no code-coverage collection in the test workflow (no coverlet/collector packages in the test csproj).