feat: add HasAttribute and DoesNotHaveAttribute methods for IDirectoryInfo extensions#150
Conversation
There was a problem hiding this comment.
Pull request overview
Adds HasAttribute and DoesNotHaveAttribute assertions for IDirectoryInfo, sharing the existing file-system attribute constraint logic with IFileInfo.
Changes:
- Introduces directory attribute assertion extensions.
- Refactors the file attribute constraint into shared file-system helper code.
- Adds unit and API snapshot coverage for the new directory APIs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
Source/aweXpect.Testably/DirectoryInfoExtensions.HasAttribute.cs |
Adds public directory attribute assertion methods. |
Source/aweXpect.Testably/FileInfoExtensions.HasAttribute.cs |
Reuses the shared attribute constraint for file assertions. |
Source/aweXpect.Testably/Helpers/FileSystemConstraints.cs |
Adds generic HasAttributeConstraint<TInfo> for file-system info types. |
Tests/aweXpect.Testably.Tests/DirectoryInfo.HasAttribute.Tests.cs |
Covers successful, failing, and invalid-argument cases for HasAttribute. |
Tests/aweXpect.Testably.Tests/DirectoryInfo.DoesNotHaveAttribute.Tests.cs |
Covers successful, failing, missing-directory, and invalid-argument cases for DoesNotHaveAttribute. |
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_netstandard2.0.txt |
Updates public API baseline for netstandard2.0. |
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_net8.0.txt |
Updates public API baseline for net8.0. |
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_net10.0.txt |
Updates public API baseline for net10.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
👽 Mutation ResultsaweXpect.TestablyDetails
The final mutation score is 76.70%Coverage Thresholds: high:80 low:60 break:0 |
🚀 Benchmark ResultsDetails
|
…tests now use only attributes intrinsic to a freshly created directory: - "is present" case → FileAttributes.Directory (always set on directories, all platforms). - "is absent" case → FileAttributes.ReadOnly (never auto-set, all platforms).
|
|
This is addressed in release v0.15.0. |



This pull request introduces support for verifying file attributes on directories in the
aweXpect.Testablylibrary, aligning the API forIDirectoryInfowith the existing support forIFileInfo. It also refactors attribute constraint logic for better code reuse, and adds comprehensive tests for the new functionality.New Features:
HasAttributeandDoesNotHaveAttributeextension methods forIDirectoryInfo, allowing assertions on directory attributes in a fluent style.IDirectoryInfo.Refactoring and Code Reuse:
FileSystemConstraints.HasAttributeConstraint<TInfo>class, now used by both file and directory attribute assertions. This removes duplicate code and ensures consistent behavior.Testing:
HasAttributeandDoesNotHaveAttributemethods onIDirectoryInfo, covering both success and failure scenarios as well as argument validation.