feat: Phase 5.1 surface IMockFileDataAccessor enumeration properties#14
Conversation
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.
|
There was a problem hiding this comment.
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
AnalyzePropertyReferenceto recognize bothMockFileSystem(concrete) andIMockFileDataAccessor(interface) receivers and classify enumeration property names via a newClassifyEnumerationPropertyhelper. - Adds four new pattern constants (
MockFileSystemAllPaths/AllFiles/AllDirectories/AllDrives) inPatterns.cs. - Adds analyzer tests covering all four properties on both receiver types,
HasNoFixtests in the code-fix test suite, and parity playground fixtures forAllFilesandAllDirectories.
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.

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:
Tests cover all four properties on both receiver types and HasNoFix for each. Playground gains parity samples for AllFiles and AllDirectories.