Tags: Testably/Testably.Abstractions
Tags
chore: bump core version to 10.1.0 (#946) Updates centrally managed package versions to consume the stable `10.1.0` releases of the core Testably packages (moving off the prior RC), aligning dependency resolution across the repo (e.g., examples and helper projects that reference the NuGet packages).
fix: `Stopwatch` implementation on pre-release version 10.1.0-rc1 (#944) This PR completes the release workflow for core library version 10.1.0-rc1 by updating package versions and restoring the build pipeline to build all projects (both core and main). ### Key Changes: - Bumps core package versions from 10.0.0 to 10.1.0-rc1 in Directory.Packages.props - Resets BuildScope from CoreOnly to Default to enable building all projects again - Simplifies TestHelpers project references by removing unused Testably.Abstractions dependency
feat: add `Stopwatch` support to `ITimeSystem` (#943) Adds a `System.Diagnostics.Stopwatch` abstraction to `ITimeSystem`, enabling both `RealTimeSystem` and `MockTimeSystem` consumers to create/use stopwatches through a testable interface. ### Key Changes: - Introduces `IStopwatch` and `IStopwatchFactory` and wires them into `ITimeSystem`, `RealTimeSystem`, and `MockTimeSystem`. - Implements real wrappers (`StopwatchFactory`/`StopwatchWrapper`) and mock implementations (`StopwatchFactoryMock`/`StopwatchMock`), plus parity and unit tests. - Adds a feature flag for `Stopwatch.GetElapsedTime` (.NET 8 or higher) - Adjusts build/project configuration (conditional PackageReference vs ProjectReference for the Interface project, pipeline + versioning tweaks).
feat: support async wait handlers (#942) This pull request adds async wait handler support to the `IAwaitableCallback<TValue>` interface by introducing a new `WaitAsync` method. The changes enable asynchronous waiting for callbacks using modern async/await patterns with cancellation token support. ### Key Changes: - Added `WaitAsync` method to `IAwaitableCallback<TValue>` for asynchronous waiting with cancellation support - Refactored the interface to change the generic constraint from `out TValue` (covariant) to `TValue` (invariant) to support returning arrays - Implemented channel-based async infrastructure using `System.Threading.Channels` for efficient value buffering - Added comprehensive test coverage for the new WaitAsync functionality - Updated API surface files across all target frameworks (.NET 6.0, 8.0, 9.0, 10.0, netstandard2.0, netstandard2.1)
fix: fixed removing current directory not throwing ioexception (#940) Aligns `MockFileSystem` behavior with Windows by preventing delete/move operations on the current working directory (or its parents) and throwing the same `IOException` patterns observed on the real file system. ### Key Changes: - Added Windows-specific tests asserting `IOException` when deleting the current directory (and nested current directory) via both `Directory` and `DirectoryInfo`. - Added Windows-specific tests asserting `IOException` when moving the current directory (and when the current directory is nested under the moved directory) via both `Directory` and `DirectoryInfo`. - Implemented Windows-only “current directory handle” validations in `InMemoryStorage` and introduced new exception factory helpers. --- * fix: fixed removing current directory not throwing ioexception * refactor: removed unnecessary path trimming * test: moved tests from RemoveCurrentDirectoryTests and added parent dir deletion * test: fixed move test moving directory into itself * test: fixed delete tests because delete wasn't recursive * fix: fixed handle checks in InMemoryStorage * test: fixed test cases for current dir modification * test: applied suggestion of OnlyIf to current dir modification tests * fix: fixed handle check for modifiying directories similar to the current directory * fix: fixed trailing separator in file sharing exception
fix: dot file entries not having hidden attribute on mac mock (#937) Adds coverage and implementation changes to ensure dot-prefixed entries are treated as `Hidden` on macOS (and other non-Windows platforms) in the in-memory file system. * fix: fixed dot file system entries not having hidden attribute when mocking mac * test: moved Attributes_WhenDotFile_ShouldHaveHiddenFlag from FileVersionInfo to FileSystemInfo * test: renamed InMemoryContainerTests.AdjustAttributes_LeadingDot_ShouldBeHiddenOnLinux to AdjustAttributes_LeadingDot_ShouldBeHiddenOnUnix and adjusted expectation
feat: add triggered notification handler for `IFileSystemWatcher` (#931) This PR adds a new notification handler for `IFileSystemWatcher` that allows tests to be notified when file system changes are actually triggered by a watcher. This complements the existing `Notify` handler which fires on all file system changes. ### Key Changes: - Introduces `IWatcherTriggeredHandler` interface with `OnTriggered` method - Adds `Watcher` property to `MockFileSystem` exposing this handler - Updates API test expectations across all target frameworks
refactor: fix or ignore sonar issues (#922) This PR addresses SonarCloud issues by refactoring code to eliminate static analysis warnings. The changes focus on improving code quality without altering functionality. ### Key Changes: - Removed redundant multiplication by zero in timer configurations - Replaced `GetCustomAttribute<T>()` with more efficient `IsDefined()` calls - Added pragma directives to suppress unavoidable SonarCloud warnings for complexity and parameter count
fix: set UnixFileMode when creating new mock file stream (#916) This PR sets `UnixFileMode` when creating a new mock file stream via `MockFileSystem.FileStream.New(string, FileStreamOptions)`. * Adds `UnixFileMode` argument to `FileStreamMock` constructors * Sets `UnixFileMode` if valid `FileMode` is used * Throws `ArgumentException` if invalid `FileMode` is used * Passes `FileStreamOptions.UnixCreateMode` in `FileStreamFactoryMock` to `FileStreamMock` * Adds new CallStatistics overload to handle an additional parameter * Adds tests
PreviousNext