From c9a46d27100428afb3a25a078d48c42aa44f35c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Thu, 5 Oct 2023 18:39:46 +0200 Subject: [PATCH 1/3] docs: update README (#405) --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index a5f01398b..5c1b86275 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Testably_Testably.Abstractions&branch=main&metric=coverage)](https://sonarcloud.io/summary/overall?id=Testably_Testably.Abstractions&branch=main) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FTestably%2FTestably.Abstractions%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/Testably/Testably.Abstractions/main) -This library is an alternative testing helper for the [IFileSystem interfaces from System.IO.Abstractions](https://github.com/TestableIO/System.IO.Abstractions). -These interfaces allow abstracting away all I/O-related functionality from the `System.IO` namespace. +This library is a feature complete testing helper for the [IFileSystem abstractions for I/O-related functionality](https://github.com/TestableIO/System.IO.Abstractions) from the `System.IO` namespace. It uses an in-memory file system that behaves exactly like the real file system and can be used in unit tests for dependency injection. The testing helper also supports advanced scenarios like - [Multiple drives with limited size](Examples/DriveManagement/README.md) - [`FileSystemWatcher`](Examples/FileSystemWatcher/README.md) and From 77b2d34d032203c81ba4950c70e44d293f54ac76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 08:07:56 +0000 Subject: [PATCH 2/3] chore(deps): update danielpalme/reportgenerator-github-action action to v5.1.26 (#407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [danielpalme/ReportGenerator-GitHub-Action](https://togithub.com/danielpalme/ReportGenerator-GitHub-Action) | action | patch | `5.1.25` -> `5.1.26` | --- ### Release Notes
danielpalme/ReportGenerator-GitHub-Action (danielpalme/ReportGenerator-GitHub-Action) ### [`v5.1.26`](https://togithub.com/danielpalme/ReportGenerator-GitHub-Action/compare/5.1.25...5.1.26) [Compare Source](https://togithub.com/danielpalme/ReportGenerator-GitHub-Action/compare/5.1.25...5.1.26)
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Testably/Testably.Abstractions). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20ca02174..363ea0bd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -215,7 +215,7 @@ jobs: name: Code coverage (Windows) path: Coverage/Windows - name: Generate coverage report - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.25 + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.26 with: reports: "Coverage/**/coverage.cobertura.xml" targetdir: "coverage-report" From 76932e5110f154de518eb5918ecd0bc3a7e73848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Fri, 6 Oct 2023 11:25:12 +0200 Subject: [PATCH 3/3] fix: brittle test on .NET 8 (#406) In .NET 8 a new flag was added to [`FileAttributes`](https://learn.microsoft.com/en-us/dotnet/api/system.io.fileattributes?view=net-8.0): `FileAttributes.None`. When this attribute is used in the `GetAttributes_ShouldReturnAttributes` test, the test fails. Now the tested attributes are explicitly specified, so that the test always succeeds. *See [this test run](https://github.com/Testably/Testably.Abstractions/actions/runs/6380040873/job/17313688446?pr=389) in #389.* --- .../FileSystem/DirectoryInfo/AttributesTests.cs | 5 +++-- .../FileSystem/File/GetAttributesTests.cs | 5 +++-- .../FileSystem/File/SetAttributesTests.cs | 5 +++-- .../FileSystem/FileInfo/CopyToTests.cs | 7 ++++--- .../FileSystem/FileInfo/MoveToTests.cs | 7 ++++--- .../FileSystem/FileInfo/ReplaceTests.cs | 9 +++++---- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs index 502f443d8..3ccdedd89 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs @@ -22,9 +22,10 @@ public void Attributes_ClearAllAttributes_ShouldRemainDirectory(string path) } [SkippableTheory] - [AutoData] + [InlineAutoData(FileAttributes.ReadOnly)] + [InlineAutoData(FileAttributes.Normal)] public void Attributes_WhenFileIsExisting_SetterShouldChangeAttributesOnFileSystem( - string path, FileAttributes attributes) + FileAttributes attributes, string path) { FileSystem.Directory.CreateDirectory(path); IDirectoryInfo sut1 = FileSystem.DirectoryInfo.New(path); diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs index c69e0e8d3..e2567d08c 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs @@ -8,9 +8,10 @@ public abstract partial class GetAttributesTests where TFileSystem : IFileSystem { [SkippableTheory] - [AutoData] + [InlineAutoData(FileAttributes.ReadOnly)] + [InlineAutoData(FileAttributes.Normal)] public void GetAttributes_ShouldReturnAttributes( - string path, FileAttributes attributes) + FileAttributes attributes, string path) { FileSystem.File.WriteAllText(path, null); FileSystem.File.SetAttributes(path, attributes); diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/SetAttributesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/SetAttributesTests.cs index d58fc552d..e3d3d2ac0 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/File/SetAttributesTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/SetAttributesTests.cs @@ -8,8 +8,9 @@ public abstract partial class SetAttributesTests where TFileSystem : IFileSystem { [SkippableTheory] - [AutoData] - public void SetAttributes_ShouldNotAdjustTimes(string path, FileAttributes attributes) + [InlineAutoData(FileAttributes.ReadOnly)] + [InlineAutoData(FileAttributes.Normal)] + public void SetAttributes_ShouldNotAdjustTimes(FileAttributes attributes, string path) { Test.SkipIfLongRunningTestsShouldBeSkipped(FileSystem); diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/CopyToTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/CopyToTests.cs index 5c1204d45..464771739 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/CopyToTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/CopyToTests.cs @@ -77,12 +77,13 @@ public void CopyTo_ReadOnly_ShouldCopyFile( } [SkippableTheory] - [AutoData] + [InlineAutoData(FileAttributes.ReadOnly)] + [InlineAutoData(FileAttributes.System)] public void CopyTo_ShouldAddArchiveAttribute_OnWindows( + FileAttributes fileAttributes, string sourceName, string destinationName, - string contents, - FileAttributes fileAttributes) + string contents) { FileSystem.File.WriteAllText(sourceName, contents); FileSystem.File.SetAttributes(sourceName, fileAttributes); diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/MoveToTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/MoveToTests.cs index a3f34df00..e05467366 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/MoveToTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/MoveToTests.cs @@ -140,12 +140,13 @@ public void MoveTo_ReadOnly_ShouldMoveFile( } [SkippableTheory] - [AutoData] + [InlineAutoData(FileAttributes.ReadOnly)] + [InlineAutoData(FileAttributes.System)] public void MoveTo_ShouldAddArchiveAttribute_OnWindows( + FileAttributes fileAttributes, string sourceName, string destinationName, - string contents, - FileAttributes fileAttributes) + string contents) { FileSystem.File.WriteAllText(sourceName, contents); FileSystem.File.SetAttributes(sourceName, fileAttributes); diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/ReplaceTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/ReplaceTests.cs index 8d8fb58e6..236c9a6c4 100644 --- a/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/ReplaceTests.cs +++ b/Tests/Testably.Abstractions.Tests/FileSystem/FileInfo/ReplaceTests.cs @@ -156,15 +156,16 @@ public void } [SkippableTheory] - [AutoData] + [InlineAutoData(FileAttributes.Hidden, FileAttributes.Hidden)] + [InlineAutoData(FileAttributes.System, FileAttributes.System)] public void Replace_ShouldAddArchiveAttribute_OnWindows( + FileAttributes sourceFileAttributes, + FileAttributes destinationFileAttributes, string sourceName, string destinationName, string backupName, string sourceContents, - string destinationContents, - FileAttributes sourceFileAttributes, - FileAttributes destinationFileAttributes) + string destinationContents) { FileSystem.File.WriteAllText(sourceName, sourceContents); FileSystem.File.SetAttributes(sourceName, sourceFileAttributes);