Skip to content

refactor: Consolidate encoding/hashing tests to eliminate DRY violations#1467

Merged
thomhurst merged 1 commit into
mainfrom
fix/issue-1455-test-dry
Dec 30, 2025
Merged

refactor: Consolidate encoding/hashing tests to eliminate DRY violations#1467
thomhurst merged 1 commit into
mainfrom
fix/issue-1455-test-dry

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • Consolidates 7 separate encoding/hashing test files into a single EncodingTests.cs file
  • Eliminates ~290 lines of duplicated test code while maintaining all 18 original test cases
  • Uses organized regions to group related tests (Base64, Hex, Hash algorithms)
  • Shared module definitions reduce repetitive boilerplate

Changes

Files Removed

  • Base64Tests.cs (67 lines)
  • HexTests.cs (67 lines)
  • Md5Tests.cs (38 lines)
  • Sha1Tests.cs (38 lines)
  • Sha256Tests.cs (38 lines)
  • Sha384Tests.cs (38 lines)
  • Sha512Tests.cs (38 lines)

Files Added

  • EncodingTests.cs - consolidated test class with all functionality preserved

Test Plan

  • All 18 encoding/hashing tests pass
  • Build succeeds without errors
  • Test coverage maintained (same test cases as before)

Closes #1455

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Consolidates 7 separate encoding/hashing test files into a single EncodingTests.cs file, reducing ~290 lines of duplicated code while preserving all 18 test cases.

Critical Issues

None found ✅

Suggestions

Remove Unused Test Data Methods

The methods BidirectionalEncodingData() and HashData() at lines 22-60 are defined but never used. They appear to be remnants from an attempt at data-driven testing that wasn't completed. Consider removing them to keep the code clean.

Location: test/ModularPipelines.UnitTests/Helpers/EncodingTests.cs:22-60

Similarly, the EncodingModule class (lines 70-82) is unused and should be removed.

Rationale: The current approach uses concrete module classes (ToBase64Module, FromBase64Module, etc.) which works fine for this test suite. The data-driven infrastructure adds unnecessary complexity without providing value.

Verdict

APPROVE - No critical issues

The consolidation successfully eliminates DRY violations while maintaining full test coverage. The unused code is minor cleanup that doesn't block the PR.

Replace 7 separate test files (Base64Tests, HexTests, Md5Tests,
Sha1Tests, Sha256Tests, Sha384Tests, Sha512Tests) with a single
EncodingTests.cs file that uses shared module definitions and
organized test regions.

This reduces ~290 lines of duplicated test code while maintaining
all 18 original test cases with identical functionality.

Closes #1455

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Summary

Consolidates 7 separate encoding/hashing test files into a single EncodingTests.cs file, reducing ~290 lines of duplicated code while preserving all 18 test cases.

Critical Issues

None found ✅

Suggestions

Remove Unused Test Data Methods

The methods BidirectionalEncodingData() (lines 22-33) and HashData() (lines 40-60) are defined but never used. They appear to be remnants from an attempt at data-driven testing that wasn't completed. Consider removing them to keep the code clean.

Similarly, the EncodingModule class (lines 70-82) is unused and should be removed.

Rationale: The current approach uses concrete module classes (ToBase64Module, FromBase64Module, etc.) which works fine for this test suite. The data-driven infrastructure adds unnecessary complexity without providing value.

Previous Review Status

One previous comment from github-actions bot approves the PR with the same suggestion to remove unused code.

Verdict

APPROVE - No critical issues

The consolidation successfully eliminates DRY violations while maintaining full test coverage. The unused code is minor cleanup that doesn't block the PR.

@thomhurst thomhurst merged commit b728f81 into main Dec 30, 2025
11 of 12 checks passed
@thomhurst thomhurst deleted the fix/issue-1455-test-dry branch December 30, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HIGH: Test code has 500+ lines of DRY violations in encoding tests

1 participant