Skip to content

feat: add drive info expectations#146

Merged
vbreuss merged 1 commit into
mainfrom
feat/drive-info-extensions
May 19, 2026
Merged

feat: add drive info expectations#146
vbreuss merged 1 commit into
mainfrom
feat/drive-info-extensions

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented May 19, 2026

This pull request adds comprehensive support for drive-level assertions to the testing library, both in documentation and implementation. It introduces new extension methods for asserting properties of IDriveInfo objects, such as drive existence, readiness, size, format, and more. The documentation is updated to demonstrate these new capabilities, and the codebase now includes several new files implementing these assertions.

Drive assertion support:

  • Added HasDrive and DoesNotHaveDrive extension methods to IFileSystem for asserting the presence or absence of drives by name, with case-insensitive matching and .Which chaining to access IDriveInfo assertions.
  • Introduced a new partial class DriveInfoExtensions as the container for all drive-related assertion extensions.

Drive property assertions:

  • Added extension methods to IThat<IDriveInfo> for asserting drive properties:
    • IsReady and IsNotReady to check drive readiness
    • HasTotalSize, HasTotalFreeSpace, and HasAvailableFreeSpace for size-related assertions
    • HasDriveFormat, HasDriveType, HasName, and HasVolumeLabel for format, type, name, and label assertions

Documentation updates:

  • Expanded the README.md with a new "Drives" section, including usage examples for the new drive assertions and .Which chaining.
  • Updated documentation for .Which to include HasDrive in addition to HasFile and HasDirectory.

These changes significantly enhance the ability to write expressive and comprehensive tests involving file system drives.

@vbreuss vbreuss self-assigned this May 19, 2026
Copilot AI review requested due to automatic review settings May 19, 2026 06:26
@vbreuss vbreuss added the enhancement New feature or request label May 19, 2026
@vbreuss vbreuss enabled auto-merge (squash) May 19, 2026 06:26
@vbreuss vbreuss disabled auto-merge May 19, 2026 06:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Test Results

    7 files  ±  0      7 suites  ±0   47s ⏱️ +2s
  774 tests + 35    773 ✅ + 35  1 💤 ±0  0 ❌ ±0 
4 606 runs  +210  4 605 ✅ +210  1 💤 ±0  0 ❌ ±0 

Results for commit e9b25c1. ± Comparison against base commit 0669d8a.

♻️ This comment has been updated with latest results.

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

Adds drive-level assertions to aweXpect.Testably, enabling expressive expectations on IFileSystem drive presence via HasDrive/DoesNotHaveDrive (including .Which chaining), plus a set of IDriveInfo property assertions (readiness, sizes, format, type, name, volume label). Documentation and public API snapshots are updated accordingly.

Changes:

  • Introduces FileSystemExtensions.HasDrive / DoesNotHaveDrive and a new DriveResult<TParent> to support .Which chaining into IDriveInfo assertions.
  • Adds DriveInfoExtensions with multiple IThat<IDriveInfo> expectations (ready state, space/size, format/type, name/label).
  • Updates README and API approval test baselines to document/reflect the new surface area.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Tests/aweXpect.Testably.Tests/FileSystem.HasDrive.Which.Tests.cs Tests for .Which chaining from HasDrive into IDriveInfo assertions.
Tests/aweXpect.Testably.Tests/FileSystem.HasDrive.Tests.cs Tests for HasDrive success/failure and case-insensitive matching.
Tests/aweXpect.Testably.Tests/FileSystem.HasDrive.cs Test class scaffolding for HasDrive grouping.
Tests/aweXpect.Testably.Tests/FileSystem.DoesNotHaveDrive.Tests.cs Tests for DoesNotHaveDrive success/failure.
Tests/aweXpect.Testably.Tests/DriveInfo.IsReady.Tests.cs Tests for That(IDriveInfo).IsReady().
Tests/aweXpect.Testably.Tests/DriveInfo.IsNotReady.Tests.cs Tests for That(IDriveInfo).IsNotReady().
Tests/aweXpect.Testably.Tests/DriveInfo.HasVolumeLabel.Tests.cs Tests for HasVolumeLabel and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasTotalSize.Tests.cs Tests for HasTotalSize and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasTotalFreeSpace.Tests.cs Tests for HasTotalFreeSpace and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasName.Tests.cs Tests for HasName and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasDriveType.Tests.cs Tests for HasDriveType and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasDriveFormat.Tests.cs Tests for HasDriveFormat and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.HasAvailableFreeSpace.Tests.cs Tests for HasAvailableFreeSpace and negation behavior.
Tests/aweXpect.Testably.Tests/DriveInfo.cs Test class scaffolding for DriveInfo grouping.
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_netstandard2.0.txt Updates API snapshot for new drive assertions/results.
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_net8.0.txt Updates API snapshot for new drive assertions/results.
Tests/aweXpect.Testably.Api.Tests/Expected/aweXpect.Testably_net10.0.txt Updates API snapshot for new drive assertions/results.
Source/aweXpect.Testably/Results/DriveResult.cs Adds DriveResult<TParent> enabling .Which to continue with IDriveInfo expectations.
Source/aweXpect.Testably/FileSystemExtensions.HasDrive.cs Adds HasDrive/DoesNotHaveDrive extensions and drive resolution/constraint.
Source/aweXpect.Testably/DriveInfoExtensions.IsReady.cs Adds IsReady/IsNotReady assertions for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasVolumeLabel.cs Adds HasVolumeLabel assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasTotalSize.cs Adds HasTotalSize assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasTotalFreeSpace.cs Adds HasTotalFreeSpace assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasName.cs Adds HasName assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasDriveType.cs Adds HasDriveType assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasDriveFormat.cs Adds HasDriveFormat assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.HasAvailableFreeSpace.cs Adds HasAvailableFreeSpace assertion for IDriveInfo.
Source/aweXpect.Testably/DriveInfoExtensions.cs Adds the DriveInfoExtensions partial class container.
README.md Documents new drive assertions and .Which chaining usage.

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

Comment thread Source/aweXpect.Testably/Results/DriveResult.cs
Comment thread Source/aweXpect.Testably/FileSystemExtensions.HasDrive.cs Outdated
Comment thread Source/aweXpect.Testably/DriveInfoExtensions.HasTotalSize.cs
Comment thread Source/aweXpect.Testably/DriveInfoExtensions.HasTotalFreeSpace.cs
Comment thread Source/aweXpect.Testably/DriveInfoExtensions.HasDriveFormat.cs
Comment thread Source/aweXpect.Testably/DriveInfoExtensions.HasVolumeLabel.cs
Comment thread README.md Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.4 LTS (Noble Numbat)
AMD EPYC 9V74 2.87GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.300
[Host] : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3
DefaultJob : .NET 10.0.8 (10.0.8, 10.0.826.23019), X64 RyuJIT x86-64-v3

Method Mean Error StdDev Gen0 Gen1 Allocated
Dummy_aweXpect 5.367 μs 0.1062 μs 0.1774 μs 0.4349 0.0916 7.19 KB

@vbreuss vbreuss force-pushed the feat/drive-info-extensions branch from 1f49d46 to e9b25c1 Compare May 19, 2026 12:50
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

👽 Mutation Results

Mutation testing badge

aweXpect.Testably

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
DriveInfoExtensions.HasAvailableFreeSpace.cs 47.06% 8 0 0 9 7 13 8 9 37
DriveInfoExtensions.HasDriveFormat.cs 43.75% 7 0 0 9 7 11 7 9 34
DriveInfoExtensions.HasDriveType.cs 47.06% 8 0 0 9 7 13 8 9 37
DriveInfoExtensions.HasName.cs 25.00% 4 3 0 9 7 11 4 12 34
DriveInfoExtensions.HasTotalFreeSpace.cs 47.06% 8 0 0 9 7 13 8 9 37
DriveInfoExtensions.HasTotalSize.cs 52.94% 9 0 0 8 7 13 9 8 37
DriveInfoExtensions.HasVolumeLabel.cs 25.00% 4 3 0 9 7 11 4 12 34
DriveInfoExtensions.IsReady.cs 68.75% 11 0 0 5 7 10 11 5 33
FileSystemExtensions.HasDrive.cs 100.00% 11 0 0 0 2 10 11 0 23
Results\DriveResult.cs 100.00% 2 0 0 0 0 0 2 0 2

The final mutation score is 49.66%

Coverage Thresholds: high:80 low:60 break:0

@vbreuss vbreuss merged commit bb4df6c into main May 19, 2026
12 checks passed
@vbreuss vbreuss deleted the feat/drive-info-extensions branch May 19, 2026 12:57
@github-actions
Copy link
Copy Markdown

This is addressed in release v0.15.0.

@github-actions github-actions Bot added the state: released The issue is released label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants