aweXpect.Testably 2.0.0

Prefix Reserved
dotnet add package aweXpect.Testably --version 2.0.0
                    
NuGet\Install-Package aweXpect.Testably -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="aweXpect.Testably" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="aweXpect.Testably" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="aweXpect.Testably" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add aweXpect.Testably --version 2.0.0
                    
#r "nuget: aweXpect.Testably, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package aweXpect.Testably@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=aweXpect.Testably&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=aweXpect.Testably&version=2.0.0
                    
Install as a Cake Tool

aweXpect.Testably

Changelog

Nuget Coverage Mutation testing badge

Expectations for the file system and time system mocks from Testably.Abstractions for aweXpect.

Overview

Subject Expectation Negated Summary
IFileSystem HasFile DoesNotHaveFile contains the file, with its content and timestamps
HasDirectory DoesNotHaveDirectory contains the directory, with its files and subdirectories
HasDrive DoesNotHaveDrive contains the drive
IFileInfo Exists DoesNotExist the file exists
HasName, HasExtension, HasLength, HasContent has the expected name, extension, length or content
IsReadOnly IsNotReadOnly the file is read-only
HasAttribute DoesNotHaveAttribute has the attribute flag
HasCreationTime, HasLastAccessTime, HasLastWriteTime has the expected timestamp, optionally within a tolerance
IDirectoryInfo Exists DoesNotExist the directory exists
IsEmpty IsNotEmpty the directory contains no files or subdirectories
HasFile, HasDirectory DoesNotHaveFile, DoesNotHaveDirectory contains the file or subdirectory
HasName, HasAttribute, Has…Time DoesNotHaveAttribute same as for IFileInfo
IDriveInfo IsReady IsNotReady the drive is ready
HasName, HasDriveFormat, HasDriveType, Has…Size, … has the expected property value
IFileVersionInfo Has…, Is… IsNot… one expectation per property
MockFileSystem TriggeredNotification DidNotTriggerNotification raised a matching change notification
IFileSystemWatcher Triggered DidNotTrigger raised a matching event
ChangeDescription HasChangeType, HasFileSystemType, HasNotifyFilters DoesNotHave… has the expected change flags
HasName, HasPath, HasOldName, HasOldPath has the expected (old) name or path
IFileSystemStatistics Recorded() a method was called or a property was accessed
ITimerMock Executed the timer callback was executed

The samples use the TimeSpan helpers (e.g. 5.Seconds()) from aweXpect.Chronology.

File system

You can verify that a file exists in an IFileSystem, together with its content, and continue with the found IFileInfo:

IFileSystem fileSystem = new MockFileSystem();
fileSystem.File.WriteAllText("let-it-be.txt", "let it be");

await Expect.That(fileSystem).HasFile("let-it-be.txt").WithContent("LET IT BE").IgnoringCase();
await Expect.That(fileSystem).HasFile("let-it-be.txt").Which.HasLength(9);
await Expect.That(fileSystem).DoesNotHaveFile("yesterday.txt");

For example, Expect.That(fileSystem).HasFile("yesterday.txt") fails with:

Expected that fileSystem
has file "yesterday.txt",
but it did not exist

Directories, drives and file version infos are covered in File system.

Notifications and recorded calls

You can verify the notifications a MockFileSystem raised and the calls it recorded:

MockFileSystem fileSystem = new();
fileSystem.File.WriteAllText("let-it-be.txt", "let it be");

await Expect.That(fileSystem).TriggeredNotification(c => c.Name == "let-it-be.txt");
await Expect.That(fileSystem.Statistics).Recorded().File.WriteAllText().Once();

Waiting for asynchronous notifications, watcher events and filtering recorded calls are covered in Notifications and recorded calls.

Time system

You can 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, TimeSpan.FromMilliseconds(10));

await Expect.That(timer).Executed().AtLeast(3.Times()).Within(5.Seconds());

See Time system for the details.

Documentation

The full documentation is available at docs.testably.org:

  • File system: files, directories and drives of an IFileSystem, and the expectations on IFileInfo, IDirectoryInfo, IDriveInfo and IFileVersionInfo
  • Notifications and recorded calls: file-system notifications, watcher events, change descriptions and the calls recorded in IFileSystemStatistics
  • Time system: the execution of ITimerMock timers
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.0.0 37 10/10/2026
2.0.0-pre.2 43 10/8/2026
2.0.0-pre.1 53 9/28/2026
1.1.0 530 9/5/2026
1.0.0 726 6/4/2026
0.15.0 2,399 5/19/2026
0.14.0 193 5/18/2026
0.13.0 5,256 10/25/2025
0.12.0 1,901 9/10/2025
0.11.0 1,500 7/12/2025
0.10.0 810 6/30/2025
0.9.0 2,009 3/17/2025
0.8.0 1,069 3/2/2025
0.7.0 501 3/1/2025
0.6.0 224 2/16/2025
0.5.0 216 2/14/2025
0.5.0-pre.1 432 1/31/2025
0.4.0 294 1/30/2025
0.3.0 722 1/18/2025
0.2.0 1,491 12/13/2024
Loading failed