Skip to content

Commit 4639cf8

Browse files
committed
refactor: restructure packages to improve extensibility
This change splits the System.IO.Abstractions package into TestableIO.System.IO.Abstractions and TestableIO.System.IO.Abstractions.Wrappers. The former contains just the interfaces and the latter the default wrapper implementations. The package System.IO.Abstractions still exists as meta package to reduce impact on existing users. The same applies to TestableIO.System.IO.Abstractions.TestingHelpers. BREAKING CHANGE: This refactoring moves all types to the TestableIO.System.IO.Abstractions library. Users might need to recompile their libraries.
1 parent 6e2fd18 commit 4639cf8

32 files changed

Lines changed: 44 additions & 24 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ jobs:
8989
github.event_name == 'push' &&
9090
(
9191
startsWith(github.event.head_commit.message, 'feat:') ||
92-
startsWith(github.event.head_commit.message, 'fix:')
92+
startsWith(github.event.head_commit.message, 'fix:') ||
93+
contains(github.event.head_commit.message, 'breaking change')
9394
)
9495
needs: [pack]
9596
runs-on: ubuntu-latest

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
![System.IO.Abstractions](https://socialify.git.ci/TestableIO/System.IO.Abstractions/image?description=1&font=Source%20Code%20Pro&forks=1&issues=1&pattern=Charlie%20Brown&pulls=1&stargazers=1&theme=Dark)
2-
[![NuGet](https://img.shields.io/nuget/v/System.IO.Abstractions.svg)](https://www.nuget.org/packages/System.IO.Abstractions)
2+
[![NuGet](https://img.shields.io/nuget/v/TestableIO.System.IO.Abstractions.svg)](https://www.nuget.org/packages/TestableIO.System.IO.Abstractions)
33
![Continuous Integration](https://github.com/TestableIO/System.IO.Abstractions/workflows/Continuous%20Integration/badge.svg)
44
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/54479b054d194adfb4ff476ef0182fe0)](https://www.codacy.com/gh/TestableIO/System.IO.Abstractions/dashboard?utm_source=github.com&utm_medium=referral&utm_content=TestableIO/System.IO.Abstractions&utm_campaign=Badge_Grade)
55
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)
@@ -8,9 +8,11 @@
88
At the core of the library is `IFileSystem` and `FileSystem`. Instead of calling methods like `File.ReadAllText` directly, use `IFileSystem.File.ReadAllText`. We have exactly the same API, except that ours is injectable and testable.
99

1010
```shell
11-
dotnet add package System.IO.Abstractions
11+
dotnet add package TestableIO.System.IO.Abstractions
1212
```
1313

14+
*Note: This NuGet package is also published as `System.IO.Abstractions` but we suggest to use the prefix to make clear that this is not an official .NET package.*
15+
1416
```csharp
1517
public class MyComponent
1618
{
@@ -43,9 +45,11 @@ public class MyComponent
4345
The library also ships with a series of test helpers to save you from having to mock out every call, for basic scenarios. They are not a complete copy of a real-life file system, but they'll get you most of the way there.
4446

4547
```shell
46-
dotnet add package System.IO.Abstractions.TestingHelpers
48+
dotnet add package TestableIO.System.IO.Abstractions.TestingHelpers
4749
```
4850

51+
*Note: This NuGet package is also published as `System.IO.Abstractions.TestingHelpers` but we suggest to use the prefix to make clear that this is not an official .NET package.*
52+
4953
```csharp
5054
[Test]
5155
public void MyComponent_Validate_ShouldThrowNotSupportedExceptionIfTestingIsNotAwesome()
Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<AssemblyName>System.IO.Abstractions.TestingHelpers</AssemblyName>
4-
<RootNamespace>System.IO.Abstractions.TestingHelpers</RootNamespace>
5-
<Description>A set of pre-built mocks to help when testing file system interactions.</Description>
6-
<TargetFrameworks>net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
7-
<PackageIcon>icon_256x256.png</PackageIcon>
8-
</PropertyGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="../System.IO.Abstractions/System.IO.Abstractions.csproj" />
11-
</ItemGroup>
12-
<ItemGroup>
13-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net461" Version="1.0.3">
14-
<PrivateAssets>all</PrivateAssets>
15-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
16-
</PackageReference>
17-
</ItemGroup>
18-
<ItemGroup>
19-
<None Include="..\..\images\icon_256x256.png" Pack="true" PackagePath="\" />
20-
</ItemGroup>
2+
<PropertyGroup>
3+
<AssemblyName>System.IO.Abstractions.TestingHelpers</AssemblyName>
4+
<RootNamespace>System.IO.Abstractions.TestingHelpers</RootNamespace>
5+
<Description>A set of pre-built mocks to help when testing file system interactions.</Description>
6+
<TargetFrameworks>net6.0;net5.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
7+
<PackageIcon>icon_256x256.png</PackageIcon>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="..\TestableIO.System.IO.Abstractions.TestingHelpers\TestableIO.System.IO.Abstractions.TestingHelpers.csproj" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<None Include="..\..\images\icon_256x256.png" Pack="true" PackagePath="\" />
14+
</ItemGroup>
2115
</Project>

src/System.IO.Abstractions.TestingHelpers/CommonExceptions.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/CommonExceptions.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/IMockFileDataAccessor.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/IMockFileDataAccessor.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/MockDirectory.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/MockDirectoryData.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectoryData.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectoryInfo.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/MockDirectoryInfoFactory.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectoryInfoFactory.cs

File renamed without changes.

src/System.IO.Abstractions.TestingHelpers/MockDriveInfo.cs renamed to src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDriveInfo.cs

File renamed without changes.

0 commit comments

Comments
 (0)