Skip to content

feat: Phase 5.1 surface IMockFileDataAccessor enumeration properties#14

Merged
vbreuss merged 1 commit into
mainfrom
feat/phase-5.1-enumerations
May 15, 2026
Merged

feat: Phase 5.1 surface IMockFileDataAccessor enumeration properties#14
vbreuss merged 1 commit into
mainfrom
feat/phase-5.1-enumerations

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented May 15, 2026

TestableIO's MockFileSystem exposes four enumeration properties through IMockFileDataAccessor — AllPaths, AllFiles, AllDirectories, AllDrives — that enumerate the entire mocked file system. Testably has no direct equivalent. The natural replacements (Directory.EnumerateFiles / EnumerateDirectories against a root path, or DriveInfo.GetDrives() + SelectMany for multi-drive setups) require context the analyzer cannot infer safely, so each property gets its own pattern id and the code-fix provider intentionally falls through with no rewrite — the user picks the right replacement per call site.

Analyzer changes:

  • AnalyzePropertyReference now handles MockFileSystem and IMockFileDataAccessor receivers in addition to MockFileData. The new branch classifies the property name via ClassifyEnumerationProperty and reports the discriminating pattern id before the existing MockFileData logic.
  • The receiver-type gate covers both the concrete class (when the property is hidden/re-declared on MockFileSystem) and the interface (when the receiver is typed as IMockFileDataAccessor).

Tests cover all four properties on both receiver types and HasNoFix for each. Playground gains parity samples for AllFiles and AllDirectories.

TestableIO's MockFileSystem exposes four enumeration properties through
IMockFileDataAccessor — AllPaths, AllFiles, AllDirectories, AllDrives —
that enumerate the entire mocked file system. Testably has no direct
equivalent. The natural replacements (Directory.EnumerateFiles /
EnumerateDirectories against a root path, or DriveInfo.GetDrives() +
SelectMany for multi-drive setups) require context the analyzer cannot
infer safely, so each property gets its own pattern id and the code-fix
provider intentionally falls through with no rewrite — the user picks
the right replacement per call site.

Analyzer changes:
- AnalyzePropertyReference now handles MockFileSystem and
  IMockFileDataAccessor receivers in addition to MockFileData. The new
  branch classifies the property name via ClassifyEnumerationProperty and
  reports the discriminating pattern id before the existing MockFileData
  logic.
- The receiver-type gate covers both the concrete class (when the
  property is hidden/re-declared on MockFileSystem) and the interface
  (when the receiver is typed as IMockFileDataAccessor).

Tests cover all four properties on both receiver types and HasNoFix for
each. Playground gains parity samples for AllFiles and AllDirectories.
@vbreuss vbreuss self-assigned this May 15, 2026
Copilot AI review requested due to automatic review settings May 15, 2026 07:23
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 15, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Phase 5.1 surfaces the four IMockFileDataAccessor enumeration properties (AllPaths, AllFiles, AllDirectories, AllDrives) as analyzer diagnostics with distinct pattern ids. Because Testably has no direct equivalent and the correct replacement depends on the user's drive layout, the code-fix provider intentionally falls through without offering a rewrite, leaving migration as a manual step per call site.

Changes:

  • Extends AnalyzePropertyReference to recognize both MockFileSystem (concrete) and IMockFileDataAccessor (interface) receivers and classify enumeration property names via a new ClassifyEnumerationProperty helper.
  • Adds four new pattern constants (MockFileSystemAllPaths/AllFiles/AllDirectories/AllDrives) in Patterns.cs.
  • Adds analyzer tests covering all four properties on both receiver types, HasNoFix tests in the code-fix test suite, and parity playground fixtures for AllFiles and AllDirectories.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Source/Testably.Abstractions.Migration.Analyzers/Patterns.cs Adds four enumeration pattern ids with documentation.
Source/Testably.Abstractions.Migration.Analyzers/SystemIOAbstractionsAnalyzer.cs Generalises property-reference analysis to also classify enumeration properties on MockFileSystem/IMockFileDataAccessor receivers.
Tests/Testably.Abstractions.Migration.Tests/SystemIOAbstractionsAnalyzerTests.cs Adds theory + fact tests for diagnostic on both receiver types.
Tests/Testably.Abstractions.Migration.Tests/SystemIOAbstractionsCodeFixProviderTests.AccessorMethodTests.cs Adds HasNoFix theory verifying no rewrite is registered.
Tests/Testably.Abstractions.Migration.SystemIOAbstractionsPlayground/AccessorMethodTests.cs Adds playground baselines for AllFiles/AllDirectories enumeration behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

Test Results

  6 files  ± 0    6 suites  ±0   1m 31s ⏱️ +8s
135 tests +11  135 ✅ +11  0 💤 ±0  0 ❌ ±0 
405 runs  +33  403 ✅ +33  2 💤 ±0  0 ❌ ±0 

Results for commit 1e0a839. ± Comparison against base commit e934b74.

@vbreuss vbreuss merged commit 3a4517e into main May 15, 2026
13 checks passed
@vbreuss vbreuss deleted the feat/phase-5.1-enumerations branch May 15, 2026 07:30
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.

2 participants