aweXpect.Testably
3.0.0
Prefix Reserved
dotnet add package aweXpect.Testably --version 3.0.0
NuGet\Install-Package aweXpect.Testably -Version 3.0.0
<PackageReference Include="aweXpect.Testably" Version="3.0.0" />
<PackageVersion Include="aweXpect.Testably" Version="3.0.0" />
<PackageReference Include="aweXpect.Testably" />
paket add aweXpect.Testably --version 3.0.0
#r "nuget: aweXpect.Testably, 3.0.0"
#:package aweXpect.Testably@3.0.0
#addin nuget:?package=aweXpect.Testably&version=3.0.0
#tool nuget:?package=aweXpect.Testably&version=3.0.0
aweXpect.Testably
Expectations for the file system and time system mocks from Testably.Abstractions for aweXpect.
Installation
dotnet add package aweXpect.Testably
It does not include aweXpect itself.
At a glance
using aweXpect.Chronology; // from the aweXpect.Chronology package
using static aweXpect.Expect;
MockFileSystem fileSystem = new();
fileSystem.File.WriteAllText("let-it-be.txt", "let it be");
// verify that a file exists, together with its content
await That(fileSystem).HasFile("let-it-be.txt").WithContent("LET IT BE").IgnoringCase();
// verify the properties of the found file
await That(fileSystem).HasFile("let-it-be.txt").Which.HasLength(9);
// verify that a file does not exist
await That(fileSystem).DoesNotHaveFile("yesterday.txt");
// verify the notifications the file system raised
await That(fileSystem).TriggeredNotification(c => c.Name == "let-it-be.txt");
// verify the method calls the file system recorded
await That(fileSystem.Statistics).Recorded().File.WriteAllText().Once();
// verify how often the callback of a timer from a MockTimeSystem was executed
MockTimeSystem timeSystem = new();
ITimerMock timer = (ITimerMock)timeSystem.Timer.New(_ => { }, null, TimeSpan.Zero, 10.Milliseconds());
await That(timer).Executed().AtLeast(3.Times()).Within(5.Seconds());
A failing expectation on the file system names the path it looked for. If the file was never written,
HasFile("yesterday.txt") would fail with:
Expected that fileSystem
has file "yesterday.txt",
but it did not exist
Overview
Expectations for IFileSystem:
| Expectation | Negated | Summary |
|---|---|---|
HasFile |
DoesNotHaveFile |
contains the file, optionally with its content and timestamps |
HasDirectory |
DoesNotHaveDirectory |
contains the directory, optionally with its files and subdirectories |
HasDrive |
DoesNotHaveDrive |
contains the drive |
Expectations for IFileInfo:
| Expectation | Negated | Summary |
|---|---|---|
Exists |
DoesNotExist |
the file exists |
HasName |
has the expected name | |
HasExtension |
has the expected extension | |
HasLength |
has the expected length | |
HasContent |
HasContent().NotEqualTo |
has the expected string or binary content |
IsReadOnly |
IsNotReadOnly |
the file is read-only |
HasAttribute |
DoesNotHaveAttribute |
has the attribute flag |
HasCreationTime |
has the expected creation time, optionally within a tolerance | |
HasLastAccessTime |
has the expected last access time, optionally within a tolerance | |
HasLastWriteTime |
has the expected last write time, optionally within a tolerance | |
WhoseParent |
the containing directory meets expectations (.NET 10 or later) |
Expectations for IDirectoryInfo:
| Expectation | Negated | Summary |
|---|---|---|
Exists |
DoesNotExist |
the directory exists |
HasName |
has the expected name | |
IsEmpty |
IsNotEmpty |
contains no files or subdirectories |
HasFile |
DoesNotHaveFile |
contains the file |
HasDirectory |
DoesNotHaveDirectory |
contains the subdirectory |
HasAttribute |
DoesNotHaveAttribute |
has the attribute flag |
HasCreationTime |
has the expected creation time, optionally within a tolerance | |
HasLastAccessTime |
has the expected last access time, optionally within a tolerance | |
HasLastWriteTime |
has the expected last write time, optionally within a tolerance | |
WhoseParent |
the parent directory meets expectations (.NET 10 or later) |
Expectations for IDriveInfo:
| Expectation | Negated | Summary |
|---|---|---|
IsReady |
IsNotReady |
the drive is ready |
HasName |
has the expected name | |
HasVolumeLabel |
has the expected volume label | |
HasDriveFormat |
has the expected drive format | |
HasDriveType |
has the expected drive type | |
HasTotalSize |
has the expected total size | |
HasTotalFreeSpace |
has the expected total free space | |
HasAvailableFreeSpace |
has the expected available free space |
Expectations for IFileVersionInfo:
| Expectation | Negated | Summary |
|---|---|---|
HasCompanyName, HasFileMajorPart, IsDebug, … |
IsNotDebug, … |
one expectation per property |
Expectations for MockFileSystem:
| Expectation | Negated | Summary |
|---|---|---|
TriggeredNotification |
DidNotTriggerNotification |
the file system raised a matching notification |
Expectations for IFileSystemWatcher:
| Expectation | Negated | Summary |
|---|---|---|
Triggered |
DidNotTrigger |
the watcher raised a matching event |
Expectations for ChangeDescription:
| Expectation | Negated | Summary |
|---|---|---|
HasChangeType |
DoesNotHaveChangeType |
has the change type flag |
HasFileSystemType |
DoesNotHaveFileSystemType |
has the file system type flag |
HasNotifyFilters |
DoesNotHaveNotifyFilters |
has the notify filters flag |
HasName |
has the expected name | |
HasPath |
has the expected path | |
HasOldName |
has the expected old name of a renamed file or directory | |
HasOldPath |
has the expected old path of a renamed file or directory |
Expectations for IFileSystemStatistics:
| Expectation | Negated | Summary |
|---|---|---|
Recorded |
.Never() |
a method was called or a property was accessed |
Expectations for ITimerMock:
| Expectation | Negated | Summary |
|---|---|---|
Executed |
.Never() |
the timer callback was executed |
Documentation
The full documentation is available at docs.testably.org:
- File system: files, directories and drives of an
IFileSystem, and the expectations onIFileInfo,IDirectoryInfo,IDriveInfoandIFileVersionInfo - Notifications and recorded calls: file-system notifications, watcher events,
change descriptions and the calls recorded in
IFileSystemStatistics - Time system: the execution of
ITimerMocktimers
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- aweXpect.Core (>= 4.0.0)
- Testably.Abstractions.Testing (>= 8.0.0)
-
net10.0
- aweXpect.Core (>= 4.0.0)
- Testably.Abstractions.Testing (>= 8.0.0)
-
net8.0
- aweXpect.Core (>= 4.0.0)
- Testably.Abstractions.Testing (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on aweXpect.Testably:
| Repository | Stars |
|---|---|
|
TestableIO/System.IO.Abstractions
Just like System.Web.Abstractions, but for System.IO. Yay for testable IO access!
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 64 | 2026/11/11 |
| 3.0.0-pre.4 | 59 | 2026/11/10 |
| 3.0.0-pre.3 | 595 | 2026/10/29 |
| 3.0.0-pre.1 | 61 | 2026/10/28 |
| 2.1.0 | 814 | 2026/10/16 |
| 2.0.0 | 474 | 2026/10/10 |
| 2.0.0-pre.2 | 68 | 2026/10/8 |
| 2.0.0-pre.1 | 69 | 2026/9/28 |
| 1.1.0 | 551 | 2026/9/5 |
| 1.0.0 | 741 | 2026/6/4 |
| 0.15.0 | 2,443 | 2026/5/19 |
| 0.14.0 | 200 | 2026/5/18 |
| 0.13.0 | 5,288 | 2025/10/25 |
| 0.12.0 | 1,913 | 2025/9/10 |
| 0.11.0 | 1,511 | 2025/7/12 |
| 0.10.0 | 828 | 2025/6/30 |
| 0.9.0 | 2,017 | 2025/3/17 |
| 0.8.0 | 1,079 | 2025/3/2 |
| 0.7.0 | 510 | 2025/3/1 |
| 0.6.0 | 232 | 2025/2/16 |