diff --git a/Directory.Packages.props b/Directory.Packages.props
index bd66094b8..5685049dc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -23,7 +23,7 @@
-
+
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs
deleted file mode 100644
index 2a8210c30..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.IO.Abstractions;
-
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// If referencing this base class, the source generator will automatically create two classes implementing your class:
-///
-/// - one will provide a `RealFileSystem`
-/// - one will provide a `MockFileSystem`
-/// Thus your tests run on both systems identically.
-///
-///
-/// Important: You have to mark your class as ´partial`!
-///
-public abstract class FileSystemTestBase : TestBase
- where TFileSystem : IFileSystem
-{
- public abstract string BasePath { get; }
- public TFileSystem FileSystem { get; }
- public Test Test { get; }
- public ITimeSystem TimeSystem { get; }
-
- // ReSharper disable once UnusedMember.Global
- protected FileSystemTestBase(
- Test test,
- TFileSystem fileSystem,
- ITimeSystem timeSystem)
- {
- Test = test;
- FileSystem = fileSystem;
- TimeSystem = timeSystem;
- }
-
- protected FileSystemTestBase()
- {
- throw new NotSupportedException(
- "The SourceGenerator didn't create the corresponding files!");
- }
-
- ///
- /// Specifies, if brittle tests should be skipped on the real file system.
- ///
- ///
- /// (optional) A condition that must be for the test to be skipped on the
- /// real file system.
- ///
- public abstract void SkipIfBrittleTestsShouldBeSkipped(bool condition = true);
-
- ///
- /// Specifies, if long-running tests should be skipped on the real file system.
- ///
- public abstract void SkipIfLongRunningTestsShouldBeSkipped();
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs
deleted file mode 100644
index ec3b95070..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// If referencing this base class, the source generator will automatically create two classes implementing your class:
-///
-/// - one will provide a `RealRandomSystem`
-/// - one will provide a `MockRandomSystem`
-/// Thus your tests run on both systems identically.
-///
-///
-/// Important: You have to mark your class as ´partial`!
-///
-public abstract class RandomSystemTestBase : TestBase
- where TRandomSystem : IRandomSystem
-{
- public TRandomSystem RandomSystem { get; }
-
- // ReSharper disable once UnusedMember.Global
- protected RandomSystemTestBase(TRandomSystem randomSystem)
- {
- RandomSystem = randomSystem;
- }
-
- protected RandomSystemTestBase()
- {
- throw new NotSupportedException(
- "The SourceGenerator didn't create the corresponding files!");
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/TestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/TestBase.cs
deleted file mode 100644
index 96d0d3425..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/TestBase.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// Base class for generated tests.
-///
-public abstract class TestBase
-{
- ///
- /// The delay in milliseconds when wanting to ensure a timeout in the test.
- ///
- public const int EnsureTimeout = 500;
-
- ///
- /// The delay in milliseconds when expecting a success in the test.
- ///
- public const int ExpectSuccess = 30000;
-
- ///
- /// The delay in milliseconds when expecting a timeout in the test.
- ///
- public const int ExpectTimeout = 30;
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs
deleted file mode 100644
index ad4bf588f..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// If referencing this base class, the source generator will automatically create two classes implementing your class:
-///
-/// - one will provide a `RealTimeSystem`
-/// - one will provide a `MockTimeSystem`
-/// Thus your tests run on both systems identically.
-///
-///
-/// Important: You have to mark your class as ´partial`!
-///
-public abstract class TimeSystemTestBase : TestBase
- where TTimeSystem : ITimeSystem
-{
- public TTimeSystem TimeSystem { get; }
-
- // ReSharper disable once UnusedMember.Global
- protected TimeSystemTestBase(TTimeSystem timeSystem)
- {
- TimeSystem = timeSystem;
- }
-
- protected TimeSystemTestBase()
- {
- throw new NotSupportedException(
- "The SourceGenerator didn't create the corresponding files!");
- }
-
- ///
- /// Specifies, if brittle tests should be skipped on the real time system.
- ///
- ///
- /// (optional) A condition that must be for the test to be skipped on the
- /// real time system.
- ///
- public abstract void SkipIfBrittleTestsShouldBeSkipped(bool condition = true);
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGeneratorBase.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGeneratorBase.cs
deleted file mode 100644
index c48467e38..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGeneratorBase.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
-
-namespace Testably.Abstractions.Tests.SourceGenerator;
-
-internal abstract class ClassGeneratorBase
-{
- ///
- /// The marker of the base class to trigger generation of concrete test classes.
- ///
- public abstract string Marker { get; }
-
- public void GenerateClass(GeneratorExecutionContext context,
- ClassModel @class)
- {
- StringBuilder sourceBuilder = GetSourceBuilder();
- GenerateSource(sourceBuilder, @class);
- string fileName = CreateFileName(@class);
- context.AddSource(fileName,
- SourceText.From(sourceBuilder.ToString(), Encoding.UTF8));
- }
-
- private string CreateFileName(ClassModel classToGenerate)
- {
- string? fileNamePrefix = ExtractFileNamePrefixFromMarker(Marker);
- List namespacePrefixes =
- [
- "Testably.Abstractions.Tests.FileSystem.",
- "Testably.Abstractions.",
- ];
-
- string? namespacePrefix = namespacePrefixes
- .FirstOrDefault(classToGenerate.Namespace.StartsWith);
- if (namespacePrefix != null)
- {
- string? @namespace = classToGenerate.Namespace
- .Substring(namespacePrefix.Length);
- return $"{fileNamePrefix}{@namespace}.{classToGenerate.Name}.cs";
- }
-
- return $"{fileNamePrefix}{classToGenerate.Name}.cs";
- }
-
- ///
- /// Heuristic to generate a filename prefix depending on the from the class generator.
- ///
- private static string ExtractFileNamePrefixFromMarker(string marker)
- {
- int genericIndex = marker.IndexOf("<", StringComparison.OrdinalIgnoreCase);
- if (genericIndex > 0)
- {
- marker = marker.Substring(0, genericIndex);
- }
-
- if (marker.EndsWith("TestBase", StringComparison.Ordinal))
- {
- marker = marker.Substring(0, marker.Length - "TestBase".Length);
- }
-
- return $"{marker}.";
- }
-
- ///
- /// Append the source necessary for the to the .
- ///
- protected abstract void GenerateSource(
- StringBuilder sourceBuilder, ClassModel @class);
-
- private static StringBuilder GetSourceBuilder()
- => new(
- @"//------------------------------------------------------------------------------
-//
-// This code was generated by ""Testably.Abstractions.Tests.SourceGenerator"".
-//
-// Changes to this file may cause incorrect behavior
-// and will be lost if the code is regenerated.
-//
-//------------------------------------------------------------------------------
-");
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs
deleted file mode 100644
index 75bc2cb62..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/FileSystemClassGenerator.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-using System;
-using System.Text;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
-
-namespace Testably.Abstractions.Tests.SourceGenerator.ClassGenerators;
-
-// ReSharper disable StringLiteralTypo
-internal sealed class FileSystemClassGenerator : ClassGeneratorBase
-{
- ///
- public override string Marker
- => "FileSystemTestBase";
-
- ///
- protected override void GenerateSource(StringBuilder sourceBuilder, ClassModel @class)
- {
- #pragma warning disable MA0028
- sourceBuilder.Append($$"""
- using System.Runtime.InteropServices;
- using Testably.Abstractions.Testing.Initializer;
- using Testably.Abstractions.TestHelpers;
- using Testably.Abstractions.TestHelpers.Settings;
- using Xunit.Abstractions;
-
- namespace {{@class.Namespace}}
- {
- public abstract partial class {{@class.Name}}
- {
- protected {{@class.Name}}(Test test, TFileSystem fileSystem, ITimeSystem timeSystem)
- : base(test, fileSystem, timeSystem)
- {
- }
- }
- }
-
- namespace {{@class.Namespace}}.{{@class.Name}}
- {
- // ReSharper disable once UnusedMember.Global
- public sealed class MockFileSystemTests : {{@class.Name}}, IDisposable
- {
- ///
- public override string BasePath => _directoryCleaner.BasePath;
-
- private readonly IDirectoryCleaner _directoryCleaner;
-
- public MockFileSystemTests() : this(new MockFileSystem())
- {
- }
-
- private MockFileSystemTests(MockFileSystem mockFileSystem) : base(
- new Test(),
- mockFileSystem,
- mockFileSystem.TimeSystem)
- {
- _directoryCleaner = FileSystem
- .SetCurrentDirectoryToEmptyTemporaryDirectory();
- }
-
- ///
- public void Dispose()
- => _directoryCleaner.Dispose();
-
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- {
- // Brittle tests are never skipped against the mock file system!
- }
-
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- {
- // Long-running tests are never skipped against the mock file system!
- }
- }
- }
-
- namespace {{@class.Namespace}}.{{@class.Name}}
- {
- // ReSharper disable once UnusedMember.Global
- [Collection(nameof(RealFileSystemTests))]
- public sealed class RealFileSystemTests : {{@class.Name}}, IDisposable
- {
- ///
- public override string BasePath => _directoryCleaner.BasePath;
-
- private readonly IDirectoryCleaner _directoryCleaner;
- private readonly TestSettingsFixture _fixture;
-
- public RealFileSystemTests(ITestOutputHelper testOutputHelper, TestSettingsFixture fixture)
- : base(new Test(), new RealFileSystem(), new RealTimeSystem())
- {
- #if DEBUG
- if (fixture.RealFileSystemTests != TestSettingStatus.AlwaysEnabled)
- {
- throw new Xunit.SkipException($"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
- }
- #else
- if (fixture.RealFileSystemTests == TestSettingStatus.AlwaysDisabled)
- {
- throw new Xunit.SkipException($"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
- }
- #endif
- _fixture = fixture;
- _directoryCleaner = FileSystem
- .SetCurrentDirectoryToEmptyTemporaryDirectory($"{{@class.Namespace}}{FileSystem.Path.DirectorySeparatorChar}{{@class.Name}}-", testOutputHelper.WriteLine);
- }
-
- ///
- public void Dispose()
- => _directoryCleaner.Dispose();
-
- #if DEBUG
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- => Xunit.Skip.If(condition && _fixture.BrittleTests != TestSettingStatus.AlwaysEnabled,
- $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
- #else
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- => Xunit.Skip.If(condition && _fixture.BrittleTests == TestSettingStatus.AlwaysDisabled,
- $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
- #endif
-
- #if DEBUG
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- => Xunit.Skip.If(_fixture.LongRunningTests != TestSettingStatus.AlwaysEnabled,
- $"Long-running tests are {_fixture.LongRunningTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.LongRunningTests.");
- #else
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- => Xunit.Skip.If(_fixture.LongRunningTests == TestSettingStatus.AlwaysDisabled,
- $"Long-running tests are {_fixture.LongRunningTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.LongRunningTests.");
- #endif
- }
- }
- """);
- if (IncludeSimulatedTests(@class))
- {
- sourceBuilder.Append($$"""
-
- #if !NETFRAMEWORK
- namespace {{@class.Namespace}}.{{@class.Name}}
- {
- // ReSharper disable once UnusedMember.Global
- public sealed class LinuxFileSystemTests : {{@class.Name}}, IDisposable
- {
- ///
- public override string BasePath => _directoryCleaner.BasePath;
-
- private readonly IDirectoryCleaner _directoryCleaner;
-
- public LinuxFileSystemTests() : this(new MockFileSystem(o =>
- o.SimulatingOperatingSystem(SimulationMode.Linux)))
- {
- }
-
- private LinuxFileSystemTests(MockFileSystem mockFileSystem) : base(
- new Test(OSPlatform.Linux),
- mockFileSystem,
- mockFileSystem.TimeSystem)
- {
- _directoryCleaner = FileSystem
- .SetCurrentDirectoryToEmptyTemporaryDirectory();
- }
-
- ///
- public void Dispose()
- => _directoryCleaner.Dispose();
-
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- {
- // Brittle tests are never skipped against the mock file system!
- }
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- {
- // Long-running tests are never skipped against the mock file system!
- }
- }
- #endif
-
- #if !NETFRAMEWORK
- // ReSharper disable once UnusedMember.Global
- public sealed class MacFileSystemTests : {{@class.Name}}, IDisposable
- {
- ///
- public override string BasePath => _directoryCleaner.BasePath;
-
- private readonly IDirectoryCleaner _directoryCleaner;
-
- public MacFileSystemTests() : this(new MockFileSystem(o =>
- o.SimulatingOperatingSystem(SimulationMode.MacOS)))
- {
- }
- private MacFileSystemTests(MockFileSystem mockFileSystem) : base(
- new Test(OSPlatform.OSX),
- mockFileSystem,
- mockFileSystem.TimeSystem)
- {
- _directoryCleaner = FileSystem
- .SetCurrentDirectoryToEmptyTemporaryDirectory();
- }
-
- ///
- public void Dispose()
- => _directoryCleaner.Dispose();
-
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- {
- // Brittle tests are never skipped against the mock file system!
- }
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- {
- // Long-running tests are never skipped against the mock file system!
- }
- }
- #endif
-
- #if !NETFRAMEWORK
- // ReSharper disable once UnusedMember.Global
- public sealed class WindowsFileSystemTests : {{@class.Name}}, IDisposable
- {
- ///
- public override string BasePath => _directoryCleaner.BasePath;
-
- private readonly IDirectoryCleaner _directoryCleaner;
-
- public WindowsFileSystemTests() : this(new MockFileSystem(o =>
- o.SimulatingOperatingSystem(SimulationMode.Windows)))
- {
- }
- private WindowsFileSystemTests(MockFileSystem mockFileSystem) : base(
- new Test(OSPlatform.Windows),
- mockFileSystem,
- mockFileSystem.TimeSystem)
- {
- _directoryCleaner = FileSystem
- .SetCurrentDirectoryToEmptyTemporaryDirectory();
- }
-
- ///
- public void Dispose()
- => _directoryCleaner.Dispose();
-
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- {
- // Brittle tests are never skipped against the mock file system!
- }
- ///
- public override void SkipIfLongRunningTestsShouldBeSkipped()
- {
- // Long-running tests are never skipped against the mock file system!
- }
- }
- }
- #endif
- """);
- #pragma warning restore MA0028
- }
- }
-
- private static bool IncludeSimulatedTests(ClassModel @class)
- {
- return !@class.Namespace.Equals(
- "Testably.Abstractions.AccessControl.Tests", StringComparison.Ordinal);
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/RandomSystemClassGenerator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/RandomSystemClassGenerator.cs
deleted file mode 100644
index 25ae0f35d..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/RandomSystemClassGenerator.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System.Text;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
-// ReSharper disable StringLiteralTypo
-
-namespace Testably.Abstractions.Tests.SourceGenerator.ClassGenerators;
-
-internal sealed class RandomSystemClassGenerator : ClassGeneratorBase
-{
- ///
- public override string Marker
- => "RandomSystemTestBase";
-
- ///
- protected override void GenerateSource(StringBuilder sourceBuilder, ClassModel @class)
- #pragma warning disable MA0028
- => sourceBuilder.Append($$"""
- using Testably.Abstractions.TestHelpers;
- using Xunit.Abstractions;
-
- namespace {{@class.Namespace}}
- {
- public abstract partial class {{@class.Name}}
- {
- protected {{@class.Name}}(TRandomSystem randomSystem)
- : base(randomSystem)
- {
- }
- }
- }
-
- namespace {{@class.Namespace}}.{{@class.Name}}
- {
- // ReSharper disable once UnusedMember.Global
- public sealed class MockRandomSystemTests : {{@class.Name}}
- {
- public MockRandomSystemTests() : base(new MockRandomSystem())
- {
- }
- }
-
- // ReSharper disable once UnusedMember.Global
- public sealed class RealRandomSystemTests : {{@class.Name}}
- {
- public RealRandomSystemTests() : base(new RealRandomSystem())
- {
- }
- }
- }
- """);
- #pragma warning restore MA0028
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/TimeSystemClassGenerator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/TimeSystemClassGenerator.cs
deleted file mode 100644
index 28da672fa..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassGenerators/TimeSystemClassGenerator.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using System.Text;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
-// ReSharper disable StringLiteralTypo
-
-namespace Testably.Abstractions.Tests.SourceGenerator.ClassGenerators;
-
-internal sealed class TimeSystemClassGenerator : ClassGeneratorBase
-{
- ///
- public override string Marker
- => "TimeSystemTestBase";
-
- ///
- protected override void GenerateSource(StringBuilder sourceBuilder, ClassModel @class)
- #pragma warning disable MA0028
- => sourceBuilder.Append($$"""
- using Testably.Abstractions.TestHelpers;
- using Testably.Abstractions.TestHelpers.Settings;
- using Xunit.Abstractions;
-
- namespace {{@class.Namespace}}
- {
- public abstract partial class {{@class.Name}}
- {
- protected {{@class.Name}}(TTimeSystem timeSystem)
- : base(timeSystem)
- {
- }
- }
- }
-
- namespace {{@class.Namespace}}.{{@class.Name}}
- {
- // ReSharper disable once UnusedMember.Global
- public sealed class MockTimeSystemTests : {{@class.Name}}
- {
- public MockTimeSystemTests() : base(new MockTimeSystem(Testing.TimeProvider.Now()))
- {
- }
-
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- {
- // Brittle tests are never skipped against the mock time system!
- }
- }
-
- // ReSharper disable once UnusedMember.Global
- [Collection(nameof(RealTimeSystemTests))]
- public sealed class RealTimeSystemTests : {{@class.Name}}
- {
- private readonly TestSettingsFixture _fixture;
-
- public RealTimeSystemTests(TestSettingsFixture fixture) : base(new RealTimeSystem())
- {
- _fixture = fixture;
- }
-
- #if DEBUG
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- => Xunit.Skip.If(condition && _fixture.BrittleTests != TestSettingStatus.AlwaysEnabled,
- $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
- #else
- ///
- public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
- => Xunit.Skip.If(condition && _fixture.BrittleTests == TestSettingStatus.AlwaysDisabled,
- $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
- #endif
- }
- }
- """);
- #pragma warning restore MA0028
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs
new file mode 100644
index 000000000..2a40f6aa0
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs
@@ -0,0 +1,15 @@
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+internal readonly record struct ClassModel
+{
+ public string Name { get; }
+ public string Namespace { get; }
+ public ClassModelType Type { get; }
+
+ internal ClassModel(ClassModelType type, string @namespace, string name)
+ {
+ Type = type;
+ Namespace = @namespace;
+ Name = name;
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModelType.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModelType.cs
new file mode 100644
index 000000000..b2a1ac56c
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModelType.cs
@@ -0,0 +1,8 @@
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+internal enum ClassModelType
+{
+ FileSystem,
+ RandomSystem,
+ TimeSystem,
+}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Generator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Generator.cs
index 692224d46..0d645cc42 100644
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Generator.cs
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Generator.cs
@@ -1,7 +1,9 @@
using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Text;
+using System;
using System.Collections.Generic;
-using Testably.Abstractions.Tests.SourceGenerator.ClassGenerators;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
+using System.Text;
namespace Testably.Abstractions.Tests.SourceGenerator;
@@ -13,44 +15,172 @@ namespace Testably.Abstractions.Tests.SourceGenerator;
/// - `ITimeSystem`
///
[Generator]
-public sealed class Generator : ISourceGenerator
+public sealed class Generator : IIncrementalGenerator
{
- private readonly List _classGenerators =
- [
- new FileSystemClassGenerator(),
- new RandomSystemClassGenerator(),
- new TimeSystemClassGenerator(),
- ];
+ #region IIncrementalGenerator Members
- private SyntaxReceiver? _syntaxReceiver;
+ ///
+ public void Initialize(IncrementalGeneratorInitializationContext context)
+ {
+ // Add the marker attribute to the compilation
+ context.RegisterPostInitializationOutput(ctx => ctx.AddSource(
+ "MarkerAttributes.g.cs",
+ SourceText.From(SourceGenerationHelper.GenerateMarkerAttributes(), Encoding.UTF8)));
+
+ // Add the marker attribute to the compilation
+ context.RegisterPostInitializationOutput(ctx => ctx.AddSource(
+ "CollectionFixtures.g.cs",
+ SourceText.From(SourceGenerationHelper.GenerateCollectionFixtures(), Encoding.UTF8)));
+
+ // Do a simple filter for enums
+ IncrementalValuesProvider classesToGenerate = context.SyntaxProvider
+ .CreateSyntaxProvider(
+ predicate: static (s, _)
+ => IsSyntaxTargetForGeneration(s), // select enums with attributes
+ transform: static (ctx, _)
+ => GetSemanticTargetForGeneration(
+ ctx)) // select enums with the [EnumExtensions] attribute and extract details
+ .Where(static m => m is not null); // Filter out errors that we don't care about
- #region ISourceGenerator Members
+ context.RegisterSourceOutput(classesToGenerate,
+ static (context, source) => Execute(source, context));
+ }
+
+ #endregion
- ///
- public void Execute(GeneratorExecutionContext context)
+ private static string CreateFileName(ClassModel model)
{
- if (_syntaxReceiver == null)
+ string? prefix = model.Namespace + ".";
+ string[] exclusions =
+ [
+ "Testably.Abstractions.Tests.",
+ "Testably.Abstractions.",
+ ];
+ foreach (string? exclusion in exclusions)
{
- return;
+ if (prefix.StartsWith(exclusion, StringComparison.Ordinal))
+ {
+ prefix = prefix.Substring(exclusion.Length);
+ }
}
- GlobalGenerator.GenerateClass(context);
- foreach (ClassGeneratorBase classGenerator in _classGenerators)
+ return $"{prefix}{model.Name}.g.cs";
+ }
+
+ private static void Execute(ClassModel? model, SourceProductionContext context)
+ {
+ if (model is not null)
{
- foreach (ClassModel classModel in _syntaxReceiver
- .GetClassModels(classGenerator.Marker))
+ string? fileName = CreateFileName(model.Value);
+ // generate the source code and add it to the output
+ string result = SourceGenerationHelper.GenerateTestClasses(model.Value);
+ // Create a separate partial class file for each test class
+ context.AddSource(fileName, SourceText.From(result, Encoding.UTF8));
+ }
+ }
+
+ private static ClassModel? GetClassModelToGenerate(ClassModelType type,
+ SemanticModel semanticModel, ClassDeclarationSyntax classDeclarationSyntax)
+ {
+ // Get the semantic representation of the enum syntax
+ if (semanticModel.GetDeclaredSymbol(classDeclarationSyntax) is not INamedTypeSymbol
+ classSymbol)
+ {
+ // something went wrong
+ return null;
+ }
+
+ return new ClassModel(type, GetNamespace(classDeclarationSyntax), classSymbol.Name);
+ }
+
+ ///
+ /// Determine the namespace the class/enum/struct is declared in, if any
+ ///
+ private static string GetNamespace(BaseTypeDeclarationSyntax syntax)
+ {
+ // If we don't have a namespace at all we'll return an empty string
+ // This accounts for the "default namespace" case
+ string @namespace = string.Empty;
+
+ // Get the containing syntax node for the type declaration
+ // (could be a nested type, for example)
+ SyntaxNode? potentialNamespaceParent = syntax.Parent;
+
+ // Keep moving "out" of nested classes etc until we get to a namespace
+ // or until we run out of parents
+ while (potentialNamespaceParent != null &&
+ potentialNamespaceParent is not NamespaceDeclarationSyntax
+ && potentialNamespaceParent is not FileScopedNamespaceDeclarationSyntax)
+ {
+ potentialNamespaceParent = potentialNamespaceParent.Parent;
+ }
+
+ // Build up the final namespace by looping until we no longer have a namespace declaration
+ if (potentialNamespaceParent is BaseNamespaceDeclarationSyntax namespaceParent)
+ {
+ // We have a namespace. Use that as the type
+ @namespace = namespaceParent.Name.ToString();
+
+ // Keep moving "out" of the namespace declarations until we
+ // run out of nested namespace declarations
+ while (true)
{
- classGenerator.GenerateClass(context, classModel);
+ if (namespaceParent.Parent is not NamespaceDeclarationSyntax parent)
+ {
+ break;
+ }
+
+ // Add the outer namespace as a prefix to the final namespace
+ @namespace = $"{namespaceParent.Name}.{@namespace}";
+ namespaceParent = parent;
}
}
+
+ // return the final namespace
+ return @namespace;
}
- ///
- public void Initialize(GeneratorInitializationContext context)
+ private static ClassModel? GetSemanticTargetForGeneration(GeneratorSyntaxContext context)
{
- _syntaxReceiver = new SyntaxReceiver(_classGenerators);
- context.RegisterForSyntaxNotifications(() => _syntaxReceiver);
+ // we know the node is a ClassDeclarationSyntax thanks to IsSyntaxTargetForGeneration
+ ClassDeclarationSyntax? classDeclarationSyntax = (ClassDeclarationSyntax)context.Node;
+
+ // loop through all the attributes on the method
+ foreach (AttributeListSyntax attributeListSyntax in classDeclarationSyntax.AttributeLists)
+ {
+ foreach (AttributeSyntax attributeSyntax in attributeListSyntax.Attributes)
+ {
+ if (context.SemanticModel.GetSymbolInfo(attributeSyntax).Symbol is not IMethodSymbol
+ attributeSymbol)
+ {
+ // weird, we couldn't get the symbol, ignore it
+ continue;
+ }
+
+ INamedTypeSymbol attributeContainingTypeSymbol = attributeSymbol.ContainingType;
+ string fullName = attributeContainingTypeSymbol.ToDisplayString();
+
+ return fullName switch
+ {
+ "Testably.Abstractions.TestHelpers.FileSystemTestsAttribute" =>
+ GetClassModelToGenerate(ClassModelType.FileSystem,
+ context.SemanticModel, classDeclarationSyntax),
+ "Testably.Abstractions.TestHelpers.TimeSystemTestsAttribute" =>
+ GetClassModelToGenerate(ClassModelType.TimeSystem,
+ context.SemanticModel, classDeclarationSyntax),
+ "Testably.Abstractions.TestHelpers.RandomSystemTestsAttribute" =>
+ GetClassModelToGenerate(ClassModelType.RandomSystem,
+ context.SemanticModel, classDeclarationSyntax),
+ _ => null,
+ };
+ }
+ }
+
+ return null;
}
- #endregion
+ private static bool IsSyntaxTargetForGeneration(SyntaxNode syntaxNode)
+ {
+ return syntaxNode is ClassDeclarationSyntax { AttributeLists.Count: > 0 };
+ }
}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/GlobalGenerator.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/GlobalGenerator.cs
deleted file mode 100644
index c90d0c3c1..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/GlobalGenerator.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Text;
-using System.Text;
-
-namespace Testably.Abstractions.Tests.SourceGenerator;
-
-public static class GlobalGenerator
-{
- public static void GenerateClass(GeneratorExecutionContext context)
- {
- StringBuilder sourceBuilder = GetSourceBuilder();
- GenerateSource(sourceBuilder);
- string fileName = "XunitCollectionFixtures.cs";
- context.AddSource(fileName,
- SourceText.From(sourceBuilder.ToString(), Encoding.UTF8));
- }
-
- private static void GenerateSource(StringBuilder sourceBuilder)
- => sourceBuilder.Append(@"
-using Xunit;
-
-namespace Testably.Abstractions.TestHelpers.Settings;
-
-[CollectionDefinition(""RealFileSystemTests"")]
-public class FileSystemTestSettingsFixture : ICollectionFixture
-{
- // This class has no code, and is never created. Its purpose is simply
- // to be the place to apply [CollectionDefinition] and all the
- // ICollectionFixture<> interfaces.
-}
-
-[CollectionDefinition(""RealTimeSystemTests"")]
-public class TimeSystemTestSettingsFixture : ICollectionFixture
-{
- // This class has no code, and is never created. Its purpose is simply
- // to be the place to apply [CollectionDefinition] and all the
- // ICollectionFixture<> interfaces.
-}");
-
- private static StringBuilder GetSourceBuilder()
- => new(
- @"//------------------------------------------------------------------------------
-//
-// This code was generated by ""Testably.Abstractions.Tests.SourceGenerator"".
-//
-// Changes to this file may cause incorrect behavior
-// and will be lost if the code is regenerated.
-//
-//------------------------------------------------------------------------------
-");
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Model/ClassModel.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Model/ClassModel.cs
deleted file mode 100644
index f31d2e50b..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Model/ClassModel.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-
-namespace Testably.Abstractions.Tests.SourceGenerator.Model;
-
-internal sealed class ClassModel
-{
- public string Name { get; }
- public string Namespace { get; }
-
- private ClassModel(string @namespace, string name)
- {
- Namespace = @namespace;
- Name = name;
- }
-
- internal static ClassModel FromClassDeclarationSyntax(
- ClassDeclarationSyntax classDeclarationSyntax)
- {
- string @namespace = GetNamespace(classDeclarationSyntax);
- string name = classDeclarationSyntax.Identifier.ToString();
- return new ClassModel(@namespace, name);
- }
-
- ///
- /// Get the namespace of a .
- ///
- ///
- /// see
- ///
- ///
- private static string GetNamespace(SyntaxNode syntaxNode)
- {
- // If we don't have a namespace at all we'll return an empty string
- // This accounts for the "default namespace" case
- string nameSpace = string.Empty;
-
- // Get the containing syntax node for the type declaration
- // (could be a nested type, for example)
- SyntaxNode? potentialNamespaceParent = syntaxNode.Parent;
-
- // Keep moving "out" of nested classes until we get to a namespace
- // or until we run out of parents
- while (potentialNamespaceParent != null &&
- potentialNamespaceParent is not NamespaceDeclarationSyntax
- && potentialNamespaceParent is not FileScopedNamespaceDeclarationSyntax)
- {
- potentialNamespaceParent = potentialNamespaceParent.Parent;
- }
-
- // Build up the final namespace by looping until we no longer have a namespace declaration
- if (potentialNamespaceParent is BaseNamespaceDeclarationSyntax namespaceParent)
- {
- // We have a namespace. Use that as the type
- nameSpace = namespaceParent.Name.ToString();
-
- // Keep moving "out" of the namespace declarations until we
- // run out of nested namespace declarations
- while (true)
- {
- if (namespaceParent.Parent is not NamespaceDeclarationSyntax parent)
- {
- break;
- }
-
- // Add the outer namespace as a prefix to the final namespace
- nameSpace = $"{namespaceParent.Name}.{nameSpace}";
- namespaceParent = parent;
- }
- }
-
- // return the final namespace
- return nameSpace;
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs
new file mode 100644
index 000000000..783b8af91
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs
@@ -0,0 +1,297 @@
+using System;
+using System.Text;
+
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+#pragma warning disable MA0051
+#pragma warning disable MA0028
+internal static partial class SourceGenerationHelper
+{
+ public static string GenerateFileSystemTestClasses(ClassModel model)
+ {
+ StringBuilder? sb = GetSourceBuilder();
+ sb.AppendLine($$"""
+ using System.Runtime.InteropServices;
+ using Testably.Abstractions.Testing.Initializer;
+ using Testably.Abstractions.TestHelpers;
+ using Testably.Abstractions.TestHelpers.Settings;
+ using Xunit.Abstractions;
+
+ namespace {{model.Namespace}}
+ {
+ public abstract partial class {{model.Name}}
+ {
+ ///
+ /// The delay in milliseconds when wanting to ensure a timeout in the test.
+ ///
+ public const int EnsureTimeout = 500;
+
+ ///
+ /// The delay in milliseconds when expecting a success in the test.
+ ///
+ public const int ExpectSuccess = 30000;
+
+ ///
+ /// The delay in milliseconds when expecting a timeout in the test.
+ ///
+ public const int ExpectTimeout = 30;
+
+ public abstract string BasePath { get; }
+ public IFileSystem FileSystem { get; }
+ public Test Test { get; }
+ public ITimeSystem TimeSystem { get; }
+
+ protected {{model.Name}}(Test test, IFileSystem fileSystem, ITimeSystem timeSystem)
+ {
+ Test = test;
+ FileSystem = fileSystem;
+ TimeSystem = timeSystem;
+ }
+
+ ///
+ /// Specifies, if brittle tests should be skipped on the real file system.
+ ///
+ ///
+ /// (optional) A condition that must be for the test to be skipped on the
+ /// real file system.
+ ///
+ public abstract void SkipIfBrittleTestsShouldBeSkipped(bool condition = true);
+
+ ///
+ /// Specifies, if long-running tests should be skipped on the real file system.
+ ///
+ public abstract void SkipIfLongRunningTestsShouldBeSkipped();
+
+
+ // ReSharper disable once UnusedMember.Global
+ public sealed class MockFileSystemTests : {{model.Name}}, IDisposable
+ {
+ ///
+ public override string BasePath => _directoryCleaner.BasePath;
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+
+ public MockFileSystemTests() : this(new MockFileSystem())
+ {
+ }
+
+ private MockFileSystemTests(MockFileSystem mockFileSystem) : base(
+ new Test(),
+ mockFileSystem,
+ mockFileSystem.TimeSystem)
+ {
+ _directoryCleaner = FileSystem
+ .SetCurrentDirectoryToEmptyTemporaryDirectory();
+ }
+
+ ///
+ public void Dispose()
+ => _directoryCleaner.Dispose();
+
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ // Brittle tests are never skipped against the mock file system!
+ }
+
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ {
+ // Long-running tests are never skipped against the mock file system!
+ }
+ }
+ // ReSharper disable once UnusedMember.Global
+ [Collection("RealFileSystemTests")]
+ public sealed class RealFileSystemTests : {{model.Name}}, IDisposable
+ {
+ ///
+ public override string BasePath => _directoryCleaner.BasePath;
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+ private readonly TestSettingsFixture _fixture;
+
+ public RealFileSystemTests(ITestOutputHelper testOutputHelper, TestSettingsFixture fixture)
+ : base(new Test(), new RealFileSystem(), new RealTimeSystem())
+ {
+ #if DEBUG
+ if (fixture.RealFileSystemTests != TestSettingStatus.AlwaysEnabled)
+ {
+ throw new Xunit.SkipException($"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
+ }
+ #else
+ if (fixture.RealFileSystemTests == TestSettingStatus.AlwaysDisabled)
+ {
+ throw new Xunit.SkipException($"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
+ }
+ #endif
+ _fixture = fixture;
+ _directoryCleaner = FileSystem
+ .SetCurrentDirectoryToEmptyTemporaryDirectory($"{{model.Namespace}}{FileSystem.Path.DirectorySeparatorChar}{{model.Name}}-", testOutputHelper.WriteLine);
+ }
+
+ ///
+ public void Dispose()
+ => _directoryCleaner.Dispose();
+
+ #if DEBUG
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ => Xunit.Skip.If(condition && _fixture.BrittleTests != TestSettingStatus.AlwaysEnabled,
+ $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+ #else
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ => Xunit.Skip.If(condition && _fixture.BrittleTests == TestSettingStatus.AlwaysDisabled,
+ $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+ #endif
+
+ #if DEBUG
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ => Xunit.Skip.If(_fixture.LongRunningTests != TestSettingStatus.AlwaysEnabled,
+ $"Long-running tests are {_fixture.LongRunningTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.LongRunningTests.");
+ #else
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ => Xunit.Skip.If(_fixture.LongRunningTests == TestSettingStatus.AlwaysDisabled,
+ $"Long-running tests are {_fixture.LongRunningTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.LongRunningTests.");
+ #endif
+ }
+ """);
+ if (IncludeSimulatedTests(model))
+ {
+ sb.AppendLine($$"""
+
+ #if !NETFRAMEWORK
+ // ReSharper disable once UnusedMember.Global
+ public sealed class LinuxFileSystemTests : {{model.Name}}, IDisposable
+ {
+ ///
+ public override string BasePath => _directoryCleaner.BasePath;
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+
+ public LinuxFileSystemTests() : this(new MockFileSystem(o =>
+ o.SimulatingOperatingSystem(SimulationMode.Linux)))
+ {
+ }
+
+ private LinuxFileSystemTests(MockFileSystem mockFileSystem) : base(
+ new Test(OSPlatform.Linux),
+ mockFileSystem,
+ mockFileSystem.TimeSystem)
+ {
+ _directoryCleaner = FileSystem
+ .SetCurrentDirectoryToEmptyTemporaryDirectory();
+ }
+
+ ///
+ public void Dispose()
+ => _directoryCleaner.Dispose();
+
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ // Brittle tests are never skipped against the mock file system!
+ }
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ {
+ // Long-running tests are never skipped against the mock file system!
+ }
+ }
+ #endif
+
+ #if !NETFRAMEWORK
+ // ReSharper disable once UnusedMember.Global
+ public sealed class MacFileSystemTests : {{model.Name}}, IDisposable
+ {
+ ///
+ public override string BasePath => _directoryCleaner.BasePath;
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+
+ public MacFileSystemTests() : this(new MockFileSystem(o =>
+ o.SimulatingOperatingSystem(SimulationMode.MacOS)))
+ {
+ }
+ private MacFileSystemTests(MockFileSystem mockFileSystem) : base(
+ new Test(OSPlatform.OSX),
+ mockFileSystem,
+ mockFileSystem.TimeSystem)
+ {
+ _directoryCleaner = FileSystem
+ .SetCurrentDirectoryToEmptyTemporaryDirectory();
+ }
+
+ ///
+ public void Dispose()
+ => _directoryCleaner.Dispose();
+
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ // Brittle tests are never skipped against the mock file system!
+ }
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ {
+ // Long-running tests are never skipped against the mock file system!
+ }
+ }
+ #endif
+
+ #if !NETFRAMEWORK
+ // ReSharper disable once UnusedMember.Global
+ public sealed class WindowsFileSystemTests : {{model.Name}}, IDisposable
+ {
+ ///
+ public override string BasePath => _directoryCleaner.BasePath;
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+
+ public WindowsFileSystemTests() : this(new MockFileSystem(o =>
+ o.SimulatingOperatingSystem(SimulationMode.Windows)))
+ {
+ }
+ private WindowsFileSystemTests(MockFileSystem mockFileSystem) : base(
+ new Test(OSPlatform.Windows),
+ mockFileSystem,
+ mockFileSystem.TimeSystem)
+ {
+ _directoryCleaner = FileSystem
+ .SetCurrentDirectoryToEmptyTemporaryDirectory();
+ }
+
+ ///
+ public void Dispose()
+ => _directoryCleaner.Dispose();
+
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ // Brittle tests are never skipped against the mock file system!
+ }
+ ///
+ public override void SkipIfLongRunningTestsShouldBeSkipped()
+ {
+ // Long-running tests are never skipped against the mock file system!
+ }
+ }
+ #endif
+ """);
+ }
+
+ sb.AppendLine("""
+ }
+ }
+ """);
+ return sb.ToString();
+
+ static bool IncludeSimulatedTests(ClassModel model)
+ => !model.Namespace.Equals(
+ "Testably.Abstractions.AccessControl.Tests", StringComparison.Ordinal);
+ }
+}
+#pragma warning restore MA0028
+#pragma warning restore MA0051
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.RandomSystem.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.RandomSystem.cs
new file mode 100644
index 000000000..ab3482b66
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.RandomSystem.cs
@@ -0,0 +1,50 @@
+using System.Text;
+
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+#pragma warning disable MA0051
+#pragma warning disable MA0028
+internal static partial class SourceGenerationHelper
+{
+ public static string GenerateRandomSystemTestClasses(ClassModel model)
+ {
+ StringBuilder? sb = GetSourceBuilder();
+ sb.AppendLine($$"""
+ using Testably.Abstractions.TestHelpers;
+ using Xunit.Abstractions;
+
+ namespace {{model.Namespace}}
+ {
+ public abstract partial class {{model.Name}}
+ {
+ public IRandomSystem RandomSystem { get; }
+
+ protected {{model.Name}}(IRandomSystem randomSystem)
+ {
+ RandomSystem = randomSystem;
+ }
+
+ // ReSharper disable once UnusedMember.Global
+ public sealed class MockRandomSystemTests : {{model.Name}}
+ {
+ public MockRandomSystemTests() : base(new MockRandomSystem())
+ {
+ }
+ }
+
+ // ReSharper disable once UnusedMember.Global
+ public sealed class RealRandomSystemTests : {{model.Name}}
+ {
+ public RealRandomSystemTests() : base(new RealRandomSystem())
+ {
+ }
+ }
+ }
+ }
+ """);
+
+ return sb.ToString();
+ }
+}
+#pragma warning restore MA0028
+#pragma warning restore MA0051
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.TimeSystem.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.TimeSystem.cs
new file mode 100644
index 000000000..90320cbd1
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.TimeSystem.cs
@@ -0,0 +1,97 @@
+using System.Text;
+
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+#pragma warning disable MA0051
+#pragma warning disable MA0028
+internal static partial class SourceGenerationHelper
+{
+ public static string GenerateTimeSystemTestClasses(ClassModel model)
+ {
+ StringBuilder? sb = GetSourceBuilder();
+ sb.AppendLine($$"""
+ using Testably.Abstractions.TestHelpers;
+ using Testably.Abstractions.TestHelpers.Settings;
+ using Xunit.Abstractions;
+
+ namespace {{model.Namespace}}
+ {
+ public abstract partial class {{model.Name}}
+ {
+ ///
+ /// The delay in milliseconds when wanting to ensure a timeout in the test.
+ ///
+ public const int EnsureTimeout = 500;
+
+ ///
+ /// The delay in milliseconds when expecting a success in the test.
+ ///
+ public const int ExpectSuccess = 30000;
+
+ ///
+ /// The delay in milliseconds when expecting a timeout in the test.
+ ///
+ public const int ExpectTimeout = 30;
+
+ public ITimeSystem TimeSystem { get; }
+
+ protected {{model.Name}}(ITimeSystem timeSystem)
+ {
+ TimeSystem = timeSystem;
+ }
+
+ ///
+ /// Specifies, if brittle tests should be skipped on the real time system.
+ ///
+ ///
+ /// (optional) A condition that must be for the test to be skipped on the
+ /// real time system.
+ ///
+ public abstract void SkipIfBrittleTestsShouldBeSkipped(bool condition = true);
+
+ // ReSharper disable once UnusedMember.Global
+ public sealed class MockTimeSystemTests : {{model.Name}}
+ {
+ public MockTimeSystemTests() : base(new MockTimeSystem(Testing.TimeProvider.Now()))
+ {
+ }
+
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ // Brittle tests are never skipped against the mock time system!
+ }
+ }
+
+ // ReSharper disable once UnusedMember.Global
+ [Collection("RealTimeSystemTests")]
+ public sealed class RealTimeSystemTests : {{model.Name}}
+ {
+ private readonly TestSettingsFixture _fixture;
+
+ public RealTimeSystemTests(TestSettingsFixture fixture) : base(new RealTimeSystem())
+ {
+ _fixture = fixture;
+ }
+
+ #if DEBUG
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ => Xunit.Skip.If(condition && _fixture.BrittleTests != TestSettingStatus.AlwaysEnabled,
+ $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+ #else
+ ///
+ public override void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ => Xunit.Skip.If(condition && _fixture.BrittleTests == TestSettingStatus.AlwaysDisabled,
+ $"Brittle tests are {_fixture.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+ #endif
+ }
+ }
+ }
+ """);
+
+ return sb.ToString();
+ }
+}
+#pragma warning restore MA0028
+#pragma warning restore MA0051
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.cs
new file mode 100644
index 000000000..eb6fc9e9d
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.cs
@@ -0,0 +1,99 @@
+using System;
+using System.Text;
+
+namespace Testably.Abstractions.Tests.SourceGenerator;
+
+#pragma warning disable MA0051
+internal static partial class SourceGenerationHelper
+{
+ public static string GenerateCollectionFixtures()
+ {
+ StringBuilder? sb = GetSourceBuilder();
+ sb.Append("""
+ using Xunit;
+
+ namespace Testably.Abstractions.TestHelpers.Settings;
+
+ [CollectionDefinition("RealFileSystemTests")]
+ public class FileSystemTestSettingsFixture : ICollectionFixture
+ {
+ // This class has no code, and is never created. Its purpose is simply
+ // to be the place to apply [CollectionDefinition] and all the
+ // ICollectionFixture<> interfaces.
+ }
+
+ [CollectionDefinition("RealTimeSystemTests")]
+ public class TimeSystemTestSettingsFixture : ICollectionFixture
+ {
+ // This class has no code, and is never created. Its purpose is simply
+ // to be the place to apply [CollectionDefinition] and all the
+ // ICollectionFixture<> interfaces.
+ }
+ """);
+ return sb.ToString();
+ }
+ public static string GenerateMarkerAttributes()
+ {
+ StringBuilder? sb = GetSourceBuilder();
+ sb.Append("""
+ namespace Testably.Abstractions.TestHelpers
+ {
+ ///
+ /// Marks a class to contain tests for the that runs against mock and real implementations.
+ ///
+ ///
+ /// The class must be abstract and partial and will get an `IFileSystem FileSystem` property injected
+ ///
+ [System.AttributeUsage(System.AttributeTargets.Class)]
+ public class FileSystemTestsAttribute : System.Attribute
+ {
+ }
+
+ ///
+ /// Marks a class to contain tests for the that runs against mock and real implementations.
+ ///
+ ///
+ /// The class must be abstract and partial and will get an `ITimeSystem TimeSystem` property injected
+ ///
+ [System.AttributeUsage(System.AttributeTargets.Class)]
+ public class TimeSystemTestsAttribute : System.Attribute
+ {
+ }
+
+ ///
+ /// Marks a class to contain tests for the that runs against mock and real implementations.
+ ///
+ ///
+ /// The class must be abstract and partial and will get an `IRandomSystem RandomSystem` property injected
+ ///
+ [System.AttributeUsage(System.AttributeTargets.Class)]
+ public class RandomSystemTestsAttribute : System.Attribute
+ {
+ }
+ }
+ """);
+ return sb.ToString();
+ }
+
+ public static string GenerateTestClasses(ClassModel model)
+ => model.Type switch
+ {
+ ClassModelType.FileSystem => GenerateFileSystemTestClasses(model),
+ ClassModelType.TimeSystem => GenerateTimeSystemTestClasses(model),
+ ClassModelType.RandomSystem => GenerateRandomSystemTestClasses(model),
+ _ => throw new NotSupportedException(),
+ };
+
+ private static StringBuilder GetSourceBuilder()
+ => new(
+ @"//------------------------------------------------------------------------------
+//
+// This code was generated by ""Testably.Abstractions.Tests.SourceGenerator"".
+//
+// Changes to this file may cause incorrect behavior
+// and will be lost if the code is regenerated.
+//
+//------------------------------------------------------------------------------
+");
+}
+#pragma warning restore MA0051
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SyntaxReceiver.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SyntaxReceiver.cs
deleted file mode 100644
index 3666ebb17..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SyntaxReceiver.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-using System;
-using System.Collections.Generic;
-using Testably.Abstractions.Tests.SourceGenerator.Model;
-
-namespace Testably.Abstractions.Tests.SourceGenerator;
-
-internal sealed class SyntaxReceiver : ISyntaxReceiver
-{
- private readonly Dictionary>
- _classModels = new(StringComparer.Ordinal);
-
- public SyntaxReceiver(IEnumerable classGenerators)
- {
- foreach (ClassGeneratorBase classGenerator in classGenerators)
- {
- _classModels.Add(classGenerator.Marker, []);
- }
- }
-
- #region ISyntaxReceiver Members
-
- ///
- public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
- {
- if (syntaxNode is ClassDeclarationSyntax classDeclarationSyntax)
- {
- string? marker = classDeclarationSyntax.BaseList?.Types.FirstOrDefault()
- ?.ToString();
-
- if (marker != null &&
- _classModels.TryGetValue(marker, out List? models))
- {
- models!.Add(
- ClassModel.FromClassDeclarationSyntax(classDeclarationSyntax));
- }
- }
- }
-
- #endregion
-
- public List GetClassModels(string marker)
- {
- if (_classModels.TryGetValue(marker, out List? classModels))
- {
- return classModels!;
- }
-
- return [];
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj
index 5f539b4d7..2fd8416ca 100644
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj
+++ b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj
@@ -2,6 +2,7 @@
netstandard2.0
+ false
latest
true
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
index 0709aebb7..f1d7d9d91 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
@@ -1,13 +1,9 @@
-using aweXpect;
-using System.IO;
-using System.Threading.Tasks;
+using System.IO;
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AccessControlHelperTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AccessControlHelperTests
{
[SkippableFact]
public async Task GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow()
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
index ff04f28ca..b868d49fa 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
@@ -1,15 +1,11 @@
-using aweXpect;
using System.Security.AccessControl;
-using System.Threading.Tasks;
using Testably.Abstractions.AccessControl.Tests.TestHelpers;
using Skip = Xunit.Skip;
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class DirectoryAclExtensionsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class DirectoryAclExtensionsTests
{
[SkippableFact]
public async Task CreateDirectory_NullDirectorySecurity_ShouldThrowArgumentNullException()
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
index f74811fcc..b2f0f5f1d 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
@@ -6,10 +6,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class DirectoryInfoAclExtensionsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class DirectoryInfoAclExtensionsTests
{
[SkippableFact]
public async Task Create_NullDirectorySecurity_ShouldThrowArgumentNullException()
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
index ec97e8c3c..637ccbd2a 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
@@ -6,10 +6,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionMissingFileTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionMissingFileTests
{
[SkippableTheory]
[MemberData(nameof(GetFileCallbacks),
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
index 30049b334..ac61265a6 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[MemberData(nameof(GetFileCallbacks),
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
index 74b448e53..7fd5c60da 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class FileAclExtensionsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class FileAclExtensionsTests
{
[SkippableFact]
public async Task GetAccessControl_MissingFile_ShouldThrowFileNotFoundException()
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
index fee514bf9..56e16b09d 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class FileInfoAclExtensionsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class FileInfoAclExtensionsTests
{
[SkippableFact]
public async Task GetAccessControl_MissingFile_ShouldThrowFileNotFoundException()
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
index 88302c9f7..a625d8e7e 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.AccessControl.Tests;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class FileStreamAclExtensionsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class FileStreamAclExtensionsTests
{
[SkippableFact]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
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 3791356a6..66fbf4ab7 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj
@@ -17,12 +17,13 @@
true
- Generated
+ Generated
+ $(GeneratedFolder)\$(TargetFramework)
-
-
+
+
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..fedd6d0d2 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj
+++ b/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj
@@ -17,16 +17,13 @@
true
- Generated
+ Generated
+ $(GeneratedFolder)\$(TargetFramework)
-
-
-
-
-
-
+
+
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
index c85b818d1..b6327a9f4 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchive;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExtensionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExtensionTests
{
[SkippableTheory]
[InlineData("2000-01-01T12:14:15")]
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
index 55a649eac..c61f11b52 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchive;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
#if FEATURE_ZIPFILE_NET7
[SkippableFact]
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
index 74821bd6c..b3d651492 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchiveEntry;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExtensionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExtensionTests
{
[SkippableFact]
public async Task
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
index 6af129ac3..c9a64484a 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchiveEntry;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableFact]
public async Task Archive_ShouldBeSetToArchive()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
index e0b8d1d7f..1e5db95c7 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchiveFactory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableFact]
public async Task New_ShouldOpenWithReadMode()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
index 2cc1ffe67..abff61661 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
@@ -1,5 +1,4 @@
-using FluentAssertions;
-using System.IO.Compression;
+using System.IO.Compression;
using System.Text;
#if FEATURE_COMPRESSION_STREAM
using System.IO;
@@ -8,10 +7,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateFromDirectoryTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateFromDirectoryTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
index 65e6619cb..6ff42456e 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
@@ -7,10 +7,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExtractToDirectoryTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExtractToDirectoryTests
{
[SkippableFact]
public async Task ExtractToDirectory_MissingDestinationDirectory_ShouldCreateDirectory()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
index 174e93913..3ff6ca258 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class OpenTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class OpenTests
{
[SkippableFact]
public async Task Open_CreateMode_ShouldInitializeEmptyArchive()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
index 10533afc4..f11814e23 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableFact]
public async Task FileSystemExtension_ShouldBeSet()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
index e86d5c254..37f954cbb 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateDirectoryTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateDirectoryTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
index 9fb55bcdb..ea3704eb0 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateSymbolicLinkTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateSymbolicLinkTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
index 6fc4937c2..4f25f7695 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class DeleteTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class DeleteTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
index 11fd36da4..335de9e63 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateDirectoriesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateDirectoriesTests
{
[SkippableFact]
public void EnumerateDirectories_AbsolutePath_ShouldNotIncludeTrailingSlash()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
index 5cb88b977..d58e39da9 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
@@ -8,10 +8,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateFileSystemInfosTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateFileSystemInfosTests
{
[SkippableTheory]
[AutoData]
@@ -36,7 +34,7 @@ public void
EnumerateFileSystemEntries_SearchOptionAllDirectories_FullPath_ShouldReturnAllFileSystemEntriesWithFullPath(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -61,7 +59,7 @@ public void
EnumerateFileSystemEntries_SearchOptionAllDirectories_ShouldReturnAllFileSystemEntries(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -119,7 +117,7 @@ public void
EnumerateFileSystemEntries_WithEnumerationOptions_ShouldConsiderSetOptions(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -183,7 +181,7 @@ public void
EnumerateFileSystemEntries_WithoutSearchString_ShouldReturnAllFileSystemEntriesInDirectSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -208,7 +206,7 @@ public void
EnumerateFileSystemEntries_WithSearchPattern_ShouldReturnMatchingFileSystemEntries(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -229,7 +227,7 @@ public void
public void
EnumerateFileSystemEntries_WithSearchPatternInSubdirectory_ShouldReturnMatchingFileSystemEntriesInSubdirectories()
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithASubdirectory().Initialized(s => s
.WithAFile("foobar"))
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFilesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFilesTests.cs
index 1a4b96d42..3c819783d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFilesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFilesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateFilesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateFilesTests
{
[SkippableTheory]
[AutoData]
@@ -33,7 +31,7 @@ public void
EnumerateFiles_SearchOptionAllDirectories_FullPath_ShouldReturnAllFilesWithFullPath(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -54,7 +52,7 @@ public void
public void EnumerateFiles_SearchOptionAllDirectories_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -361,7 +359,7 @@ public void
EnumerateFiles_WithoutSearchString_ShouldReturnAllFilesInDirectSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -383,7 +381,7 @@ public void
public void EnumerateFiles_WithSearchPattern_ShouldReturnMatchingFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -404,7 +402,7 @@ public void EnumerateFiles_WithSearchPattern_ShouldReturnMatchingFiles(
public void
EnumerateFiles_WithSearchPatternInSubdirectory_ShouldReturnMatchingFilesInSubdirectories()
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithASubdirectory().Initialized(s => s
.WithAFile("foobar"))
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExceptionTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExceptionTests.cs
index 1d62bec45..c40a3536e 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExceptionTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[MemberData(nameof(GetDirectoryCallbacks), parameters: "Illegal\tCharacter?InPath")]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExistsTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExistsTests.cs
index ec791f094..3c4abddb3 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExistsTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ExistsTests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExistsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExistsTests
{
[SkippableTheory]
[InlineData("foo")]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs
index 4ad8047dd..91be93b89 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoriesTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetDirectoriesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetDirectoriesTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoryRootTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoryRootTests.cs
index ef6ae78c7..104402571 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoryRootTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetDirectoryRootTests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetDirectoryRootTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetDirectoryRootTests
{
[SkippableFact]
public void GetDirectoryRoot_Empty_ShouldThrowArgumentException()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFileSystemInfosTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFileSystemInfosTests.cs
index 48c3edaac..161421572 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFileSystemInfosTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFileSystemInfosTests.cs
@@ -8,10 +8,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetFileSystemInfosTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetFileSystemInfosTests
{
[SkippableTheory]
[AutoData]
@@ -35,7 +33,7 @@ public void
GetFileSystemEntries_SearchOptionAllDirectories_FullPath_ShouldReturnAllFileSystemEntriesWithFullPath(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -60,7 +58,7 @@ public void
GetFileSystemEntries_SearchOptionAllDirectories_ShouldReturnAllFileSystemEntries(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -118,7 +116,7 @@ public void
GetFileSystemEntries_WithEnumerationOptions_ShouldConsiderSetOptions(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -165,7 +163,7 @@ public void
GetFileSystemEntries_WithoutSearchString_ShouldReturnAllFileSystemEntriesInDirectSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -190,7 +188,7 @@ public void
GetFileSystemEntries_WithSearchPattern_ShouldReturnMatchingFileSystemEntries(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -211,7 +209,7 @@ public void
public void
GetFileSystemEntries_WithSearchPatternInSubdirectory_ShouldReturnMatchingFileSystemEntriesInSubdirectories()
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithASubdirectory().Initialized(s => s
.WithAFile("foobar"))
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFilesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFilesTests.cs
index 10f97879b..a8b273b00 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFilesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/GetFilesTests.cs
@@ -8,10 +8,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetFilesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetFilesTests
{
[SkippableTheory]
[AutoData]
@@ -70,7 +68,7 @@ public void
GetFiles_SearchOptionAllDirectories_FullPath_ShouldReturnAllFilesWithFullPath(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -91,7 +89,7 @@ public void
public void GetFiles_SearchOptionAllDirectories_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -197,7 +195,7 @@ public void
GetFiles_WithEnumerationOptions_ShouldConsiderSetOptions(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithASubdirectory().Initialized(s => s
@@ -244,7 +242,7 @@ public void
GetFiles_WithoutSearchString_ShouldReturnAllFilesInDirectSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -288,7 +286,7 @@ public void GetFiles_WithRelativePathAndSubfolders_ShouldReturnRelativeFilePath(
public void GetFiles_WithSearchPattern_ShouldReturnMatchingFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.InitializeIn(path)
.WithAFile()
.WithAFile()
@@ -309,7 +307,7 @@ public void GetFiles_WithSearchPattern_ShouldReturnMatchingFiles(
public void
GetFiles_WithSearchPatternInSubdirectory_ShouldReturnMatchingFilesInSubdirectories()
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithASubdirectory().Initialized(s => s
.WithAFile("foobar"))
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/MoveTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/MoveTests.cs
index 4c9232fa6..b03ad0af3 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/MoveTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/MoveTests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class MoveTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class MoveTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void Move_CaseOnlyChange_ShouldMoveDirectoryWithContent(string path)
string source = path.ToLowerInvariant();
string destination = path.ToUpperInvariant();
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -98,7 +96,7 @@ public void Move_ShouldMoveAttributes(string source, string destination)
[AutoData]
public void Move_ShouldMoveDirectoryWithContent(string source, string destination)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -178,7 +176,7 @@ public void Move_WithLockedFile_ShouldStillMoveDirectory_NotOnWindows(
{
Skip.If(Test.RunsOnWindows);
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -219,7 +217,7 @@ public void Move_WithLockedFile_ShouldThrowIOException_AndNotMoveDirectoryAtAll_
{
Skip.IfNot(Test.RunsOnWindows);
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -257,7 +255,7 @@ public void Move_WithLockedFile_ShouldThrowIOException_AndNotMoveDirectoryAtAll_
public void Move_WithReadOnlyFile_ShouldMoveDirectoryWithContent(
string source, string destination)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ResolveLinkTargetTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ResolveLinkTargetTests.cs
index 557d545f6..a38cd6fb1 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ResolveLinkTargetTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/ResolveLinkTargetTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ResolveLinkTargetTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ResolveLinkTargetTests
{
#region Test Setup
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/SearchFilterTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/SearchFilterTests.cs
index 4cbcb05cb..66cfe2748 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/SearchFilterTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/SearchFilterTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class SearchFilterTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class SearchFilterTests
{
[SkippableTheory]
[InlineAutoData("../", 4)]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.AdjustTimes.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.AdjustTimes.cs
index c46d23416..471c5069d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.AdjustTimes.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.AdjustTimes.cs
@@ -1,7 +1,6 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-public abstract partial class Tests
- where TFileSystem : IFileSystem
+public partial class Tests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.Times.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.Times.cs
index f7e074b7d..ea4079145 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.Times.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.Times.cs
@@ -2,8 +2,7 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-public abstract partial class Tests
- where TFileSystem : IFileSystem
+public partial class Tests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.cs
index be1854de6..f6d57b3e3 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/Tests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
#if FEATURE_FILESYSTEM_NET7
[SkippableFact]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs
index 3ccdedd89..8b26e81d5 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/AttributesTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AttributesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AttributesTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateAsSymbolicLinkTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateAsSymbolicLinkTests.cs
index c6d7c0aba..6f9e1744d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateAsSymbolicLinkTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateAsSymbolicLinkTests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateAsSymbolicLinkTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateAsSymbolicLinkTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateSubdirectoryTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateSubdirectoryTests.cs
index a0b0fdac9..9e92fc712 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateSubdirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateSubdirectoryTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateSubdirectoryTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateSubdirectoryTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateTests.cs
index ecf78d3a6..039a610dc 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/CreateTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs
index d2474d701..e9a45ad06 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class DeleteTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class DeleteTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateDirectoriesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateDirectoriesTests.cs
index 9ad3ff224..85976971c 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateDirectoriesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateDirectoriesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateDirectoriesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateDirectoriesTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
EnumerateDirectories_SearchOptionAllDirectories_ShouldReturnAllSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithSubdirectory("foo/xyz")
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFileSystemInfosTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFileSystemInfosTests.cs
index be96253f0..aaa4ff5c5 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFileSystemInfosTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFileSystemInfosTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateFileSystemInfosTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateFileSystemInfosTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
EnumerateFileSystemInfos_SearchOptionAllFiles_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory().Initialized(d => d
@@ -80,7 +78,7 @@ public void EnumerateFileSystemInfos_SearchPattern_ShouldReturnExpectedValue(
public void
EnumerateFileSystemInfos_ShouldMatchTypes(string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFilesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFilesTests.cs
index 1b3ece48e..9501978f2 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFilesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/EnumerateFilesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EnumerateFilesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EnumerateFilesTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
EnumerateFiles_SearchOptionAllFiles_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory().Initialized(d => d
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExceptionTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExceptionTests.cs
index 7b5e8bcf9..499fdb331 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExceptionTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[MemberData(nameof(GetDirectoryInfoCallbacks),
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExistsTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExistsTests.cs
index 92ed6cee7..9b45becd3 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExistsTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/ExistsTests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExistsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExistsTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetDirectoriesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetDirectoriesTests.cs
index 7be1bc52d..e939b450f 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetDirectoriesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetDirectoriesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetDirectoriesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetDirectoriesTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
GetDirectories_SearchOptionAllDirectories_ShouldReturnAllSubdirectories(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithSubdirectory("foo/xyz")
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFileSystemInfosTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFileSystemInfosTests.cs
index 0c4962f5e..6f09211a5 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFileSystemInfosTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFileSystemInfosTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetFileSystemInfosTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetFileSystemInfosTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
GetFileSystemInfos_SearchOptionAllFiles_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory().Initialized(d => d
@@ -80,7 +78,7 @@ public void GetFileSystemInfos_SearchPattern_ShouldReturnExpectedValue(
public void
GetFileSystemInfos_ShouldMatchTypes(string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFilesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFilesTests.cs
index c52059cf9..d7cea7846 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFilesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/GetFilesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetFilesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetFilesTests
{
[SkippableTheory]
[AutoData]
@@ -16,7 +14,7 @@ public void
GetFiles_SearchOptionAllFiles_ShouldReturnAllFiles(
string path)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(path).Initialized(s => s
.WithASubdirectory().Initialized(d => d
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs
index 24614b122..38b138af1 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs
@@ -3,16 +3,14 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class MoveToTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class MoveToTests
{
[SkippableTheory]
[AutoData]
public void MoveTo_ShouldMoveDirectoryWithContent(string source, string destination)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -63,7 +61,7 @@ public void MoveTo_WithLockedFile_ShouldMoveDirectory_NotOnWindows(
{
Skip.If(Test.RunsOnWindows);
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -105,7 +103,7 @@ public void MoveTo_WithLockedFile_ShouldThrowIOException_AndNotMoveDirectory_OnW
{
Skip.IfNot(Test.RunsOnWindows);
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
@@ -154,7 +152,7 @@ public void MoveTo_WithLockedFile_ShouldThrowIOException_AndNotMoveDirectory_OnW
public void MoveTo_WithReadOnlyFile_ShouldMoveDirectoryWithContent(
string source, string destination)
{
- IFileSystemDirectoryInitializer initialized =
+ IFileSystemDirectoryInitializer initialized =
FileSystem.Initialize()
.WithSubdirectory(source).Initialized(s => s
.WithAFile()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/Tests.cs
index 92904a533..340a927e1 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/Tests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableTheory]
[InlineData("foo")]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/ExceptionTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/ExceptionTests.cs
index cb293dc10..c9bbb7745 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/ExceptionTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfoFactory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[MemberData(nameof(GetDirectoryInfoFactoryCallbacks),
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/Tests.cs
index 47fe359d5..297d0130d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfoFactory/Tests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.DirectoryInfoFactory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableTheory]
[InlineData("\0foo")]
@@ -65,7 +63,7 @@ public void Wrap_ShouldWrapFromDirectoryInfo(string path)
Skip.If(FileSystem is MockFileSystem mockFileSystem &&
mockFileSystem.SimulationMode != SimulationMode.Native);
- System.IO.DirectoryInfo directoryInfo = new("S:\\" + path);
+ System.IO.DirectoryInfo directoryInfo = new(path);
IDirectoryInfo result = FileSystem.DirectoryInfo.Wrap(directoryInfo);
@@ -80,7 +78,7 @@ public void Wrap_WithSimulatedMockFileSystem_ShouldThrowNotSupportedException(st
Skip.IfNot(FileSystem is MockFileSystem mockFileSystem &&
mockFileSystem.SimulationMode != SimulationMode.Native);
- System.IO.DirectoryInfo directoryInfo = new("S:\\" + path);
+ System.IO.DirectoryInfo directoryInfo = new(path);
Exception? exception = Record.Exception(() =>
{
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfo/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfo/Tests.cs
index ae7dc5ca2..e2a3bbec6 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfo/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfo/Tests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.DriveInfo;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableFact]
public void ToString_ShouldReturnDriveName()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/ExceptionTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/ExceptionTests.cs
index ee4e5015a..c8b5d7c64 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/ExceptionTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DriveInfoFactory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[InlineData("?invalid-drive-name")]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/Tests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/Tests.cs
index a4a8d67c0..8bd75e29d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/Tests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/DriveInfoFactory/Tests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.DriveInfoFactory;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class Tests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class Tests
{
[SkippableFact]
public void GetDrives_ShouldNotBeEmpty()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesAsyncTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesAsyncTests.cs
index 9be1c795c..88a8f60b8 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesAsyncTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesAsyncTests.cs
@@ -10,10 +10,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
// ReSharper disable MethodHasAsyncOverload
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AppendAllLinesAsyncTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AppendAllLinesAsyncTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesTests.cs
index aa05ed9ca..6f4667072 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllLinesTests.cs
@@ -5,10 +5,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AppendAllLinesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AppendAllLinesTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextAsyncTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextAsyncTests.cs
index 61fb7a996..4c7d9437a 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextAsyncTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextAsyncTests.cs
@@ -8,10 +8,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
// ReSharper disable MethodHasAsyncOverload
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AppendAllTextAsyncTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AppendAllTextAsyncTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextTests.cs
index ec663c33b..90b65351e 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendAllTextTests.cs
@@ -4,10 +4,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AppendAllTextTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AppendAllTextTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendTextTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendTextTests.cs
index 9b36bfef0..66138d948 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendTextTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/AppendTextTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class AppendTextTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class AppendTextTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/CopyTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/CopyTests.cs
index e33297339..68d8d9d93 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/CopyTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/CopyTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CopyTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CopyTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateSymbolicLinkTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateSymbolicLinkTests.cs
index ca0e3ffc7..cacca201f 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateSymbolicLinkTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateSymbolicLinkTests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateSymbolicLinkTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateSymbolicLinkTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTests.cs
index 669549a74..6f5b1ab8b 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTextTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTextTests.cs
index 9c5a700bb..622fc8c37 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTextTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/CreateTextTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class CreateTextTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class CreateTextTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/DeleteTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/DeleteTests.cs
index 2d2ef41a6..2c1b2a933 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/DeleteTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/DeleteTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class DeleteTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class DeleteTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/EncryptDecryptTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/EncryptDecryptTests.cs
index 27d41e3f1..0baf5189f 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/EncryptDecryptTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/EncryptDecryptTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class EncryptDecryptTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class EncryptDecryptTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionMissingFileTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionMissingFileTests.cs
index 789cd648d..d97a3ad92 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionMissingFileTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionMissingFileTests.cs
@@ -9,10 +9,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionMissingFileTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionMissingFileTests
{
[SkippableTheory]
[MemberData(nameof(GetFileCallbacks), parameters: (int)MissingFileTestCases.DirectoryMissing)]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionTests.cs
index cd09f2ec1..ab2298489 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExceptionTests.cs
@@ -9,10 +9,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExceptionTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExceptionTests
{
[SkippableTheory]
[MemberData(nameof(GetFileCallbacks), parameters: "Illegal\tCharacter?InPath")]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExistsTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExistsTests.cs
index 3f70c03d1..6ceaaf530 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/ExistsTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/ExistsTests.cs
@@ -1,9 +1,7 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class ExistsTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class ExistsTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs
index e2567d08c..a1ab630eb 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/GetAttributesTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class GetAttributesTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class GetAttributesTests
{
[SkippableTheory]
[InlineAutoData(FileAttributes.ReadOnly)]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/MoveTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/MoveTests.cs
index 9dd733a27..7ccacdbda 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/MoveTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/MoveTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class MoveTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class MoveTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenReadTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenReadTests.cs
index 0d24cfd1e..4ccd0f93d 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenReadTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenReadTests.cs
@@ -3,10 +3,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class OpenReadTests
- : FileSystemTestBase
- where TFileSystem : IFileSystem
+[FileSystemTests]
+public partial class OpenReadTests
{
[SkippableTheory]
[AutoData]
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenTests.cs
index d56b928f2..2b31e0269 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/OpenTests.cs
@@ -2,10 +2,8 @@
namespace Testably.Abstractions.Tests.FileSystem.File;
-// ReSharper disable once PartialTypeWithSinglePart
-public abstract partial class OpenTests
- : FileSystemTestBase