diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs index 1f0c6feb5..e13b4eb94 100644 --- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs +++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs @@ -15,6 +15,7 @@ protected override void GenerateSource(StringBuilder sourceBuilder, ClassModel @ => sourceBuilder.Append(@$" using Testably.Abstractions.Testing.FileSystemInitializer; using Testably.Abstractions.TestHelpers; +using System.IO.Abstractions.TestingHelpers; using Xunit.Abstractions; namespace {@class.Namespace} @@ -31,18 +32,18 @@ public abstract partial class {@class.Name} namespace {@class.Namespace}.{@class.Name} {{ // ReSharper disable once UnusedMember.Global - public sealed class MockFileSystemTests : {@class.Name}, IDisposable + public sealed class MockFileSystemTests : {@class.Name}, IDisposable {{ /// public override string BasePath => _directoryCleaner.BasePath; private readonly IDirectoryCleaner _directoryCleaner; - public MockFileSystemTests() : this(new MockFileSystem()) + public MockFileSystemTests() : this(new Testably.Abstractions.Testing.MockFileSystem()) {{ }} - private MockFileSystemTests(MockFileSystem mockFileSystem) : base( + private MockFileSystemTests(Testably.Abstractions.Testing.MockFileSystem mockFileSystem) : base( mockFileSystem, mockFileSystem.TimeSystem) {{ @@ -54,6 +55,31 @@ private MockFileSystemTests(MockFileSystem mockFileSystem) : base( public void Dispose() => _directoryCleaner.Dispose(); }} + + // ReSharper disable once UnusedMember.Global + public sealed class TestableIoMockFileSystemTests : {@class.Name}, IDisposable + {{ + /// + public override string BasePath => _directoryCleaner.BasePath; + + private readonly IDirectoryCleaner _directoryCleaner; + + public TestableIoMockFileSystemTests() : this(new System.IO.Abstractions.TestingHelpers.MockFileSystem()) + {{ + }} + + private TestableIoMockFileSystemTests(System.IO.Abstractions.TestingHelpers.MockFileSystem mockFileSystem) : base( + mockFileSystem, + new RealTimeSystem()) + {{ + _directoryCleaner = FileSystem + .SetCurrentDirectoryToEmptyTemporaryDirectory(); + }} + + /// + public void Dispose() + => _directoryCleaner.Dispose(); + }} }} #if !DEBUG || ENABLE_REALFILESYSTEMTESTS_IN_DEBUG diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj b/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj index de9aba0c6..286a7beff 100644 --- a/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj +++ b/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj b/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj index 2fcc4e1be..df7834901 100644 --- a/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj +++ b/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj @@ -12,6 +12,7 @@ + diff --git a/Tests/Testably.Abstractions.Tests/Testably.Abstractions.Tests.csproj b/Tests/Testably.Abstractions.Tests/Testably.Abstractions.Tests.csproj index d2f919918..76db1684c 100644 --- a/Tests/Testably.Abstractions.Tests/Testably.Abstractions.Tests.csproj +++ b/Tests/Testably.Abstractions.Tests/Testably.Abstractions.Tests.csproj @@ -11,6 +11,7 @@ +