Work through the remaining P2 items in TODO.MD on the newtonsoft-json-migration branch. All work is committed and pushed. Pick up with the next unchecked testing item.
newtonsoft-json-migration — all 216 tests pass. Do not merge to master until the branch is ready.
83400ca— P2: extract TestConstants; remove 4 duplicateprivate const string Tokendeclarations across test files; createdtests/RedcapApi.Tests/TestConstants.cswithToken = "token123"andBaseUrl = "http://localhost/"0e1759f— P1/P2: stale CI cleanup, NetAnalyzers, .editorconfig, global.json, build.ps1, CHANGELOG, Utils refactors (string.Join + ConcurrentDictionary cache), PayloadKey constants class across all 17 partial files
- Remove stale CI/packaging refs from CLAUDE.md
- Fix dependency description in CLAUDE.md
- Remove CI badges from README.md
- Remove Newtonsoft.Json from Directory.Packages.props
- Create CHANGELOG.md
- Simplify ConvertArraytoString() — string.Join
- Cache reflection in GetDisplayName — ConcurrentDictionary
- Introduce PayloadKey static constants class
- Add .editorconfig
- Add global.json
- Add Microsoft.CodeAnalysis.NetAnalyzers
- Add build.ps1
- Extract TestConstants from test files
P2 — Convert copy-paste overload tests to [Theory] + [InlineData]
RedcapApiTransportTests.cshas 152[Fact]methods and zero[Theory]usages. Many tests for overload variants differ only in which optional arguments are omitted. Identify clusters of structurally identical tests (e.g., multipleExportArmsAsyncoverloads that each assertcontent=arm) and consolidate them into[Theory]+[InlineData]or[MemberData]. Target ≥20% reduction in total[Fact]count without losing any assertion coverage.
- Read
tests/RedcapApi.Tests/RedcapApiTransportTests.cs— it is ~2600 lines - Look for clusters of
[Fact]methods with names likeExportArmsAsync_DefaultOverload_*/ExportArmsAsync_ContentOverload_*that assert the same payload keys with no variation - Collapse each cluster into a single
[Theory]+[InlineData](or[MemberData]if setup differs) - Target: reduce from ~152
[Fact]s to ≤121 (≥20% reduction) - Run
dotnet test— all 216 must still pass - Commit and push
Remaining P2 items in order:
- Add cancellation forwarding tests for all domain areas (Arms, DAGs, Events, FieldNames, FileRepository, Instruments, Logging, Metadata, Projects, RepeatingInstruments, Reports, Surveys, UserRoles, Version) — pattern in
CancellationTests.cs - Add
ConcurrencyTests.cs - Extend
FakeTransportwithAllPayloadshistory (AllDictionaryPayloads,AllMultipartPayloadslists) - Create
ValidationTests.csfor guard-clause coverage - Add 429 and 503 to
HttpErrorTests.cs+ malformed JSON body test - Expand E2E test suite (ImportRecordsAsync, ExportUsersAsync/Typed, file round-trip, ExportSurveyLinkAsync)
- RecordExportOptions / RecordImportOptions parameter objects
Then P1: merge newtonsoft-json-migration → master and delete the branch.
tests/RedcapApi.Tests/RedcapApiTransportTests.cs— main transport test file (~2600 lines, 152 [Fact]s)tests/RedcapApi.Tests/CancellationTests.cs— cancellation pattern to replicatetests/RedcapApi.Tests/TestConstants.cs— shared Token + BaseUrl constantsTODO.MD— authoritative backlog; tick items[x]as completedsrc/RedcapApi/Api/PayloadKey.cs— wire key constants