OwlCore.Storage.CommonTests 0.6.3

dotnet add package OwlCore.Storage.CommonTests --version 0.6.3
                    
NuGet\Install-Package OwlCore.Storage.CommonTests -Version 0.6.3
                    
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="OwlCore.Storage.CommonTests" Version="0.6.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OwlCore.Storage.CommonTests" Version="0.6.3" />
                    
Directory.Packages.props
<PackageReference Include="OwlCore.Storage.CommonTests" />
                    
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 OwlCore.Storage.CommonTests --version 0.6.3
                    
#r "nuget: OwlCore.Storage.CommonTests, 0.6.3"
                    
#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 OwlCore.Storage.CommonTests@0.6.3
                    
#: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=OwlCore.Storage.CommonTests&version=0.6.3
                    
Install as a Cake Addin
#tool nuget:?package=OwlCore.Storage.CommonTests&version=0.6.3
                    
Install as a Cake Tool

OwlCore.Storage.CommonTests Version

Common tests that should pass for all implementations of OwlCore.Storage.

Install

Published releases are available on NuGet. To install, run the following command in the Package Manager Console.

PM> Install-Package OwlCore.Storage.CommonTests

Or using dotnet

> dotnet add package OwlCore.Storage.CommonTests

Usage

This library should be used with MSTest.

The classes provided in this package are abstract. To use them:

  1. Implement a provided class
  2. Override and provide an implementation for the required methods
  3. Add a [TestClass] attribute to your new class.

Tests defined in the base class will be picked up by MSTest.

Example:

[TestClass]
public class IFolderTests : CommonIFolderTests
{
    public override Task<IFolder> CreateFolderAsync()
    {
        var directoryInfo = Directory.CreateDirectory(Path.GetTempPath());

        return Task.FromResult<IFolder>(new SystemFolder(directoryInfo.FullName));
    }

    public override Task<IFolder> CreateFolderWithItems(int fileCount, int folderCount)
    {
        var tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
        Directory.CreateDirectory(tempFolder);

        for (var i = 0; i < fileCount; i++)
        {
            var path = Path.Combine(tempFolder, $"File.{i}.tmp");
            using var _ = File.Create(path);
        }

        for (var i = 0; i < folderCount; i++)
        {
            var path = Path.Combine(tempFolder, $"Folder.{i}");
            Directory.CreateDirectory(path);
        }

        return Task.FromResult<IFolder>(new SystemFolder(tempFolder));
    }
}

Financing

We accept donations here and here, and we do not have any active bug bounties.

Versioning

Version numbering follows the Semantic versioning approach. However, if the major version is 0, the code is considered alpha and breaking changes may occur as a minor update.

License

All OwlCore code is licensed under the MIT License. OwlCore is licensed under the MIT License. See the LICENSE file for more details.

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 is compatible.  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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.3 88 3/9/2026
0.6.2 112 3/1/2026
0.6.1 95 3/1/2026
0.6.0 113 2/13/2026
0.5.2 367 6/20/2024
0.5.1 532 3/18/2024
0.5.0 273 3/18/2024
0.4.1 494 2/22/2023
0.4.0 401 2/22/2023
0.3.0 585 1/31/2023
0.2.3 427 1/31/2023
0.2.2 460 1/13/2023
0.2.1 444 12/25/2022
0.2.0 443 12/25/2022
0.1.0 647 9/13/2022
0.0.0 601 9/13/2022

--- 0.6.3 ---
[Improvements]
Moved PropertyWatcher_ValueUpdated_FiresOnContentChange to CommonIFileTests where it can account for implementations that don't support file writing.
Updated all dependencies to latest version and migrated corresponding code.

--- 0.6.2 ---
[Improvements]
Updated Microsoft.Bcl.AsyncInterfaces to 10.0.3.
Updated System.Linq.Async to 7.0.0. Removed the net10.0 exclusion condition - the LINQ async operators are not built into the runtime and must be referenced on all TFMs.
Updated OwlCore.Extensions to 0.11.1.

--- 0.6.1 ---
[Breaking]
CommonIModifiableFolderTests: CreateFileInFolderWithTimestampsAsync now returns CreateFileInFolderWithTimestampsResult instead of IFile?. Update abstract method implementations accordingly. CopyMovePropertyPreservation and CrossImplementationCopyMove updated to use the new return type.

[Improvements]
Added net8.0 and net9.0 as target frameworks. System.Linq.Async and Microsoft.Bcl.AsyncInterfaces are now conditioned to exclude net10.0+, where these APIs are built into the runtime.
Updated OwlCore.Extensions to 0.11.0.

[New]
Add virtual member for property watcher test timeout in CommonIModifiableFolderTests.

Add CommonIModifiableFolderTests.TimestampIsolation: four new tests asserting that setting one timestamp property (LastModifiedAt, LastAccessedAt, CreatedAt) does not silently update the others as a side effect. Motivated by Linux platform behavior: .NET's FileInfo setters call utimensat(2) without UTIME_OMIT, so setting LastAccessedAt also writes back the cached mtime and vice versa; additionally, on Linux SetCreationTime has no native creation-time syscall and routes through SetLastWriteTime, overwriting mtime as a side effect.

CommonIModifiableFolderTests.ImplicitTimestampUpdates: add OpenFileWrite_UpdatesLastAccessedAt_AtOpenTime test asserting that atime is updated when the file is opened (not when the stream is closed). Promote AreTimestampsEqual helper from private to protected for use across partials.

CommonIModifiableFolderTests: add LastAccessedAtUpdateBehavior property alongside LastModifiedAtUpdateBehavior.

Add PolySharp package reference for polyfill support.

--- 0.6.0 ---
[Breaking]
CommonIModifiableFolderTests, CommonIFileTests, and CommonIFolderTests are now declared as partial classes.

CommonIFileTests: added three new abstract factory methods — CreateFileWithCreatedAtAsync, CreateFileWithLastModifiedAtAsync, and CreateFileWithLastAccessedAtAsync. Return null to signal that the implementation cannot seed that property.

CommonIFolderTests: same pattern — added CreateFolderWithCreatedAtAsync, CreateFolderWithLastModifiedAtAsync, and CreateFolderWithLastAccessedAtAsync.

CommonIModifiableFolderTests: added two new abstract factory methods — CreateFileInFolderWithLastModifiedAtAsync and CreateFileInFolderWithTimestampsAsync. Return null to opt out of tests that require pre-seeded timestamps.

OwlCore.Extensions dependency bumped from 0.7.0 to 0.10.0. MSTest.TestFramework bumped from 3.2.2 to 3.7.3. Removed MSTest.TestAdapter and Microsoft.NET.Test.Sdk from package dependencies (consumers supply these).

[New]
Updated to OwlCore.Storage 0.15.0 for datetime storage property support.

Added PropertyValueAvailability enum (Always, Maybe, Never) to describe whether a timestamp property is expected to return a value for a given implementation.

Added PropertyUpdateBehavior enum (Immediate, Eventual, Never) to describe when a timestamp property is expected to reflect changes after a triggering operation.

CommonIFileTests and CommonIFolderTests: added virtual properties CreatedAtAvailability, LastModifiedAtAvailability, LastAccessedAtAvailability, CreatedAtUpdateBehavior, LastModifiedAtUpdateBehavior, and LastAccessedAtUpdateBehavior. All default to Always / Immediate; override to loosen assertions for cloud or immutable backends. Timestamp partial files (CreatedAt, LastModifiedAt, LastAccessedAt, and their Offset variants) now use these properties to gate and adjust assertions.

Added CommonIModifiableFolderTests.FilePropertyPersistence: tests that calling UpdateValueAsync on ICreatedAt, ILastModifiedAt, and ILastAccessedAt (and their Offset variants) for a file round-trips the value correctly.

Added CommonIModifiableFolderTests.FolderPropertyPersistence: same as above for folders.

Added CommonIModifiableFolderTests.ImplicitTimestampUpdates: tests that storage operations implicitly update the expected timestamp — OpenFileRead_UpdatesLastAccessedAt, OpenFileWrite_UpdatesLastAccessedAt, WriteFile_UpdatesLastModifiedAt, FolderIteration_UpdatesLastAccessedAt, CreateFileInFolder_UpdatesFolderLastModifiedAt, CreateFolderInFolder_UpdatesFolderLastModifiedAt, DeleteFileFromFolder_UpdatesFolderLastModifiedAt, and DeleteFolderFromFolder_UpdatesFolderLastModifiedAt.

Added CommonIModifiableFolderTests.CopyMovePropertyPreservation: tests that CreateCopyOfAsync does not preserve CreatedAt or LastAccessedAt (new file gets current time) but does preserve LastModifiedAt, and that MoveFromAsync preserves all three timestamps.

Added CommonIModifiableFolderTests.CrossImplementationCopyMove: tests copy/move between a real implementation and a mock (and vice versa), confirming timestamp semantics hold regardless of which side supplies or receives the file.

Added CommonIModifiableFolderTests.PropertyWatcher: tests for IPropertyWatcher — GetWatcherAsync_ReturnsNonNullWatcher, ValueUpdated_FiresOnPropertyUpdate, ValueUpdated_FiresOnContentChange, Dispose_StopsEvents, DisposeAsync_StopsEvents, MultipleWatchers_AllReceiveEvents, CrossInstance_Notification, DisposeOne_OthersStillWork, CreatedAt_ValueUpdated_Fires, and LastAccessedAt_ValueUpdated_Fires.

Added MockStorageFile, MockStorageFolder, and MockModifiableProperty — in-memory mock implementations used by CrossImplementationCopyMove tests and available to consumers for the same purpose.

Added AssertEx with ThrowsException{T} and ThrowsExceptionAsync{T} helpers that accept any base type T, catching derived exception types rather than requiring an exact match (unlike the built-in MSTest Assert.ThrowsException).

--- 0.5.2 ---
[Fix]
Fixed an issue where Assert.ThrowsException explicitly checks for an OperationCanceledException, not the exceptions that derive from it. Some libraries throw a TaskCanceledException instead of an OperationCanceledException, which may cause issues with tests.

--- 0.5.1 ---
[Improvements]
Added detailed error messages for why CommonIModifiableFolder tests fail and where to check your code for issues.

--- 0.5.0 ---
[Breaking]
Inherited breaking changes and adjusts tests for OwlCore.Storage 0.10.0.

[Fixes]
Fixes an issue with CommonIModifiableFolderTests where Move wasn't being tested properly.

--- 0.4.1 ---
[Fixes]
Inherited fixes from OwlCore.Storage 0.8.2.

--- 0.4.0 ---
[Breaking]
Inherited breaking changes from OwlCore.Storage 0.8.0.

--- 0.3.0 ---
[Breaking]
Renamed IModifiableFolderTests to CommonIModifiableFolderTests. This was a typo and has been corrected.

[Improvements]
Added CommonIFileTests.SupportsWriting boolean to handle testing read-only file sources.

[Fixes]
Fixed crashing file tests for implementations that return a stream which that doesn't support checking the position property.

--- 0.2.3 ---
[Improvements]
Updated all NuGet package dependencies for upstream bug fixes.

--- 0.2.2 ---
[New]
Added new unit test for IModifiableFolder to make sure a subfolder with items doesn't throw when deleted.

--- 0.2.1 ---
[Improvements]
Updated all NuGet package dependencies. Fixes an issue where tests decorated with DataRowAttribute weren't visible to consuming projects.

[Fixes]
Fixed a test failure caused by usage of the method Assert.AreSame().

--- 0.2.0 ---
[New]
Added CommonIModifiableFolderTests.

--- 0.1.0 ---
[Breaking]
Fixed the namespace for CommonIFileTests and CommonIFolderTests. They now reside under OwlCore.Storage.CommonTests, instead of OwlCore.Storage.Tests.CommonTests.

--- 0.0.0 ---
[New]
Initial release of OwlCore.Storage.CommonTests.