refactor: Consolidate test source code to eliminate DRY violations#1683
Conversation
Extract duplicated test source code patterns across analyzer and serialization tests: - Create TestSourceConstants.cs with shared module header strings for analyzer tests - Create SerializationTestModels.cs with shared test model and values for JSON/XML/YAML tests - Update 7 analyzer test files to use shared TestSourceConstants - Update JsonTests, XmlTests, YamlTests to use shared SerializationTestModels Fixes #1634, fixes #1627 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SummaryRefactors analyzer and serialization unit tests to eliminate code duplication by extracting shared constants and models. Critical IssuesNone found ✅ SuggestionsNone - the refactoring is well-executed with proper curly brace escaping in interpolated strings and maintains all test semantics. Verdict✅ APPROVE - No critical issues This is a clean refactoring that:
The shared constants approach will make future test maintenance significantly easier. |
Add JsonIgnore attribute with WhenWritingNull condition to prevent the Items property from appearing as null in serialized JSON output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SummaryConsolidates duplicated test code by extracting shared constants and test models into dedicated files. Critical IssuesNone found ✅ SuggestionsString interpolation escaping: In several test files, the refactoring uses string interpolation with constants that contain interpolation markers like
Test coverage: The refactoring touches 7 analyzer test files and 3 serialization test files. Ensure all tests pass after this change, as incorrect escaping could cause test failures. Verdict✅ APPROVE - No critical issues This is a clean refactoring that eliminates significant code duplication. The use of shared constants makes the tests more maintainable and easier to update in the future. The string interpolation approach is sound, just verify all tests pass to confirm the escaping is correct. |
Summary
TestSourceConstants.cswith shared using statements and namespace constants for analyzer testsSerializationTestModels.cswith shared test models (TestValues,SerializationTestModel)Fixes #1634, #1627
Test plan
🤖 Generated with Claude Code