diff --git a/Directory.Build.props b/Directory.Build.props
index 1c63103cd..cfad8118f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -6,7 +6,7 @@
https://github.com/Testably/Testably.Abstractions.git
git
-
+
$(MSBuildThisFileDirectory)/strongname.snk
True
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 1b78ec787..7270caa0b 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -5,18 +5,20 @@
-
+
+
+
@@ -31,20 +33,19 @@
+
+
-
-
+
-
-
-
-
+
+
+
+
-
-
-
+
diff --git a/Pipeline/Build.ApiChecks.cs b/Pipeline/Build.ApiChecks.cs
index 79535423a..ee5411de6 100644
--- a/Pipeline/Build.ApiChecks.cs
+++ b/Pipeline/Build.ApiChecks.cs
@@ -25,14 +25,13 @@ partial class Build
};
DotNetTest(s => s
- .SetConfiguration(Configuration)
- .SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
- .SetResultsDirectory(TestResultsDirectory)
- .CombineWith(
- projects,
- (settings, project) => settings
- .SetProjectFile(project)
- .AddLoggers($"trx;LogFileName={project.Name}.trx")),
- completeOnFailure: true);
+ .SetConfiguration(Configuration)
+ .SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
+ .SetResultsDirectory(TestResultsDirectory)
+ .CombineWith(
+ projects,
+ (settings, project) => settings
+ .AddProcessAdditionalArguments(
+ $"--project \"{project.Path}\" -- --report-trx")));
});
}
diff --git a/Pipeline/Build.CodeCoverage.cs b/Pipeline/Build.CodeCoverage.cs
index 03956d850..44e6cb016 100644
--- a/Pipeline/Build.CodeCoverage.cs
+++ b/Pipeline/Build.CodeCoverage.cs
@@ -18,7 +18,7 @@ partial class Build
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll",
framework: "net8.0"))
.SetTargetDirectory(TestResultsDirectory / "reports")
- .AddReports(TestResultsDirectory / "**/coverage.cobertura.xml")
+ .AddReports(TestResultsDirectory / "**/*.cobertura.xml")
.AddReportTypes(ReportTypes.OpenCover)
.AddFileFilters("-*.g.cs")
.SetAssemblyFilters("+Testably*"));
diff --git a/Pipeline/Build.MutationTests.cs b/Pipeline/Build.MutationTests.cs
index 4e5b64a60..841693445 100644
--- a/Pipeline/Build.MutationTests.cs
+++ b/Pipeline/Build.MutationTests.cs
@@ -142,7 +142,7 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
{{string.Join(",\n\t\t\t", project.Value.Select(PathForJson))}}
],
"project": {{PathForJson(project.Key)}},
- "target-framework": "net8.0",
+ "target-framework": "net10.0",
"since": {
"target": "main",
"enabled": {{(GitVersion?.BranchName != "main").ToString().ToLowerInvariant()}},
@@ -259,7 +259,7 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
{{string.Join(",\n\t\t\t", project.Value.Select(PathForJson))}}
],
"project": {{PathForJson(project.Key)}},
- "target-framework": "net8.0",
+ "target-framework": "net10.0",
"since": {
"target": "main",
"enabled": {{(GitVersion?.BranchName != "main").ToString().ToLowerInvariant()}},
@@ -280,8 +280,8 @@ await gitHubClient.Issue.Comment.Update("Testably", "Testably.Abstractions",
Log.Debug($"Created '{configFile}':{Environment.NewLine}{configText}");
string arguments = IsServerBuild
- ? $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"Dashboard\" -r \"cleartext\""
- : $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\"";
+ ? $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"Dashboard\" -r \"cleartext\" --test-runner mtp"
+ : $"-f \"{configFile}\" -O \"{StrykerOutputDirectory}\" -r \"Markdown\" -r \"cleartext\" --test-runner mtp";
string executable = EnvironmentInfo.IsWin ? "dotnet-stryker.exe" : "dotnet-stryker";
IProcess process = ProcessTasks.StartProcess(
diff --git a/Pipeline/Build.UnitTest.cs b/Pipeline/Build.UnitTest.cs
index 0b3629be5..37eb7388f 100644
--- a/Pipeline/Build.UnitTest.cs
+++ b/Pipeline/Build.UnitTest.cs
@@ -32,18 +32,16 @@ partial class Build
DotNetTest(s => s
.SetConfiguration(Configuration)
.SetProcessEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
- .SetDataCollector("XPlat Code Coverage")
.SetResultsDirectory(TestResultsDirectory)
.CombineWith(
UnitTestProjects,
(settings, project) => settings
- .SetProjectFile(project)
.CombineWith(
project.GetTargetFrameworks()?.Except(excludedFrameworks),
(frameworkSettings, framework) => frameworkSettings
.SetFramework(framework)
- .AddLoggers(
- $"trx;LogFileName={project.Name}_{framework}.trx")
+ .AddProcessAdditionalArguments(
+ $"--project \"{project.Path}\" -- --report-trx --coverage --coverage-output-format cobertura ")
)
), completeOnFailure: true
);
diff --git a/README.md b/README.md
index 78bc065d1..5a420fa3e 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ private string GetFileContent()
Then you test your class with the mocked types in `Testably.Abstractions.Testing`:
```csharp
-[Fact]
+[Test]
public void StoreData_ShouldWriteValidFile()
{
IFileSystem fileSystem = new MockFileSystem();
diff --git a/Testably.Abstractions.sln.DotSettings b/Testably.Abstractions.sln.DotSettings
index f3da3e4a5..f133f7c18 100644
--- a/Testably.Abstractions.sln.DotSettings
+++ b/Testably.Abstractions.sln.DotSettings
@@ -459,6 +459,9 @@
True
True
True
+ True
+ False
+ False
True
True
DisabledByUser
@@ -475,4 +478,4 @@
True
True
True
-
\ No newline at end of file
+
diff --git a/Testably.Abstractions.slnx b/Testably.Abstractions.slnx
index 3ff19b181..92d58e5c0 100644
--- a/Testably.Abstractions.slnx
+++ b/Testably.Abstractions.slnx
@@ -22,10 +22,6 @@
-
-
-
-
@@ -69,9 +65,6 @@
-
-
-
diff --git a/Tests/Api/Directory.Build.props b/Tests/Api/Directory.Build.props
deleted file mode 100644
index 2495c306c..000000000
--- a/Tests/Api/Directory.Build.props
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
- net10.0
-
-
-
- latest
- disable
- enable
- false
- 701;1702;CA1845
-
-
-
- annotations
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs b/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs
index 0369b6be6..18391c15f 100644
--- a/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs
+++ b/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs
@@ -1,5 +1,7 @@
-using NUnit.Framework;
+using aweXpect;
+using TUnit;
using System;
+using System.Threading.Tasks;
namespace Testably.Abstractions.Api.Tests;
@@ -8,9 +10,9 @@ public sealed class ApiAcceptance
///
/// Execute this test to update the expected public API to the current API surface.
///
- [TestCase]
+ [Test]
[Explicit]
- public void AcceptApiChanges()
+ public async Task AcceptApiChanges()
{
string[] assemblyNames =
[
@@ -30,6 +32,6 @@ public void AcceptApiChanges()
}
}
- Assert.That(assemblyNames, Is.Not.Empty);
+ await Expect.That(assemblyNames).IsNotEmpty();
}
}
diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs b/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs
index 12f3ef46a..b517d09a8 100644
--- a/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs
+++ b/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs
@@ -1,5 +1,6 @@
-using NUnit.Framework;
-using System.Collections;
+using aweXpect;
+using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Testably.Abstractions.Api.Tests;
@@ -10,65 +11,54 @@ namespace Testably.Abstractions.Api.Tests;
///
public sealed class ApiApprovalTests
{
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractions(string framework)
+ public static IEnumerable TargetFrameworks()
+ => Helper.GetTargetFrameworks();
+
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractions(string framework)
{
const string assemblyName = "Testably.Abstractions";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractionsAccessControl(string framework)
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractionsAccessControl(string framework)
{
const string assemblyName = "Testably.Abstractions.AccessControl";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractionsCompression(string framework)
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractionsCompression(string framework)
{
const string assemblyName = "Testably.Abstractions.Compression";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractionsTesting(string framework)
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractionsTesting(string framework)
{
const string assemblyName = "Testably.Abstractions.Testing";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
- }
-
- private sealed class TargetFrameworksTheoryData : IEnumerable
- {
- #region IEnumerable Members
-
- public IEnumerator GetEnumerator()
- {
- foreach (string targetFramework in Helper.GetTargetFrameworks())
- {
- yield return new object[]
- {
- targetFramework
- };
- }
- }
-
- #endregion
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
}
diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs b/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs
index 206ec8c6f..d31419963 100644
--- a/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs
+++ b/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs
@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.Linq;
using System.Xml.XPath;
+using Assembly = System.Reflection.Assembly;
namespace Testably.Abstractions.Api.Tests;
diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj b/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj
index 5f8c31b05..e411216d2 100644
--- a/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj
+++ b/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj
@@ -1,7 +1,12 @@
+
+
+ net10.0
+
+
diff --git a/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiAcceptance.cs b/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiAcceptance.cs
index 746e2913f..0b9119901 100644
--- a/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiAcceptance.cs
+++ b/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiAcceptance.cs
@@ -1,5 +1,6 @@
-using NUnit.Framework;
+using aweXpect;
using System;
+using System.Threading.Tasks;
namespace Testably.Abstractions.Core.Api.Tests;
@@ -8,9 +9,9 @@ public sealed class ApiAcceptance
///
/// Execute this test to update the expected public API to the current API surface.
///
- [TestCase]
+ [Test]
[Explicit]
- public void AcceptApiChanges()
+ public async Task AcceptApiChanges()
{
string[] assemblyNames =
[
@@ -28,6 +29,6 @@ public void AcceptApiChanges()
}
}
- Assert.That(assemblyNames, Is.Not.Empty);
+ await Expect.That(assemblyNames).IsNotEmpty();
}
}
diff --git a/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiApprovalTests.cs b/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiApprovalTests.cs
index 42290dcfa..c2ad8514d 100644
--- a/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiApprovalTests.cs
+++ b/Tests/Api/Testably.Abstractions.Core.Api.Tests/ApiApprovalTests.cs
@@ -1,5 +1,6 @@
-using NUnit.Framework;
-using System.Collections;
+using aweXpect;
+using System.Collections.Generic;
+using System.Threading.Tasks;
namespace Testably.Abstractions.Core.Api.Tests;
@@ -10,43 +11,30 @@ namespace Testably.Abstractions.Core.Api.Tests;
///
public sealed class ApiApprovalTests
{
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractionsFileSystemInterface(string framework)
+ public static IEnumerable TargetFrameworks()
+ => Helper.GetTargetFrameworks();
+
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractionsFileSystemInterface(string framework)
{
const string assemblyName = "Testably.Abstractions.FileSystem.Interface";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
- [TestCaseSource(typeof(TargetFrameworksTheoryData))]
- public void VerifyPublicApiForTestablyAbstractionsInterface(string framework)
+ [Test]
+ [MethodDataSource(nameof(TargetFrameworks))]
+ public async Task VerifyPublicApiForTestablyAbstractionsInterface(string framework)
{
const string assemblyName = "Testably.Abstractions.Interface";
string publicApi = Helper.CreatePublicApi(framework, assemblyName);
string expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- Assert.That(publicApi, Is.EqualTo(expectedApi));
- }
-
- private sealed class TargetFrameworksTheoryData : IEnumerable
- {
- #region IEnumerable Members
-
- public IEnumerator GetEnumerator()
- {
- foreach (string targetFramework in Helper.GetTargetFrameworks())
- {
- yield return new object[]
- {
- targetFramework
- };
- }
- }
-
- #endregion
+ await Expect.That(publicApi).IsEqualTo(expectedApi);
}
}
diff --git a/Tests/Api/Testably.Abstractions.Core.Api.Tests/Helper.cs b/Tests/Api/Testably.Abstractions.Core.Api.Tests/Helper.cs
index 5356f63c1..2448c5afd 100644
--- a/Tests/Api/Testably.Abstractions.Core.Api.Tests/Helper.cs
+++ b/Tests/Api/Testably.Abstractions.Core.Api.Tests/Helper.cs
@@ -2,10 +2,10 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.Linq;
using System.Xml.XPath;
+using Assembly = System.Reflection.Assembly;
namespace Testably.Abstractions.Core.Api.Tests;
diff --git a/Tests/Api/Testably.Abstractions.Core.Api.Tests/Testably.Abstractions.Core.Api.Tests.csproj b/Tests/Api/Testably.Abstractions.Core.Api.Tests/Testably.Abstractions.Core.Api.Tests.csproj
index 871d4ade9..4787892b4 100644
--- a/Tests/Api/Testably.Abstractions.Core.Api.Tests/Testably.Abstractions.Core.Api.Tests.csproj
+++ b/Tests/Api/Testably.Abstractions.Core.Api.Tests/Testably.Abstractions.Core.Api.Tests.csproj
@@ -1,7 +1,12 @@
+
+ net10.0
+
+
+
diff --git a/Tests/Directory.Build.props b/Tests/Directory.Build.props
index d327bf774..2cea7909d 100644
--- a/Tests/Directory.Build.props
+++ b/Tests/Directory.Build.props
@@ -1,26 +1,23 @@
-
+ Condition="Exists('$(MSBuildThisFileDirectory)/../Directory.Build.props')"/>
+
-
+
net8.0;net9.0;net10.0;net48
net8.0;net9.0;net10.0
net48
-
- net10.0
-
-
latest
disable
enable
false
Exe
- $(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0042;MA0076;xUnit1044;xUnit1045;NU1603
+ $(NoWarn);701;1702;CA1845;MA0003;MA0004;MA0018;MA0020;MA0038;MA0042;MA0076;xUnit1045;NU1603;NU1608
+ false
@@ -28,23 +25,18 @@
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
all
+ runtime; build; native; contentfiles; analyzers
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
+
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/AssertionHelpers.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/AssertionHelpers.cs
index 066b47314..4594495fe 100644
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/AssertionHelpers.cs
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/AssertionHelpers.cs
@@ -1,12 +1,13 @@
-using aweXpect.Core;
+#if NET8_0_OR_GREATER
+using System.Diagnostics.CodeAnalysis;
+#endif
+using aweXpect.Core;
using aweXpect.Core.Constraints;
using aweXpect.Core.Sources;
using aweXpect.Delegates;
using aweXpect.Formatting;
using System;
-using System.Diagnostics.CodeAnalysis;
using System.IO;
-using System.Linq;
using System.Text;
using static aweXpect.Delegates.ThatDelegate;
@@ -15,16 +16,20 @@ namespace Testably.Abstractions.TestHelpers;
public static class AssertionHelpers
{
///
- /// Verifies that the throws either a or
- /// a with their corresponding HResult values.
+ /// Verifies that the throws either a or
+ /// a with their corresponding HResult values.
///
- public static ThatDelegateThrows ThrowsAFileOrDirectoryNotFoundException(this ThatDelegate @delegate)
+ public static ThatDelegateThrows ThrowsAFileOrDirectoryNotFoundException(
+ this ThatDelegate @delegate)
{
- var throwOptions = new ThatDelegate.ThrowsOption();
+ ThrowsOption? throwOptions = new();
return new ThatDelegateThrows(
- @delegate.ExpectationBuilder.AddConstraint((it, grammars) => new DelegateIsNotNullWithinTimeoutConstraint(it, grammars, throwOptions))
+ @delegate.ExpectationBuilder.AddConstraint((it, grammars)
+ => new DelegateIsNotNullWithinTimeoutConstraint(it, grammars, throwOptions))
.ForWhich(d => d.Exception)
- .AddConstraint((it, grammars) => new ThrowsAFileOrDirectoryNotFoundExceptionConstraint(it, grammars, throwOptions))
+ .AddConstraint((it, grammars)
+ => new ThrowsAFileOrDirectoryNotFoundExceptionConstraint(it, grammars,
+ throwOptions))
.And(" "), throwOptions);
}
@@ -37,6 +42,14 @@ private sealed class DelegateIsNotNullWithinTimeoutConstraint(
{
private DelegateValue? _actual;
+ #region IValueConstraint Members
+
+ public override void AppendExpectation(StringBuilder stringBuilder,
+ string? indentation = null)
+ {
+ // Do nothing
+ }
+
public ConstraintResult IsMetBy(DelegateValue value)
{
_actual = value;
@@ -47,7 +60,7 @@ public ConstraintResult IsMetBy(DelegateValue value)
}
if (options.ExecutionTimeOptions is not null &&
- !options.ExecutionTimeOptions.IsWithinLimit(value.Duration))
+ !options.ExecutionTimeOptions.IsWithinLimit(value.Duration))
{
Outcome = Outcome.Failure;
return this;
@@ -57,10 +70,7 @@ public ConstraintResult IsMetBy(DelegateValue value)
return this;
}
- public override void AppendExpectation(StringBuilder stringBuilder, string? indentation = null)
- {
- // Do nothing
- }
+ #endregion
public override void AppendResult(StringBuilder stringBuilder, string? indentation = null)
{
@@ -75,25 +85,54 @@ public override void AppendResult(StringBuilder stringBuilder, string? indentati
}
}
- public override bool TryGetValue([NotNullWhen(true)] out TValue? value) where TValue : default
+ public override ConstraintResult Negate()
+ => this;
+
+#if NET8_0_OR_GREATER
+ public override bool TryGetValue([NotNullWhen(true)] out TValue? value)
+ where TValue : default
+#else
+ #pragma warning disable CS8765
+ public override bool TryGetValue(out TValue? value) where TValue : default
+ #pragma warning restore CS8765
+#endif
{
value = default;
return false;
}
-
- public override ConstraintResult Negate()
- => this;
}
private sealed class ThrowsAFileOrDirectoryNotFoundExceptionConstraint(
string it,
ExpectationGrammars grammars,
- ThatDelegate.ThrowsOption throwOptions)
+ ThrowsOption throwOptions)
: ConstraintResult(grammars),
IValueConstraint
{
private Exception? _actual;
+ #region IValueConstraint Members
+
+ public override void AppendExpectation(StringBuilder stringBuilder,
+ string? indentation = null)
+ {
+ if (!throwOptions.DoCheckThrow)
+ {
+ stringBuilder.Append("does not throw any exception");
+ }
+ else
+ {
+ stringBuilder.Append(
+ "throws a FileNotFoundException or a DirectoryNotFoundException with correct HResult");
+ }
+
+ if (throwOptions.ExecutionTimeOptions is not null)
+ {
+ stringBuilder.Append(' ');
+ throwOptions.ExecutionTimeOptions.AppendTo(stringBuilder, "in ");
+ }
+ }
+
///
public ConstraintResult IsMetBy(Exception? value)
{
@@ -111,8 +150,10 @@ public ConstraintResult IsMetBy(Exception? value)
FurtherProcessingStrategy = FurtherProcessingStrategy.IgnoreResult;
}
- if (value is FileNotFoundException fileNotFoundException && fileNotFoundException.HResult == -2147024894 ||
- value is DirectoryNotFoundException directoryNotFoundException && directoryNotFoundException.HResult == -2147024893)
+ if ((value is FileNotFoundException fileNotFoundException &&
+ fileNotFoundException.HResult == -2147024894) ||
+ (value is DirectoryNotFoundException directoryNotFoundException &&
+ directoryNotFoundException.HResult == -2147024893))
{
Outcome = Outcome.Success;
return this;
@@ -122,23 +163,7 @@ public ConstraintResult IsMetBy(Exception? value)
return this;
}
- public override void AppendExpectation(StringBuilder stringBuilder, string? indentation = null)
- {
- if (!throwOptions.DoCheckThrow)
- {
- stringBuilder.Append("does not throw any exception");
- }
- else
- {
- stringBuilder.Append("throws a FileNotFoundException or a DirectoryNotFoundException with correct HResult");
- }
-
- if (throwOptions.ExecutionTimeOptions is not null)
- {
- stringBuilder.Append(' ');
- throwOptions.ExecutionTimeOptions.AppendTo(stringBuilder, "in ");
- }
- }
+ #endregion
public override void AppendResult(StringBuilder stringBuilder, string? indentation = null)
{
@@ -153,7 +178,20 @@ public override void AppendResult(StringBuilder stringBuilder, string? indentati
}
}
- public override bool TryGetValue([NotNullWhen(true)] out TValue? value) where TValue : default
+ public override ConstraintResult Negate()
+ {
+ throwOptions.DoCheckThrow = !throwOptions.DoCheckThrow;
+ return this;
+ }
+
+#if NET8_0_OR_GREATER
+ public override bool TryGetValue([NotNullWhen(true)] out TValue? value)
+ where TValue : default
+#else
+ #pragma warning disable CS8765
+ public override bool TryGetValue(out TValue? value) where TValue : default
+ #pragma warning restore CS8765
+#endif
{
if (_actual is TValue typedValue)
{
@@ -165,12 +203,6 @@ public override void AppendResult(StringBuilder stringBuilder, string? indentati
return typeof(TValue).IsAssignableFrom(typeof(DirectoryNotFoundException));
}
- public override ConstraintResult Negate()
- {
- throwOptions.DoCheckThrow = !throwOptions.DoCheckThrow;
- return this;
- }
-
private static string FormatForMessage(Exception exception)
{
string message = PrependAOrAn(Format.Formatter.Format(exception.GetType()));
@@ -181,7 +213,6 @@ private static string FormatForMessage(Exception exception)
return message;
- [return: NotNullIfNotNull(nameof(value))]
static string? Indent(string? value, string? indentation = " ",
bool indentFirstLine = true)
{
@@ -196,13 +227,17 @@ private static string FormatForMessage(Exception exception)
}
return (indentFirstLine ? indentation : "")
- + value.Replace("\n", $"\n{indentation}");
+ + value.Replace("\n", $"\n{indentation}");
}
static string PrependAOrAn(string value)
{
char[] vocals = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U',];
+#if NET8_0_OR_GREATER
if (value.Length > 0 && vocals.Contains(value[0]))
+#else
+ if (value.Length > 0 && vocals.Contains($"{value[0]}", StringComparison.Ordinal))
+#endif
{
return $"an {value}";
}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoArguments.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoArguments.cs
new file mode 100644
index 000000000..421a1ecb7
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoArguments.cs
@@ -0,0 +1,55 @@
+using AutoFixture;
+using AutoFixture.Kernel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Testably.Abstractions.TestHelpers;
+
+///
+/// Provides a data source for a data theory, with the data coming from inline
+/// values combined with auto-generated data specimens generated by AutoFixture.
+///
+public class AutoArgumentsAttribute : UntypedDataSourceGeneratorAttribute
+{
+ ///
+ /// Gets the fixture factory.
+ ///
+ private readonly Func _fixtureFactory;
+
+ ///
+ /// Gets the data values to pass to the theory.
+ ///
+ private readonly object?[] _values;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AutoArgumentsAttribute(params object?[] values)
+ : this(() => new Fixture(), values)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ protected AutoArgumentsAttribute(Func fixtureFactory, params object?[]? values)
+ {
+ _fixtureFactory = fixtureFactory ?? throw new ArgumentNullException(nameof(fixtureFactory));
+ _values = values ?? [null,];
+ }
+
+ ///
+ protected override IEnumerable> GenerateDataSources(
+ DataGeneratorMetadata dataGeneratorMetadata)
+ {
+ if (dataGeneratorMetadata.TestInformation is not null)
+ {
+ IFixture fixture = _fixtureFactory();
+ yield return ()
+ => _values.Concat(dataGeneratorMetadata.TestInformation.Parameters
+ .Skip(_values.Length)
+ .Select(x => fixture.Create(x.Type, new SpecimenContext(fixture)))).ToArray();
+ }
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoDomainDataAttribute.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoDomainDataAttribute.cs
deleted file mode 100644
index 6eb9036df..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/AutoDomainDataAttribute.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-using AutoFixture;
-using AutoFixture.AutoNSubstitute;
-using AutoFixture.Xunit3;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// Extension of that uses applies domain-specific customizations.
-///
-public class AutoDomainDataAttribute : AutoDataAttribute
-{
- ///
- /// Adds an additional that is applied for only this test.
- ///
- public Type? CustomizeWith
- {
- get;
- set
- {
- field = value;
- _fixtureFactory.CustomizeWith(value);
- }
- }
-
- private readonly DomainFixtureFactory _fixtureFactory;
-
- ///
- /// Extension of that uses applies domain-specific customizations.
- ///
- public AutoDomainDataAttribute() : this(new DomainFixtureFactory())
- {
- }
-
- private AutoDomainDataAttribute(DomainFixtureFactory fixtureFactory)
- : base(fixtureFactory.GetFixtureFactory)
- {
- _fixtureFactory = fixtureFactory;
- }
-
- private sealed class DomainFixtureFactory
- {
- private static Lazy _domainCustomisation { get; } = new(Initialize);
- private ICustomization? _customizeWith;
-
- public void CustomizeWith(Type? type)
- {
- Type customizationInterface = typeof(ICustomization);
- if (type != null &&
- customizationInterface.IsAssignableFrom(type))
- {
- try
- {
- _customizeWith = (ICustomization?)Activator.CreateInstance(type);
- }
- catch (Exception ex)
- {
- throw new InvalidOperationException(
- $"Could not instantiate customization with '{type.Name}'!", ex);
- }
- }
- }
-
- public Fixture GetFixtureFactory()
- {
- Fixture fixture = new();
- fixture.Customize(new AutoNSubstituteCustomization());
- foreach (ICustomization domainCustomization in _domainCustomisation.Value)
- {
- domainCustomization.Customize(fixture);
- }
-
- if (_customizeWith != null)
- {
- fixture.Customize(_customizeWith);
- }
-
- return fixture;
- }
-
- private static ICustomization[] Initialize()
- {
- List domainCustomizations = new();
- Type autoDataCustomizationInterface = typeof(IAutoDataCustomization);
- foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
- {
- try
- {
- foreach (Type type in assembly.GetTypes()
- .Where(x => x.IsClass &&
- autoDataCustomizationInterface.IsAssignableFrom(x)))
- {
- try
- {
- IAutoDataCustomization? domainCustomization =
- (IAutoDataCustomization?)Activator.CreateInstance(type);
- if (domainCustomization != null)
- {
- domainCustomizations.Add(domainCustomization);
- }
- }
- catch (Exception ex)
- {
- throw new InvalidOperationException(
- $"Could not instantiate auto data customization '{type.Name}'!",
- ex);
- }
- }
- }
- catch (ReflectionTypeLoadException)
- {
- // Ignore assemblies that can't be loaded
- }
- }
-
- return domainCustomizations.ToArray();
- }
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs
new file mode 100644
index 000000000..0281cfd20
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestBase.cs
@@ -0,0 +1,118 @@
+using System;
+using System.IO.Abstractions;
+using System.Threading;
+using Testably.Abstractions.Testing.Initializer;
+
+namespace Testably.Abstractions.TestHelpers;
+
+[Retry(1)]
+public abstract class FileSystemTestBase : IDisposable
+{
+ ///
+ /// 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;
+
+ ///
+ /// The base path of the , which is used for all file system operations in the test.
+ ///
+ ///
+ /// It will be set to a random temporary path for each test, which is automatically cleaned up after the test
+ /// execution. You can use it to create files and directories for testing. It is guaranteed that the base path is empty
+ /// at the beginning of the test, so you can safely create files and directories without worrying about conflicts with
+ /// existing files or directories.
+ ///
+ public string BasePath { get; private set; }
+
+ ///
+ /// A cancellation token that can be used to cancel the test execution when it takes too long.
+ ///
+ public CancellationToken CancellationToken { get; }
+
+ ///
+ /// The file system to test.
+ ///
+ public IFileSystem FileSystem { get; }
+
+ ///
+ /// The test environment used when simulating other operating systems.
+ ///
+ public Test Test { get; }
+
+ ///
+ /// The time system associdated with the .
+ ///
+ public ITimeSystem TimeSystem { get; }
+
+ private readonly IDirectoryCleaner _directoryCleaner;
+
+ protected FileSystemTestBase(FileSystemTestData testData)
+ {
+ (FileSystem, TimeSystem) = testData.GetAbstractions();
+ _directoryCleaner = testData.GetDirectoryCleaner(FileSystem);
+ BasePath = _directoryCleaner.BasePath;
+ Test = testData.GetTest();
+ CancellationToken = TestContext.Current!.Execution.CancellationToken;
+ }
+
+ #region IDisposable Members
+
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ #endregion
+
+ ///
+ /// 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 static void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+#if DEBUG
+ Skip.If(Settings.BrittleTests == Settings.TestSettingStatus.AlwaysDisabled,
+ $"Brittle tests are {Settings.BrittleTests}. You can enable them by setting the corresponding settings in Testably.Abstractions.TestHelpers.Settings.");
+#else
+ Skip.If(Settings.BrittleTests != Settings.TestSettingStatus.AlwaysEnabled,
+ $"Brittle tests are {Settings.BrittleTests}. You can enable them by setting the corresponding settings in Testably.Abstractions.TestHelpers.Settings.");
+#endif
+ }
+
+ ///
+ /// Specifies, if long-running tests should be skipped on the real file system.
+ ///
+ public static void SkipIfLongRunningTestsShouldBeSkipped()
+ {
+#if DEBUG
+ Skip.If(Settings.LongRunningTests == Settings.TestSettingStatus.AlwaysDisabled,
+ $"Long-running tests are {Settings.LongRunningTests}. You can enable them by setting the corresponding settings in Testably.Abstractions.TestHelpers.Settings.");
+#else
+ Skip.If(Settings.LongRunningTests != Settings.TestSettingStatus.AlwaysEnabled,
+ $"Long-running tests are {Settings.LongRunningTests}. You can enable them by setting the corresponding settings in Testably.Abstractions.TestHelpers.Settings.");
+#endif
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _directoryCleaner.Dispose();
+ }
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestData.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestData.cs
new file mode 100644
index 000000000..056769f02
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestData.cs
@@ -0,0 +1,107 @@
+using System;
+using System.IO.Abstractions;
+using Testably.Abstractions.Testing;
+using Testably.Abstractions.Testing.Initializer;
+#if !NETFRAMEWORK
+using System.Runtime.InteropServices;
+#endif
+
+namespace Testably.Abstractions.TestHelpers;
+
+public abstract class FileSystemTestData
+{
+ private readonly string _testCase;
+
+ protected FileSystemTestData(string testCase)
+ {
+ _testCase = testCase;
+ }
+
+ public abstract (IFileSystem fileSystem, ITimeSystem) GetAbstractions();
+ public abstract IDirectoryCleaner GetDirectoryCleaner(IFileSystem fileSystem);
+ public abstract Test GetTest();
+
+ ///
+ public override string ToString()
+ => _testCase;
+
+ public class Mocked : FileSystemTestData
+ {
+#if !NETFRAMEWORK
+ private readonly OSPlatform? _osPlatform;
+ private readonly SimulationMode? _simulationMode;
+#endif
+
+ public Mocked(string testCase) : base(testCase)
+ {
+ }
+
+#if !NETFRAMEWORK
+ public Mocked(SimulationMode? simulationMode, OSPlatform? osPlatform, string testCase) :
+ base(testCase)
+ {
+ _simulationMode = simulationMode;
+ _osPlatform = osPlatform;
+ }
+#endif
+
+ ///
+ public override (IFileSystem fileSystem, ITimeSystem) GetAbstractions()
+ {
+#if NETFRAMEWORK
+ MockFileSystem fileSystem = new();
+#else
+ MockFileSystem fileSystem = _simulationMode is null
+ ? new MockFileSystem()
+ : new MockFileSystem(o => o.SimulatingOperatingSystem(_simulationMode.Value));
+#endif
+ ITimeSystem timeSystem = fileSystem.TimeSystem;
+ return (fileSystem, timeSystem);
+ }
+
+ ///
+ public override IDirectoryCleaner GetDirectoryCleaner(IFileSystem fileSystem)
+ {
+ return fileSystem.SetCurrentDirectoryToEmptyTemporaryDirectory();
+ }
+
+#if !NETFRAMEWORK
+ ///
+ public override Test GetTest()
+ => _osPlatform is null ? new Test() : new Test(_osPlatform.Value);
+#else
+ ///
+ public override Test GetTest()
+ => new();
+#endif
+ }
+
+ public class Real : FileSystemTestData
+ {
+ private readonly DataGeneratorMetadata _dataGeneratorMetadata;
+
+ public Real(DataGeneratorMetadata dataGeneratorMetadata,
+ string testCase = "RealFileSystem") : base(testCase)
+ {
+ _dataGeneratorMetadata = dataGeneratorMetadata;
+ }
+
+ ///
+ public override (IFileSystem fileSystem, ITimeSystem) GetAbstractions()
+ {
+ RealFileSystem fileSystem = new();
+ RealTimeSystem timeSystem = new();
+ return (fileSystem, timeSystem);
+ }
+
+ ///
+ public override IDirectoryCleaner GetDirectoryCleaner(IFileSystem fileSystem)
+ => fileSystem.SetCurrentDirectoryToEmptyTemporaryDirectory(
+ $"{_dataGeneratorMetadata.TestInformation?.Class.Name}{fileSystem.Path.DirectorySeparatorChar}{_dataGeneratorMetadata.TestInformation?.Name ?? _dataGeneratorMetadata.TestSessionId}-",
+ Console.WriteLine);
+
+ ///
+ public override Test GetTest()
+ => new();
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestsAttribute.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestsAttribute.cs
new file mode 100644
index 000000000..c6e7b7dfa
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/FileSystemTestsAttribute.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Threading.Tasks;
+using TUnit.Core.Interfaces;
+#if !NETFRAMEWORK
+using Testably.Abstractions.Testing;
+#endif
+
+namespace Testably.Abstractions.TestHelpers;
+
+[AttributeUsage(AttributeTargets.Class)]
+public class FileSystemTestsAttribute : TypedDataSourceAttribute,
+ ITestDiscoveryEventReceiver
+{
+#if NET8_0_OR_GREATER
+ private static readonly ValueTask _completedTask = ValueTask.CompletedTask;
+#else
+ private static readonly ValueTask _completedTask = new(Task.CompletedTask);
+#endif
+
+ #region ITestDiscoveryEventReceiver Members
+
+ ///
+ public int Order { get; } = 0;
+
+ ///
+ public ValueTask OnTestDiscovered(DiscoveredTestContext context)
+ {
+ if (context.TestContext.Metadata.TestDetails.TestClassArguments.Length > 0 &&
+ context.TestContext.Metadata.TestDetails.TestClassArguments[0] is FileSystemTestData
+ .Real)
+ {
+ context.AddParallelConstraint(new NotInParallelConstraint(["RealFileSystem"]));
+ }
+
+ return _completedTask;
+ }
+
+ #endregion
+
+ public override async IAsyncEnumerable>> GetTypedDataRowsAsync(
+ DataGeneratorMetadata dataGeneratorMetadata)
+ {
+ await Task.CompletedTask;
+ yield return () => Task.FromResult(
+ new FileSystemTestData.Mocked("MockFileSystem"));
+
+#if !NETFRAMEWORK
+ yield return () => Task.FromResult(
+ new FileSystemTestData.Mocked(SimulationMode.Linux, OSPlatform.Linux,
+ "LinuxFileSystem"));
+
+ yield return () => Task.FromResult(
+ new FileSystemTestData.Mocked(SimulationMode.MacOS, OSPlatform.OSX,
+ "MacFileSystem"));
+
+ yield return () => Task.FromResult(
+ new FileSystemTestData.Mocked(SimulationMode.Windows, OSPlatform.Windows,
+ "WindowsFileSystem"));
+#endif
+
+#if DEBUG
+ if (Settings.RealFileSystemTests == Settings.TestSettingStatus.AlwaysEnabled)
+#else
+ if (Settings.RealFileSystemTests != Settings.TestSettingStatus.AlwaysDisabled)
+#endif
+ {
+ yield return () => Task.FromResult(
+ new FileSystemTestData.Real(dataGeneratorMetadata));
+ }
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/IAutoDataCustomization.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/IAutoDataCustomization.cs
deleted file mode 100644
index 72dacba9c..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/IAutoDataCustomization.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using AutoFixture;
-
-namespace Testably.Abstractions.TestHelpers;
-
-///
-/// Marks customizations of that should always be applied when using the .
-///
-public interface IAutoDataCustomization : ICustomization
-{
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs
new file mode 100644
index 000000000..a50fcea6a
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestBase.cs
@@ -0,0 +1,23 @@
+using System.Threading;
+
+namespace Testably.Abstractions.TestHelpers;
+
+[Retry(1)]
+public abstract class RandomSystemTestBase
+{
+ ///
+ /// A cancellation token that can be used to cancel the test execution when it takes too long.
+ ///
+ public CancellationToken CancellationToken { get; }
+
+ ///
+ /// The random system to test.
+ ///
+ public IRandomSystem RandomSystem { get; }
+
+ protected RandomSystemTestBase(RandomSystemTestData testData)
+ {
+ RandomSystem = testData.RandomSystem;
+ CancellationToken = TestContext.Current!.Execution.CancellationToken;
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestData.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestData.cs
new file mode 100644
index 000000000..bb806e871
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestData.cs
@@ -0,0 +1,13 @@
+namespace Testably.Abstractions.TestHelpers;
+
+public class RandomSystemTestData(IRandomSystem randomSystem)
+{
+ ///
+ /// The random system to test.
+ ///
+ public IRandomSystem RandomSystem { get; } = randomSystem;
+
+ ///
+ public override string ToString()
+ => RandomSystem.GetType().Name;
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestsAttribute.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestsAttribute.cs
new file mode 100644
index 000000000..fbcaacb88
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/RandomSystemTestsAttribute.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Testably.Abstractions.Testing;
+
+namespace Testably.Abstractions.TestHelpers;
+
+[AttributeUsage(AttributeTargets.Class)]
+public class RandomSystemTestsAttribute : TypedDataSourceAttribute
+{
+ public override async IAsyncEnumerable>> GetTypedDataRowsAsync(
+ DataGeneratorMetadata dataGeneratorMetadata)
+ {
+ await Task.CompletedTask;
+ yield return () => Task.FromResult(
+ new RandomSystemTestData(new MockRandomSystem()));
+ yield return () => Task.FromResult(
+ new RandomSystemTestData(new RealRandomSystem()));
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Record.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/Record.cs
new file mode 100644
index 000000000..eaa702ed8
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/Record.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Threading.Tasks;
+
+namespace Testably.Abstractions.TestHelpers;
+
+public static class Record
+{
+ public static Exception? Exception(Action action)
+ {
+ try
+ {
+ action();
+ return null;
+ }
+ catch (Exception exception)
+ {
+ return exception;
+ }
+ }
+
+ public static async Task ExceptionAsync(Func action)
+ {
+ try
+ {
+ await action();
+ return null;
+ }
+ catch (Exception exception)
+ {
+ return exception;
+ }
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestEnvironment.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings.cs
similarity index 55%
rename from Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestEnvironment.cs
rename to Tests/Helpers/Testably.Abstractions.TestHelpers/Settings.cs
index 634d6e28d..afff0d756 100644
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestEnvironment.cs
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings.cs
@@ -1,25 +1,43 @@
-namespace Testably.Abstractions.TestHelpers.Settings;
+namespace Testably.Abstractions.TestHelpers;
-public class TestEnvironment
+public static class Settings
{
///
/// Affects some tests, that are brittle on the real file system.
///
/// Per default, they are .
- public TestSettingStatus BrittleTests { get; set; }
+ public static TestSettingStatus BrittleTests { get; set; }
= TestSettingStatus.AlwaysDisabled;
///
/// Affects some tests, that take a long time to run against the real file system (e.g. timeout).
///
/// Per default, they are .
- public TestSettingStatus LongRunningTests { get; set; }
+ public static TestSettingStatus LongRunningTests { get; set; }
= TestSettingStatus.DisabledInDebugMode;
///
/// Affects all tests against the real file system.
///
/// Per default, they are .
- public TestSettingStatus RealFileSystemTests { get; set; }
+ public static TestSettingStatus RealFileSystemTests { get; set; }
= TestSettingStatus.DisabledInDebugMode;
+
+ public enum TestSettingStatus
+ {
+ ///
+ /// The tests are always enabled.
+ ///
+ AlwaysEnabled,
+
+ ///
+ /// The tests are only disabled in DEBUG mode.
+ ///
+ DisabledInDebugMode,
+
+ ///
+ /// The tests are always disabled.
+ ///
+ AlwaysDisabled,
+ }
}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingStatus.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingStatus.cs
deleted file mode 100644
index 448f20dfd..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingStatus.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace Testably.Abstractions.TestHelpers.Settings;
-
-public enum TestSettingStatus
-{
- ///
- /// The tests are always enabled.
- ///
- AlwaysEnabled,
-
- ///
- /// The tests are only disabled in DEBUG mode.
- ///
- DisabledInDebugMode,
-
- ///
- /// The tests are always disabled.
- ///
- AlwaysDisabled,
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingsFixture.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingsFixture.cs
deleted file mode 100644
index b4b0540f0..000000000
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/Settings/TestSettingsFixture.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.IO;
-
-namespace Testably.Abstractions.TestHelpers.Settings;
-
-// ReSharper disable once UnusedMember.Global
-public class TestSettingsFixture
-{
- public TestSettingStatus BrittleTests { get; }
- public TestSettingStatus LongRunningTests { get; }
- public TestSettingStatus RealFileSystemTests { get; }
-
- public TestSettingsFixture()
- {
- TestEnvironment environment = LoadTestEnvironment();
-
- RealFileSystemTests = environment.RealFileSystemTests;
- LongRunningTests = environment.LongRunningTests;
- BrittleTests = environment.BrittleTests;
- }
-
- private static TestEnvironment LoadTestEnvironment()
- {
- try
- {
- string path = Path.GetFullPath(
- Path.Combine("..", "..", "..", "..", "test.settings.json"));
- if (File.Exists(path))
- {
- string content = File.ReadAllText(path);
- TestEnvironment? testEnvironment =
- JsonConvert.DeserializeObject(content);
- if (testEnvironment != null)
- {
- return testEnvironment;
- }
- }
- }
- catch (Exception)
- {
- // Ignore all exceptions while reading the test.settings.json file and use the default settings as fallback.
- }
-
- return new TestEnvironment();
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Skip.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/Skip.cs
index 120093b6c..7ebc09128 100644
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/Skip.cs
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/Skip.cs
@@ -1,53 +1,20 @@
using System.Runtime.CompilerServices;
-namespace Testably.Abstractions.TestHelpers
-{
+namespace Testably.Abstractions.TestHelpers;
- public static class Skip
+public static class Skip
+{
+ public static void If(bool condition,
+ [CallerArgumentExpression("condition")]
+ string reason = "")
{
- public static void IfNot(bool condition,
- [CallerArgumentExpression("condition")] string reason = "")
- {
- aweXpect.Skip.Unless(condition, reason);
- }
-
- public static void If(bool condition,
- [CallerArgumentExpression("condition")] string reason = "")
- {
- aweXpect.Skip.When(condition, reason);
- }
+ TUnit.Core.Skip.When(condition, reason);
}
-}
-
-#if !NET6_0_OR_GREATER
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices
-{
- ///
- /// Indicates that a parameter captures the expression passed for another parameter as a string.
- ///
- [AttributeUsage(AttributeTargets.Parameter)]
- [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
- internal sealed class CallerArgumentExpressionAttribute : Attribute
+ public static void IfNot(bool condition,
+ [CallerArgumentExpression("condition")]
+ string reason = "")
{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The name of the parameter whose expression should be captured as a string.
- public CallerArgumentExpressionAttribute(string parameterName)
- {
- ParameterName = parameterName;
- }
-
- ///
- /// Gets the name of the parameter whose expression should be captured as a string.
- ///
- public string ParameterName { get; }
+ TUnit.Core.Skip.Unless(condition, reason);
}
}
-
-#endif
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/Testably.Abstractions.TestHelpers.csproj b/Tests/Helpers/Testably.Abstractions.TestHelpers/Testably.Abstractions.TestHelpers.csproj
index 5b12efed4..31a77762b 100644
--- a/Tests/Helpers/Testably.Abstractions.TestHelpers/Testably.Abstractions.TestHelpers.csproj
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/Testably.Abstractions.TestHelpers.csproj
@@ -7,20 +7,14 @@
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs
new file mode 100644
index 000000000..46a72cbc4
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestBase.cs
@@ -0,0 +1,67 @@
+using System;
+using System.Threading;
+
+namespace Testably.Abstractions.TestHelpers;
+
+[Retry(1)]
+public abstract class TimeSystemTestBase
+{
+ ///
+ /// 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;
+
+ ///
+ /// The UTC time when the time system was created.
+ ///
+ public DateTime BeforeTime { get; set; }
+
+ ///
+ /// A cancellation token that can be used to cancel the test execution when it takes too long.
+ ///
+ public CancellationToken CancellationToken { get; }
+
+ ///
+ /// The time system to test.
+ ///
+ public ITimeSystem TimeSystem { get; }
+
+ protected TimeSystemTestBase(TimeSystemTestData testData)
+ {
+ BeforeTime = testData.Now;
+ TimeSystem = testData.TimeSystem;
+ CancellationToken = TestContext.Current!.Execution.CancellationToken;
+ }
+
+ ///
+ /// 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 void SkipIfBrittleTestsShouldBeSkipped(bool condition = true)
+ {
+ if (TimeSystem is RealTimeSystem)
+ {
+#if DEBUG
+ aweXpect.Skip.When(
+ condition && Settings.BrittleTests == Settings.TestSettingStatus.AlwaysDisabled,
+ $"Brittle tests are {Settings.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+#else
+ aweXpect.Skip.When(condition && Settings.BrittleTests != Settings.TestSettingStatus.AlwaysEnabled,
+ $"Brittle tests are {Settings.BrittleTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.BrittleTests.");
+#endif
+ }
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestData.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestData.cs
new file mode 100644
index 000000000..943c81fc3
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestData.cs
@@ -0,0 +1,20 @@
+using System;
+
+namespace Testably.Abstractions.TestHelpers;
+
+public class TimeSystemTestData(DateTime now, ITimeSystem timeSystem)
+{
+ ///
+ /// The current date and time when creating the time system.
+ ///
+ public DateTime Now { get; } = now;
+
+ ///
+ /// The time system to test.
+ ///
+ public ITimeSystem TimeSystem { get; } = timeSystem;
+
+ ///
+ public override string ToString()
+ => TimeSystem.GetType().Name;
+}
diff --git a/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestsAttribute.cs b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestsAttribute.cs
new file mode 100644
index 000000000..71a45e3b4
--- /dev/null
+++ b/Tests/Helpers/Testably.Abstractions.TestHelpers/TimeSystemTestsAttribute.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Testably.Abstractions.Testing;
+using TimeProvider = Testably.Abstractions.Testing.TimeProvider;
+
+namespace Testably.Abstractions.TestHelpers;
+
+[AttributeUsage(AttributeTargets.Class)]
+public class TimeSystemTestsAttribute : TypedDataSourceAttribute
+{
+ public override async IAsyncEnumerable>> GetTypedDataRowsAsync(
+ DataGeneratorMetadata dataGeneratorMetadata)
+ {
+ await Task.CompletedTask;
+ yield return () =>
+ {
+ DateTime now = DateTime.UtcNow;
+ return Task.FromResult(
+ new TimeSystemTestData(now, new MockTimeSystem(TimeProvider.Use(now))));
+ };
+ yield return () => Task.FromResult(
+ new TimeSystemTestData(DateTime.UtcNow, new RealTimeSystem()));
+ }
+}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs
deleted file mode 100644
index 2a40f6aa0..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModel.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-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
deleted file mode 100644
index b2a1ac56c..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/ClassModelType.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-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
deleted file mode 100644
index 0d645cc42..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Generator.cs
+++ /dev/null
@@ -1,186 +0,0 @@
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
-using Microsoft.CodeAnalysis.Text;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Testably.Abstractions.Tests.SourceGenerator;
-
-///
-/// This generator creates concrete classes in `Testably.Abstractions.Tests` for abstract partial classes, so that the
-/// defined tests run against a real and a mocked system. This works for:
-/// - `IFileSystem`
-/// - `IRandomSystem`
-/// - `ITimeSystem`
-///
-[Generator]
-public sealed class Generator : IIncrementalGenerator
-{
- #region IIncrementalGenerator Members
-
- ///
- 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
-
- context.RegisterSourceOutput(classesToGenerate,
- static (context, source) => Execute(source, context));
- }
-
- #endregion
-
- private static string CreateFileName(ClassModel model)
- {
- string? prefix = model.Namespace + ".";
- string[] exclusions =
- [
- "Testably.Abstractions.Tests.",
- "Testably.Abstractions.",
- ];
- foreach (string? exclusion in exclusions)
- {
- if (prefix.StartsWith(exclusion, StringComparison.Ordinal))
- {
- prefix = prefix.Substring(exclusion.Length);
- }
- }
-
- return $"{prefix}{model.Name}.g.cs";
- }
-
- private static void Execute(ClassModel? model, SourceProductionContext context)
- {
- if (model is not null)
- {
- 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)
- {
- 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;
- }
-
- private static ClassModel? GetSemanticTargetForGeneration(GeneratorSyntaxContext context)
- {
- // 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;
- }
-
- private static bool IsSyntaxTargetForGeneration(SyntaxNode syntaxNode)
- {
- return syntaxNode is ClassDeclarationSyntax { AttributeLists.Count: > 0 };
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Properties/launchSettings.json b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Properties/launchSettings.json
deleted file mode 100644
index f23ad2ca7..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Properties/launchSettings.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "profiles": {
- "Generators": {
- "commandName": "DebugRoslynComponent",
- "targetProject": "../../Testably.Abstractions.Tests/Testably.Abstractions.Tests.csproj"
- }
- }
-}
diff --git a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs
deleted file mode 100644
index 7b3cacd04..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.FileSystem.cs
+++ /dev/null
@@ -1,296 +0,0 @@
-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;
-
- 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)
- {
- aweXpect.Skip.Test($"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)
- {
- aweXpect.Skip.Test($"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)
- => aweXpect.Skip.When(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)
- => aweXpect.Skip.When(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()
- => aweXpect.Skip.When(_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()
- => aweXpect.Skip.When(_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
deleted file mode 100644
index 81715fb6e..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.RandomSystem.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-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;
-
- 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
deleted file mode 100644
index e86efcdb2..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.TimeSystem.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-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;
-
- 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)
- => aweXpect.Skip.When(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)
- => aweXpect.Skip.When(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
deleted file mode 100644
index eb6fc9e9d..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/SourceGenerationHelper.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-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/Testably.Abstractions.Tests.SourceGenerator.csproj b/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj
deleted file mode 100644
index 5bcbb041a..000000000
--- a/Tests/Helpers/Testably.Abstractions.Tests.SourceGenerator/Testably.Abstractions.Tests.SourceGenerator.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- netstandard2.0
- false
- latest
- Library
- true
-
-
-
-
-
-
-
-
-
-
-
-
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Tests/Settings/Directory.Build.props b/Tests/Settings/Directory.Build.props
deleted file mode 100644
index 5d1cdaeed..000000000
--- a/Tests/Settings/Directory.Build.props
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
- net8.0
-
-
-
- latest
- disable
- enable
- false
- 701;1702;CA1845
-
-
-
- annotations
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
diff --git a/Tests/Settings/Testably.Abstractions.TestSettings/BrittleTests.cs b/Tests/Settings/Testably.Abstractions.TestSettings/BrittleTests.cs
deleted file mode 100644
index bdb4def4e..000000000
--- a/Tests/Settings/Testably.Abstractions.TestSettings/BrittleTests.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using NUnit.Framework;
-using Testably.Abstractions.TestHelpers.Settings;
-
-namespace Testably.Abstractions.TestSettings;
-
-public sealed class BrittleTests
-{
- ///
- /// Some tests are brittle on the real file system.
- ///
- /// Always disable these tests!
- ///
- [TestCase]
- [Explicit]
- public void DisableAlways()
- {
- _ = Helper.ChangeTestSettings(s =>
- s.BrittleTests = TestSettingStatus.AlwaysDisabled);
-
- Assert.Pass("Brittle tests are always disabled.");
- }
-
- ///
- /// Some tests are brittle on the real file system.
- ///
- /// Disable these tests in DEBUG mode!
- ///
- [TestCase]
- [Explicit]
- public void DisableInDebugMode()
- {
- TestEnvironment result = Helper.ChangeTestSettings(s =>
- s.BrittleTests = TestSettingStatus.DisabledInDebugMode);
-
- if (result.RealFileSystemTests == TestSettingStatus.AlwaysDisabled)
- {
- Assert.Warn("""
- Brittle tests are disabled in DEBUG mode.
- But the tests against the real file system are always disabled.
- """);
- }
- else
- {
- Assert.Pass("Brittle tests are disabled in DEBUG mode.");
- }
- }
-
- ///
- /// Some tests are brittle on the real file system.
- ///
- /// Always enable these tests!
- ///
- [TestCase]
- [Explicit]
- public void EnableAlways()
- {
- TestEnvironment result = Helper.ChangeTestSettings(s =>
- s.BrittleTests = TestSettingStatus.AlwaysEnabled);
-
- if (result.RealFileSystemTests != TestSettingStatus.AlwaysEnabled)
- {
- Assert.Warn("""
- Brittle tests are always enabled.
- But the tests against the real file system are not always enabled.
- """);
- }
- else
- {
- Assert.Pass("Brittle tests are always enabled.");
- }
- }
-
- [TestCase]
- public void TestDummy_SoThatExplicitTestsAreIgnored()
- {
- Assert.Pass();
- }
-}
diff --git a/Tests/Settings/Testably.Abstractions.TestSettings/Helper.cs b/Tests/Settings/Testably.Abstractions.TestSettings/Helper.cs
deleted file mode 100644
index 086f91030..000000000
--- a/Tests/Settings/Testably.Abstractions.TestSettings/Helper.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.IO;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using Testably.Abstractions.TestHelpers.Settings;
-
-namespace Testably.Abstractions.TestSettings;
-
-internal static class Helper
-{
- private static readonly JsonSerializerOptions ReadJsonSerializerOptions;
- private static readonly JsonSerializerOptions WriteJsonSerializerOptions;
-
- static Helper()
- {
- ReadJsonSerializerOptions = new JsonSerializerOptions();
- ReadJsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
- WriteJsonSerializerOptions = new JsonSerializerOptions
- {
- WriteIndented = true,
- Converters =
- {
- new JsonStringEnumConverter()
- }
- };
- }
-
- public static TestEnvironment ChangeTestSettings(
- Action change)
- {
- TestEnvironment environment = ReadTestSettings();
- change(environment);
- WriteTestSettings(environment);
- return environment;
- }
-
- private static string GetTestSettingsPath() =>
- Path.GetFullPath(Path.Combine("..", "..", "..", "..", "..", "test.settings.json"));
-
- private static TestEnvironment ReadTestSettings()
- {
- try
- {
- string path = GetTestSettingsPath();
- string content = File.ReadAllText(path);
- return JsonSerializer.Deserialize(content, ReadJsonSerializerOptions)
- ?? throw new NotSupportedException("The file has an invalid syntax!");
- }
- catch (Exception)
- {
- return new TestEnvironment();
- }
- }
-
- private static void WriteTestSettings(TestEnvironment environment)
- {
- string content = JsonSerializer.Serialize(environment, WriteJsonSerializerOptions);
- string path = GetTestSettingsPath();
- File.WriteAllText(path, content);
- }
-}
diff --git a/Tests/Settings/Testably.Abstractions.TestSettings/LongRunningTests.cs b/Tests/Settings/Testably.Abstractions.TestSettings/LongRunningTests.cs
deleted file mode 100644
index ce71af71e..000000000
--- a/Tests/Settings/Testably.Abstractions.TestSettings/LongRunningTests.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using NUnit.Framework;
-using Testably.Abstractions.TestHelpers.Settings;
-
-namespace Testably.Abstractions.TestSettings;
-
-public sealed class LongRunningTests
-{
- ///
- /// Some tests take a long time to run against the real file system (e.g. timeout).
- ///
- /// Always disable these tests!
- ///
- [TestCase]
- [Explicit]
- public void DisableAlways()
- {
- _ = Helper.ChangeTestSettings(s =>
- s.LongRunningTests = TestSettingStatus.AlwaysDisabled);
-
- Assert.Pass("Long-running tests are always disabled.");
- }
-
- ///
- /// Some tests take a long time to run against the real file system (e.g. timeout).
- ///
- /// Disable these tests in DEBUG mode!
- ///
- [TestCase]
- [Explicit]
- public void DisableInDebugMode()
- {
- TestEnvironment result = Helper.ChangeTestSettings(s =>
- s.LongRunningTests = TestSettingStatus.DisabledInDebugMode);
-
- if (result.RealFileSystemTests == TestSettingStatus.AlwaysDisabled)
- {
- Assert.Warn("""
- Long-running tests are disabled in DEBUG mode.
- But the tests against the real file system are always disabled.
- """);
- }
- else
- {
- Assert.Pass("Long-running tests are disabled in DEBUG mode.");
- }
- }
-
- ///
- /// Some tests take a long time to run against the real file system (e.g. timeout).
- ///
- /// Always enable these tests!
- ///
- [TestCase]
- [Explicit]
- public void EnableAlways()
- {
- TestEnvironment result = Helper.ChangeTestSettings(s =>
- s.LongRunningTests = TestSettingStatus.AlwaysEnabled);
-
- if (result.RealFileSystemTests != TestSettingStatus.AlwaysEnabled)
- {
- Assert.Warn("""
- Long-running tests are always enabled.
- But the tests against the real file system are not always enabled.
- """);
- }
- else
- {
- Assert.Pass("Long-running tests are always enabled.");
- }
- }
-
- [TestCase]
- public void TestDummy_SoThatExplicitTestsAreIgnored()
- {
- Assert.Pass();
- }
-}
diff --git a/Tests/Settings/Testably.Abstractions.TestSettings/RealFileSystemTests.cs b/Tests/Settings/Testably.Abstractions.TestSettings/RealFileSystemTests.cs
deleted file mode 100644
index 86f049117..000000000
--- a/Tests/Settings/Testably.Abstractions.TestSettings/RealFileSystemTests.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using NUnit.Framework;
-using Testably.Abstractions.TestHelpers.Settings;
-
-namespace Testably.Abstractions.TestSettings;
-
-public sealed class RealFileSystemTests
-{
- ///
- /// All tests against the real file system.
- ///
- /// Always disable these tests!
- ///
- [TestCase]
- [Explicit]
- public void DisableAlways()
- {
- _ = Helper.ChangeTestSettings(s =>
- s.RealFileSystemTests = TestSettingStatus.AlwaysDisabled);
-
- Assert.Pass("Tests against the real file system are always disabled.");
- }
-
- ///
- /// All tests against the real file system.
- ///
- /// Disable these tests in DEBUG mode!
- ///
- [TestCase]
- [Explicit]
- public void DisableInDebugMode()
- {
- _ = Helper.ChangeTestSettings(s =>
- s.RealFileSystemTests = TestSettingStatus.DisabledInDebugMode);
-
- Assert.Pass("Tests against the real file system are disabled in DEBUG mode.");
- }
-
- ///
- /// All tests against the real file system.
- ///
- /// Always enable these tests!
- ///
- [TestCase]
- [Explicit]
- public void EnableAlways()
- {
- _ = Helper.ChangeTestSettings(s =>
- s.RealFileSystemTests = TestSettingStatus.AlwaysEnabled);
-
- Assert.Pass("Tests against the real file system are always enabled.");
- }
-
- [TestCase]
- public void TestDummy_SoThatExplicitTestsAreIgnored()
- {
- Assert.Pass();
- }
-}
diff --git a/Tests/Settings/Testably.Abstractions.TestSettings/Testably.Abstractions.TestSettings.csproj b/Tests/Settings/Testably.Abstractions.TestSettings/Testably.Abstractions.TestSettings.csproj
deleted file mode 100644
index 56ccba3e5..000000000
--- a/Tests/Settings/Testably.Abstractions.TestSettings/Testably.Abstractions.TestSettings.csproj
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
index 356ad83b4..0e839d64e 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/AccessControlHelperTests.cs
@@ -3,9 +3,9 @@
namespace Testably.Abstractions.AccessControl.Tests;
[FileSystemTests]
-public partial class AccessControlHelperTests
+public class AccessControlHelperTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow()
{
IDirectoryInfo sut = FileSystem.DirectoryInfo.New("foo");
@@ -13,7 +13,7 @@ public async Task GetExtensibilityOrThrow_DirectoryInfo_ShouldNotThrow()
await That(() => sut.GetExtensibilityOrThrow()).DoesNotThrow();
}
- [Fact]
+ [Test]
public async Task GetExtensibilityOrThrow_FileInfo_ShouldNotThrow()
{
IFileInfo sut = FileSystem.FileInfo.New("foo");
@@ -21,7 +21,7 @@ public async Task GetExtensibilityOrThrow_FileInfo_ShouldNotThrow()
await That(() => sut.GetExtensibilityOrThrow()).DoesNotThrow();
}
- [Fact]
+ [Test]
public async Task GetExtensibilityOrThrow_FileSystemStream_ShouldNotThrow()
{
FileSystemStream sut = FileSystem.FileStream.New("foo", FileMode.Create);
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
index b026efcd5..757e76428 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryAclExtensionsTests.cs
@@ -1,17 +1,16 @@
+using System.Runtime.InteropServices;
using System.Security.AccessControl;
using Testably.Abstractions.AccessControl.Tests.TestHelpers;
using Skip = Testably.Abstractions.TestHelpers.Skip;
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class DirectoryAclExtensionsTests
+[WindowsOnlyFileSystemTests]
+public class DirectoryAclExtensionsTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task CreateDirectory_NullDirectorySecurity_ShouldThrowArgumentNullException()
{
- Skip.IfNot(Test.RunsOnWindows);
-
#pragma warning disable CA1416
void Act() =>
FileSystem.Directory.CreateDirectory("foo", null!);
@@ -21,13 +20,11 @@ await That(Act).Throws()
.WithParamName("directorySecurity");
}
- [Theory]
- [InlineData("bar")]
- [InlineData("bar\\foo")]
+ [Test]
+ [Arguments("bar")]
+ [Arguments("bar\\foo")]
public async Task CreateDirectory_ShouldChangeAccessControl(string path)
{
- Skip.IfNot(Test.RunsOnWindows);
-
#pragma warning disable CA1416
DirectorySecurity directorySecurity = FileSystem.CreateDirectorySecurity();
@@ -39,11 +36,9 @@ public async Task CreateDirectory_ShouldChangeAccessControl(string path)
await That(FileSystem.Directory.Exists(path)).IsTrue();
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.Directory.CreateDirectory("foo");
#pragma warning disable CA1416
@@ -54,10 +49,9 @@ public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.Directory.CreateDirectory("foo");
@@ -75,10 +69,9 @@ public async Task GetAccessControl_ShouldReturnSetResult()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.Directory.CreateDirectory("foo");
@@ -91,10 +84,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitialized
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.Directory.CreateDirectory("foo");
@@ -112,11 +104,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldChangeAccessControl()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.Directory.CreateDirectory("foo");
#pragma warning disable CA1416
DirectorySecurity originalAccessControl = FileSystem.CreateDirectorySecurity();
@@ -131,14 +121,13 @@ await That(currentAccessControl.HasSameAccessRightsAs(originalAccessControl))
.IsTrue();
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldNotUpdateTimes()
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.File.WriteAllText("foo.txt", "abc");
- await TimeSystem.Task.Delay(3000, TestContext.Current.CancellationToken);
+ await TimeSystem.Task.Delay(3000, CancellationToken);
DateTime previousCreationTimeUtc = FileSystem.File.GetCreationTimeUtc("foo.txt");
DateTime previousLastAccessTimeUtc = FileSystem.File.GetLastAccessTimeUtc("foo.txt");
DateTime previousLastWriteTimeUtc = FileSystem.File.GetLastWriteTimeUtc("foo.txt");
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
index 4e3b31ad2..516983f81 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/DirectoryInfoAclExtensionsTests.cs
@@ -1,19 +1,16 @@
-using AutoFixture.Xunit3;
-using System.IO;
+using System.IO;
using System.Security.AccessControl;
using Testably.Abstractions.AccessControl.Tests.TestHelpers;
using Skip = Testably.Abstractions.TestHelpers.Skip;
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class DirectoryInfoAclExtensionsTests
+[WindowsOnlyFileSystemTests]
+public class DirectoryInfoAclExtensionsTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task Create_NullDirectorySecurity_ShouldThrowArgumentNullException()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.Directory.CreateDirectory("foo");
#pragma warning disable CA1416
@@ -24,13 +21,11 @@ await That(Act).Throws()
.WithParamName("directorySecurity");
}
- [Theory]
- [InlineData("foo")]
- [InlineData("foo\\bar")]
+ [Test]
+ [Arguments("foo")]
+ [Arguments("foo\\bar")]
public async Task Create_ShouldChangeAccessControl(string path)
{
- Skip.IfNot(Test.RunsOnWindows);
-
#pragma warning disable CA1416
DirectorySecurity directorySecurity = FileSystem.CreateDirectorySecurity();
@@ -42,10 +37,9 @@ public async Task Create_ShouldChangeAccessControl(string path)
await That(FileSystem.Directory.Exists(path)).IsTrue();
}
- [Fact]
+ [Test]
public async Task GetAccessControl_MissingDirectory_ShouldThrowDirectoryNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
IDirectoryInfo sut = FileSystem.DirectoryInfo.New("foo");
#pragma warning disable CA1416
@@ -56,11 +50,9 @@ await That(Act).Throws()
.WithHResult(-2147024893);
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.Directory.CreateDirectory("foo");
#pragma warning disable CA1416
@@ -71,10 +63,9 @@ public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.Directory.CreateDirectory("foo");
@@ -92,11 +83,10 @@ public async Task GetAccessControl_ShouldReturnSetResult()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task
GetAccessControl_WithAccessControlSections_MissingDirectory_ShouldThrowDirectoryNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
IDirectoryInfo sut = FileSystem.DirectoryInfo.New("foo");
#pragma warning disable CA1416
@@ -107,11 +97,10 @@ await That(Act).Throws()
.WithHResult(-2147024893);
}
- [Fact]
+ [Test]
public async Task
GetAccessControl_WithAccessControlSections_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.Directory.CreateDirectory("foo");
@@ -124,10 +113,9 @@ public async Task
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.Directory.CreateDirectory("foo");
@@ -145,11 +133,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldChangeAccessControl()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.Directory.CreateDirectory("foo");
#pragma warning disable CA1416
DirectorySecurity originalAccessControl = FileSystem.CreateDirectorySecurity();
@@ -164,15 +150,14 @@ await That(currentAccessControl.HasSameAccessRightsAs(originalAccessControl))
.IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetAccessControl_ShouldNotUpdateTimes(string path)
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.Directory.CreateDirectory(path);
- await TimeSystem.Task.Delay(3000, TestContext.Current.CancellationToken);
+ await TimeSystem.Task.Delay(3000, CancellationToken);
DateTime previousCreationTimeUtc = FileSystem.File.GetCreationTimeUtc(path);
DateTime previousLastAccessTimeUtc = FileSystem.File.GetLastAccessTimeUtc(path);
DateTime previousLastWriteTimeUtc = FileSystem.File.GetLastWriteTimeUtc(path);
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
index 7e76c61dc..802f5978e 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionMissingFileTests.cs
@@ -6,17 +6,14 @@
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class ExceptionMissingFileTests
+[WindowsOnlyFileSystemTests]
+public class ExceptionMissingFileTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)(BaseTypes.Directory | BaseTypes.DirectoryInfo))]
+ [Test]
+ [MethodDataSource(nameof(GetDirectoryCallbacks))]
public async Task DirectoryOperations_WhenDirectoryIsMissing_ShouldThrowDirectoryNotFoundException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows);
-
string path = FileSystem.Path.Combine("missing-directory", "file.txt");
Exception? exception = Record.Exception(() =>
@@ -44,14 +41,11 @@ await That(exception).IsNull()
}
}
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)(BaseTypes.Directory | BaseTypes.DirectoryInfo))]
+ [Test]
+ [MethodDataSource(nameof(GetDirectoryCallbacks))]
public async Task DirectoryOperations_WhenFileIsMissing_ShouldThrowFileNotFoundException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows);
-
string path = "missing-file.txt";
Exception? exception = Record.Exception(() =>
@@ -79,14 +73,11 @@ await That(exception).IsNull()
}
}
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)(BaseTypes.File | BaseTypes.FileInfo | BaseTypes.FileStream))]
+ [Test]
+ [MethodDataSource(nameof(GetFileCallbacks))]
public async Task FileOperations_WhenDirectoryIsMissing_ShouldThrowDirectoryNotFoundException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows);
-
string path = FileSystem.Path.Combine("missing-directory", "file.txt");
Exception? exception = Record.Exception(() =>
@@ -115,14 +106,11 @@ await That(exception).IsNull()
}
}
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)(BaseTypes.File | BaseTypes.FileInfo | BaseTypes.FileStream))]
+ [Test]
+ [MethodDataSource(nameof(GetFileCallbacks))]
public async Task FileOperations_WhenFileIsMissing_ShouldThrowFileNotFoundException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows);
-
string path = "missing-file.txt";
Exception? exception = Record.Exception(() =>
@@ -152,21 +140,21 @@ await That(exception).IsNull()
#region Helpers
- #pragma warning disable MA0018 // Do not declare static members on generic types
- public static TheoryData, BaseTypes, MethodType> GetFileCallbacks(
+ public static IEnumerable<(Action, BaseTypes, MethodType)>
+ GetFileCallbacks()
+ => GetCallbacks((int)(BaseTypes.File | BaseTypes.FileInfo | BaseTypes.FileStream));
+ public static IEnumerable<(Action, BaseTypes, MethodType)> GetDirectoryCallbacks()
+ => GetCallbacks((int)(BaseTypes.Directory | BaseTypes.DirectoryInfo));
+ private static IEnumerable<(Action, BaseTypes, MethodType)> GetCallbacks(
int baseType)
{
- TheoryData, BaseTypes, MethodType> theoryData = new();
foreach ((BaseTypes BaseType, MethodType MethodType, Action Callback)
item in GetFileCallbackTestParameters()
.Where(item => (item.BaseType & (BaseTypes)baseType) > 0))
{
- theoryData.Add(item.Callback, item.BaseType, item.MethodType);
+ yield return (item.Callback, item.BaseType, item.MethodType);
}
-
- return theoryData;
}
- #pragma warning restore MA0018 // Do not declare static members on generic types
private static
IEnumerable<(
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
index 76919efba..c6f4e5e58 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/ExceptionTests.cs
@@ -1,42 +1,71 @@
using System.Collections.Generic;
-using System.Linq;
using System.Security.AccessControl;
+using Testably.Abstractions.AccessControl.Tests.TestHelpers;
using Skip = Testably.Abstractions.TestHelpers.Skip;
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class ExceptionTests
+[WindowsOnlyFileSystemTests]
+public class ExceptionTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)BaseTypes.All)]
+ #pragma warning disable MA0062
+ [Flags]
+ public enum BaseTypes
+ {
+ Directory = 1,
+ DirectoryInfo = 2,
+ File = 4,
+ FileInfo = 8,
+ FileStream = 16,
+ None = 0,
+ All = ~None,
+ }
+ #pragma warning restore MA0062
+
+ public enum MethodType
+ {
+ Create,
+ GetAccessControl,
+ SetAccessControl,
+ }
+
+ #pragma warning disable MA0018 // Do not declare static members on generic types
+ public static IEnumerable<(Action, BaseTypes, MethodType)>
+ GetFileCallbacks()
+ {
+ foreach ((BaseTypes BaseType, MethodType MethodType, Action Callback)
+ item in GetFileCallbackTestParameters())
+ {
+ yield return (item.Callback, item.BaseType, item.MethodType);
+ }
+ }
+ #pragma warning restore MA0018 // Do not declare static members on generic types
+ [Test]
+ [MethodDataSource(nameof(GetFileCallbacks))]
public async Task Operations_WhenPathIsEmpty_ShouldThrowArgumentException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows || exceptionType == MethodType.GetAccessControl);
+ Skip.IfNot(exceptionType == MethodType.GetAccessControl);
await That(() => callback.Invoke(FileSystem, ""))
.Throws().WithHResult(-2147024809)
.Because($"\n{exceptionType} on {baseType}\n was called with an empty path");
}
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)BaseTypes.All)]
+ [Test]
+ [MethodDataSource(nameof(GetFileCallbacks))]
public async Task Operations_WhenPathIsNull_ShouldThrowArgumentNullException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
- Skip.IfNot(Test.RunsOnWindows || exceptionType == MethodType.GetAccessControl);
+ Skip.IfNot(exceptionType == MethodType.GetAccessControl);
await That(() => callback.Invoke(FileSystem, null!))
.Throws()
.Because($"\n{exceptionType} on {baseType}\n was called with a null path");
}
- [Theory]
- [MemberData(nameof(GetFileCallbacks),
- (int)BaseTypes.All)]
+ [Test]
+ [MethodDataSource(nameof(GetFileCallbacks))]
public async Task Operations_WhenPathIsWhiteSpace_ShouldThrowArgumentException(
Action callback, BaseTypes baseType, MethodType exceptionType)
{
@@ -47,24 +76,6 @@ await That(() => callback.Invoke(FileSystem, " "))
.Because($"\n{exceptionType} on {baseType}\n was called with a whitespace path");
}
- #region Helpers
-
- #pragma warning disable MA0018 // Do not declare static members on generic types
- public static TheoryData, BaseTypes, MethodType> GetFileCallbacks(
- int baseType)
- {
- TheoryData, BaseTypes, MethodType> theoryData = new();
- foreach ((BaseTypes BaseType, MethodType MethodType, Action Callback)
- item in GetFileCallbackTestParameters()
- .Where(item => (item.BaseType & (BaseTypes)baseType) > 0))
- {
- theoryData.Add(item.Callback, item.BaseType, item.MethodType);
- }
-
- return theoryData;
- }
- #pragma warning restore MA0018 // Do not declare static members on generic types
-
private static
IEnumerable<(
BaseTypes BaseType,
@@ -128,27 +139,4 @@ Action Callback
=> fileSystem.FileInfo.New(path).SetAccessControl(new FileSecurity()));
#pragma warning restore CA1416
}
-
- #endregion
-
- #pragma warning disable MA0062
- [Flags]
- public enum BaseTypes
- {
- Directory = 1,
- DirectoryInfo = 2,
- File = 4,
- FileInfo = 8,
- FileStream = 16,
- None = 0,
- All = ~None,
- }
- #pragma warning restore MA0062
-
- public enum MethodType
- {
- Create,
- GetAccessControl,
- SetAccessControl,
- }
}
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
index 9678e411e..c66bf3b52 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileAclExtensionsTests.cs
@@ -5,14 +5,12 @@
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class FileAclExtensionsTests
+[WindowsOnlyFileSystemTests]
+public class FileAclExtensionsTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task GetAccessControl_MissingFile_ShouldThrowFileNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
-
void Act()
{
#pragma warning disable CA1416
@@ -24,11 +22,9 @@ await That(Act).Throws()
.WithHResult(-2147024894);
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.File.WriteAllText("foo", null);
#pragma warning disable CA1416
@@ -38,10 +34,9 @@ public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.File.WriteAllText("foo", null);
@@ -58,12 +53,10 @@ public async Task GetAccessControl_ShouldReturnSetResult()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task
GetAccessControl_WithAccessControlSections_MissingFile_ShouldThrowFileNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
-
void Act()
{
#pragma warning disable CA1416
@@ -75,10 +68,9 @@ await That(Act).Throws()
.WithHResult(-2147024894);
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.File.WriteAllText("foo", null);
@@ -90,10 +82,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitialized
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.File.WriteAllText("foo", null);
@@ -111,11 +102,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldChangeAccessControl()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.File.WriteAllText("foo", null);
#pragma warning disable CA1416
FileSecurity originalAccessControl = FileSystem.CreateFileSecurity();
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
index 1ec17f01d..7c496db1c 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileInfoAclExtensionsTests.cs
@@ -5,13 +5,12 @@
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class FileInfoAclExtensionsTests
+[WindowsOnlyFileSystemTests]
+public class FileInfoAclExtensionsTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task GetAccessControl_MissingFile_ShouldThrowFileNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
IFileInfo sut = FileSystem.FileInfo.New("foo");
void Act()
@@ -25,11 +24,9 @@ await That(Act).Throws()
.WithHResult(-2147024894);
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.File.WriteAllText("foo", null);
IFileInfo fileInfo = FileSystem.FileInfo.New("foo");
@@ -40,10 +37,9 @@ public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.File.WriteAllText("foo", null);
@@ -61,11 +57,10 @@ public async Task GetAccessControl_ShouldReturnSetResult()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task
GetAccessControl_WithAccessControlSections_MissingFile_ShouldThrowFileNotFoundException()
{
- Skip.IfNot(Test.RunsOnWindows);
IFileInfo sut = FileSystem.FileInfo.New("foo");
void Act()
@@ -79,10 +74,9 @@ await That(Act).Throws()
.WithHResult(-2147024894);
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
SkipIfLongRunningTestsShouldBeSkipped();
FileSystem.File.WriteAllText("foo", null);
@@ -95,10 +89,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldBeInitialized
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResult()
{
- Skip.IfNot(Test.RunsOnWindows);
Skip.If(FileSystem is RealFileSystem);
FileSystem.File.WriteAllText("foo", null);
@@ -116,11 +109,9 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldChangeAccessControl()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystem.File.WriteAllText("foo", null);
#pragma warning disable CA1416
FileSecurity originalAccessControl = FileSystem.CreateFileSecurity();
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
index ab3f931f7..7f629a939 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/FileStreamAclExtensionsTests.cs
@@ -4,14 +4,12 @@
namespace Testably.Abstractions.AccessControl.Tests;
-[FileSystemTests]
-public partial class FileStreamAclExtensionsTests
+[WindowsOnlyFileSystemTests]
+public class FileStreamAclExtensionsTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystemStream fileStream = FileSystem.File.Create("foo");
#pragma warning disable CA1416
@@ -21,11 +19,9 @@ public async Task GetAccessControl_ShouldBeInitializedWithNotNullValue()
#pragma warning restore CA1416
}
- [Fact]
+ [Test]
public async Task SetAccessControl_ShouldChangeAccessControl()
{
- Skip.IfNot(Test.RunsOnWindows);
-
FileSystemStream fileStream = FileSystem.File.Create("foo");
#pragma warning disable CA1416
FileSecurity originalAccessControl = FileSystem.CreateFileSecurity();
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/Internal/AccessControlHelperTests.cs b/Tests/Testably.Abstractions.AccessControl.Tests/Internal/AccessControlHelperTests.cs
index 2da50d046..e11221cce 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/Internal/AccessControlHelperTests.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/Internal/AccessControlHelperTests.cs
@@ -1,15 +1,15 @@
-using System.IO;
+using Mockolate;
+using System.IO;
using Testably.Abstractions.Helpers;
namespace Testably.Abstractions.AccessControl.Tests.Internal;
public sealed class AccessControlHelperTests
{
- [Theory]
- [AutoDomainData]
- public async Task GetExtensibilityOrThrow_CustomDirectoryInfo_ShouldThrowNotSupportedException(
- IDirectoryInfo sut)
+ [Test]
+ public async Task GetExtensibilityOrThrow_CustomDirectoryInfo_ShouldThrowNotSupportedException()
{
+ var sut = Mock.Create();
void Act()
{
sut.GetExtensibilityOrThrow();
@@ -19,11 +19,10 @@ await That(Act).Throws()
.WithMessage($"*{sut.GetType().Name}*{nameof(IFileSystemExtensibility)}*").AsWildcard();
}
- [Theory]
- [AutoDomainData]
- public async Task GetExtensibilityOrThrow_CustomFileInfo_ShouldThrowNotSupportedException(
- IFileInfo sut)
+ [Test]
+ public async Task GetExtensibilityOrThrow_CustomFileInfo_ShouldThrowNotSupportedException()
{
+ var sut = Mock.Create();
void Act()
{
sut.GetExtensibilityOrThrow();
@@ -33,7 +32,7 @@ await That(Act).Throws()
.WithMessage($"*{sut.GetType().Name}*{nameof(IFileSystemExtensibility)}*").AsWildcard();
}
- [Fact]
+ [Test]
public async Task
GetExtensibilityOrThrow_CustomFileSystemStream_ShouldThrowNotSupportedException()
{
@@ -48,7 +47,7 @@ await That(Act).Throws()
.WithMessage($"*{sut.GetType().Name}*{nameof(IFileSystemExtensibility)}*").AsWildcard();
}
- [Fact]
+ [Test]
public async Task ThrowIfMissing_ExistingDirectoryInfo_ShouldNotThrow()
{
MockFileSystem fileSystem = new();
@@ -63,7 +62,7 @@ void Act()
await That(Act).DoesNotThrow();
}
- [Fact]
+ [Test]
public async Task ThrowIfMissing_ExistingFileInfo_ShouldNotThrow()
{
MockFileSystem fileSystem = new();
@@ -78,7 +77,7 @@ void Act()
await That(Act).DoesNotThrow();
}
- [Fact]
+ [Test]
public async Task ThrowIfMissing_MissingDirectoryInfo_ShouldThrowDirectoryNotFoundException()
{
MockFileSystem fileSystem = new();
@@ -94,7 +93,7 @@ await That(Act).Throws()
.WithHResult(-2147024893);
}
- [Fact]
+ [Test]
public async Task ThrowIfMissing_MissingFileInfo_ShouldThrowFileNotFoundException()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/Usings.cs b/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/Usings.cs
index 09bda3676..d4496bf17 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/Usings.cs
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/Usings.cs
@@ -4,6 +4,6 @@
global using Testably.Abstractions.TestHelpers;
// ReSharper disable once RedundantUsingDirective.Global
global using Testably.Abstractions.Testing;
-global using Xunit;
+global using TUnit;
global using aweXpect;
global using static aweXpect.Expect;
diff --git a/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/WindowsOnlyFileSystemTestsAttribute.cs b/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/WindowsOnlyFileSystemTestsAttribute.cs
new file mode 100644
index 000000000..25964f882
--- /dev/null
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/TestHelpers/WindowsOnlyFileSystemTestsAttribute.cs
@@ -0,0 +1,23 @@
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+namespace Testably.Abstractions.AccessControl.Tests.TestHelpers;
+
+[AttributeUsage(AttributeTargets.Class)]
+public class WindowsOnlyFileSystemTestsAttribute : FileSystemTestsAttribute
+{
+ public override async IAsyncEnumerable>> GetTypedDataRowsAsync(
+ DataGeneratorMetadata dataGeneratorMetadata)
+ {
+ if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ yield break;
+ }
+
+ await foreach (Func> baseDataRow in base.GetTypedDataRowsAsync(
+ dataGeneratorMetadata))
+ {
+ yield return baseDataRow;
+ }
+ }
+}
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 ab4215125..628ab49a0 100644
--- a/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj
+++ b/Tests/Testably.Abstractions.AccessControl.Tests/Testably.Abstractions.AccessControl.Tests.csproj
@@ -8,18 +8,6 @@
-
-
-
-
- true
- Generated
- $(GeneratedFolder)\$(TargetFramework)
-
-
-
-
-
diff --git a/Tests/Testably.Abstractions.Compression.Tests/Internal/ExecuteTests.cs b/Tests/Testably.Abstractions.Compression.Tests/Internal/ExecuteTests.cs
index a823dd0b0..34afd235a 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/Internal/ExecuteTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/Internal/ExecuteTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Compression.Tests.Internal;
public sealed class ExecuteTests
{
- [Fact]
+ [Test]
public async Task
WhenRealFileSystem_MockFileSystem_WithActionCallback_ShouldExecuteOnMockFileSystem()
{
@@ -25,7 +25,7 @@ public async Task
await That(onMockFileSystemExecuted).IsTrue();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystem_MockFileSystem_WithFuncCallback_ShouldExecuteOnMockFileSystem()
{
@@ -46,7 +46,7 @@ public async Task
await That(onMockFileSystemExecuted).IsTrue();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystem_RealFileSystem_WithActionCallback_ShouldExecuteOnRealFileSystem()
{
@@ -67,7 +67,7 @@ public async Task
await That(onMockFileSystemExecuted).IsFalse();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystem_RealFileSystem_WithFuncCallback_ShouldExecuteOnRealFileSystem()
{
@@ -88,7 +88,7 @@ public async Task
await That(onMockFileSystemExecuted).IsFalse();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystemAsync_MockFileSystem_WithActionCallback_ShouldExecuteOnMockFileSystem()
{
@@ -110,7 +110,7 @@ await Execute.WhenRealFileSystemAsync(fileSystem,
await That(onMockFileSystemExecuted).IsTrue();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystemAsync_MockFileSystem_WithFuncCallback_ShouldExecuteOnMockFileSystem()
{
@@ -132,7 +132,7 @@ await Execute.WhenRealFileSystemAsync(fileSystem,
await That(onMockFileSystemExecuted).IsTrue();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystemAsync_RealFileSystem_WithActionCallback_ShouldExecuteOnRealFileSystem()
{
@@ -154,7 +154,7 @@ await Execute.WhenRealFileSystemAsync(fileSystem,
await That(onMockFileSystemExecuted).IsFalse();
}
- [Fact]
+ [Test]
public async Task
WhenRealFileSystemAsync_RealFileSystem_WithFuncCallback_ShouldExecuteOnRealFileSystem()
{
diff --git a/Tests/Testably.Abstractions.Compression.Tests/Internal/ZipUtilitiesTests.cs b/Tests/Testably.Abstractions.Compression.Tests/Internal/ZipUtilitiesTests.cs
index d122dbc98..fb6afac90 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/Internal/ZipUtilitiesTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/Internal/ZipUtilitiesTests.cs
@@ -6,8 +6,8 @@ namespace Testably.Abstractions.Compression.Tests.Internal;
public sealed class ZipUtilitiesTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments(new byte[]{0x1, 0x2, 0x3})]
public async Task ExtractRelativeToDirectory_FileWithTrailingSlash_ShouldThrowIOException(
byte[] bytes)
{
@@ -25,7 +25,7 @@ await That(Act).Throws()
.AsWildcard();
}
- [Fact]
+ [Test]
public async Task ExtractRelativeToDirectory_WithSubdirectory_ShouldCreateSubdirectory()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Compression.Tests/TestHelpers/Usings.cs b/Tests/Testably.Abstractions.Compression.Tests/TestHelpers/Usings.cs
index 4de07faf6..53e1d42f0 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/TestHelpers/Usings.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/TestHelpers/Usings.cs
@@ -1,10 +1,9 @@
-global using AutoFixture.Xunit3;
-global using System;
+global using System;
global using System.Threading.Tasks;
global using System.IO.Abstractions;
global using Testably.Abstractions.TestHelpers;
global using Testably.Abstractions.Testing;
-global using Xunit;
+global using TUnit;
global using aweXpect;
global using aweXpect.Testably;
global using static aweXpect.Expect;
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 f3c48c7f9..1e3249a8e 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj
+++ b/Tests/Testably.Abstractions.Compression.Tests/Testably.Abstractions.Compression.Tests.csproj
@@ -7,23 +7,11 @@
-
-
-
-
-
- true
- Generated
- $(GeneratedFolder)\$(TargetFramework)
-
-
-
-
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.Async.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.Async.cs
index 35b79f2c1..386da80ce 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.Async.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.Async.cs
@@ -8,10 +8,10 @@ namespace Testably.Abstractions.Compression.Tests.ZipArchive;
public partial class ExtensionTests
{
- [Theory]
- [InlineData("2000-01-01T12:14:15")]
- [InlineData("1980-01-01T00:00:00")]
- [InlineData("2107-12-31T23:59:59")]
+ [Test]
+ [Arguments("2000-01-01T12:14:15")]
+ [Arguments("1980-01-01T00:00:00")]
+ [Arguments("2107-12-31T23:59:59")]
public async Task CreateEntryFromFileAsync_LastWriteTime_ShouldBeCopiedFromFile(
string lastWriteTimeString)
{
@@ -30,17 +30,17 @@ public async Task CreateEntryFromFileAsync_LastWriteTime_ShouldBeCopiedFromFile(
await That(archive.Entries).IsEmpty();
await archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt",
- CompressionLevel.NoCompression, TestContext.Current.CancellationToken);
+ CompressionLevel.NoCompression, CancellationToken);
IZipArchiveEntry entry = archive.Entries.Single();
await That(entry.LastWriteTime.DateTime).IsEqualTo(lastWriteTime);
}
- [Theory]
- [InlineData("1930-06-21T14:15:16")]
- [InlineData("1979-12-31T00:00:00")]
- [InlineData("2108-01-01T00:00:00")]
- [InlineData("2208-01-01T00:00:00")]
+ [Test]
+ [Arguments("1930-06-21T14:15:16")]
+ [Arguments("1979-12-31T00:00:00")]
+ [Arguments("2108-01-01T00:00:00")]
+ [Arguments("2208-01-01T00:00:00")]
public async Task CreateEntryFromFileAsync_LastWriteTimeOutOfRange_ShouldBeFirstJanuary1980(
string lastWriteTimeString)
{
@@ -61,13 +61,13 @@ public async Task CreateEntryFromFileAsync_LastWriteTimeOutOfRange_ShouldBeFirst
await That(archive.Entries).IsEmpty();
await archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt",
- CompressionLevel.NoCompression, TestContext.Current.CancellationToken);
+ CompressionLevel.NoCompression, CancellationToken);
IZipArchiveEntry entry = archive.Entries.Single();
await That(entry.LastWriteTime.DateTime).IsEqualTo(expectedTime);
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFileAsync_NullEntryName_ShouldThrowArgumentNullException()
{
FileSystem.Initialize()
@@ -83,13 +83,13 @@ public async Task CreateEntryFromFileAsync_NullEntryName_ShouldThrowArgumentNull
await That(archive.Entries).IsEmpty();
Task Act()
- => archive.CreateEntryFromFileAsync("bar/foo.txt", null!, TestContext.Current.CancellationToken);
+ => archive.CreateEntryFromFileAsync("bar/foo.txt", null!, CancellationToken);
await That(Act).Throws()
.WithParamName("entryName");
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFileAsync_NullSourceFileName_ShouldThrowArgumentNullException()
{
FileSystem.Initialize()
@@ -106,13 +106,13 @@ public async Task CreateEntryFromFileAsync_NullSourceFileName_ShouldThrowArgumen
Task Act()
=> archive.CreateEntryFromFileAsync(null!, "foo/bar.txt",
- CompressionLevel.NoCompression, TestContext.Current.CancellationToken);
+ CompressionLevel.NoCompression, CancellationToken);
await That(Act).Throws()
.WithParamName("sourceFileName");
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFileAsync_ReadOnlyArchive_ShouldThrowNotSupportedException()
{
FileSystem.Initialize()
@@ -128,12 +128,12 @@ public async Task CreateEntryFromFileAsync_ReadOnlyArchive_ShouldThrowNotSupport
await That(archive.Entries).IsEmpty();
Task Act()
- => archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt", TestContext.Current.CancellationToken);
+ => archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt", CancellationToken);
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFileAsync_ShouldCreateEntryWithFileContent()
{
FileSystem.Initialize()
@@ -149,7 +149,7 @@ public async Task CreateEntryFromFileAsync_ShouldCreateEntryWithFileContent()
await That(archive.Entries).IsEmpty();
await archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt",
- CompressionLevel.NoCompression, TestContext.Current.CancellationToken);
+ CompressionLevel.NoCompression, CancellationToken);
IZipArchiveEntry entry = archive.Entries.Single();
await That(entry.FullName).IsEqualTo("foo/bar.txt");
@@ -158,8 +158,8 @@ await archive.CreateEntryFromFileAsync("bar/foo.txt", "foo/bar.txt",
await That(FileSystem).HasFile("test.txt").WithContent("FooFooFoo");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_DestinationNull_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
{
@@ -174,15 +174,15 @@ async Task Act()
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
- await archive.ExtractToDirectoryAsync(null!, TestContext.Current.CancellationToken);
+ await archive.ExtractToDirectoryAsync(null!, CancellationToken);
}
await That(Act).Throws()
.WithParamName("destinationDirectoryName");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToDirectoryAsync_DestinationNull_WithOverwrite_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
@@ -198,13 +198,13 @@ async Task Act()
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
- await archive.ExtractToDirectoryAsync(null!, true, TestContext.Current.CancellationToken);
+ await archive.ExtractToDirectoryAsync(null!, true, CancellationToken);
}
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task ExtractToDirectoryAsync_ShouldExtractFilesAndDirectories()
{
FileSystem.Initialize()
@@ -218,14 +218,14 @@ public async Task ExtractToDirectoryAsync_ShouldExtractFilesAndDirectories()
using FileSystemStream stream = FileSystem.File.OpenRead("destination.zip");
IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
- await archive.ExtractToDirectoryAsync("bar", TestContext.Current.CancellationToken);
+ await archive.ExtractToDirectoryAsync("bar", CancellationToken);
await That(FileSystem).HasFile("bar/foo.txt").WithContent("FooFooFoo");
await That(FileSystem).HasDirectory("bar/bar");
await That(FileSystem).HasFile("bar/bar.txt");
}
- [Fact]
+ [Test]
public async Task ExtractToDirectoryAsync_WithoutOverwrite_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -241,7 +241,7 @@ public async Task ExtractToDirectoryAsync_WithoutOverwrite_ShouldThrowIOExceptio
async Task Act()
{
- await archive.ExtractToDirectoryAsync("bar", TestContext.Current.CancellationToken);
+ await archive.ExtractToDirectoryAsync("bar", CancellationToken);
}
await That(Act).Throws()
@@ -250,7 +250,7 @@ await That(FileSystem).HasFile("bar/foo.txt")
.WhoseContent(c => c.IsNotEqualTo("FooFooFoo"));
}
- [Fact]
+ [Test]
public async Task ExtractToDirectoryAsync_WithOverwrite_ShouldOverwriteExistingFile()
{
FileSystem.Initialize()
@@ -264,7 +264,7 @@ public async Task ExtractToDirectoryAsync_WithOverwrite_ShouldOverwriteExistingF
using FileSystemStream stream = FileSystem.File.OpenRead("destination.zip");
IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
- await archive.ExtractToDirectoryAsync("bar", true, TestContext.Current.CancellationToken);
+ await archive.ExtractToDirectoryAsync("bar", true, CancellationToken);
await That(FileSystem).HasFile("bar/foo.txt")
.WithContent("FooFooFoo");
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
index bf4d8dc18..40f2d70c0 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/ExtensionTests.cs
@@ -6,12 +6,12 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchive;
[FileSystemTests]
-public partial class ExtensionTests
+public partial class ExtensionTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [InlineData("2000-01-01T12:14:15")]
- [InlineData("1980-01-01T00:00:00")]
- [InlineData("2107-12-31T23:59:59")]
+ [Test]
+ [Arguments("2000-01-01T12:14:15")]
+ [Arguments("1980-01-01T00:00:00")]
+ [Arguments("2107-12-31T23:59:59")]
public async Task CreateEntryFromFile_LastWriteTime_ShouldBeCopiedFromFile(
string lastWriteTimeString)
{
@@ -36,11 +36,11 @@ public async Task CreateEntryFromFile_LastWriteTime_ShouldBeCopiedFromFile(
await That(entry.LastWriteTime.DateTime).IsEqualTo(lastWriteTime);
}
- [Theory]
- [InlineData("1930-06-21T14:15:16")]
- [InlineData("1979-12-31T00:00:00")]
- [InlineData("2108-01-01T00:00:00")]
- [InlineData("2208-01-01T00:00:00")]
+ [Test]
+ [Arguments("1930-06-21T14:15:16")]
+ [Arguments("1979-12-31T00:00:00")]
+ [Arguments("2108-01-01T00:00:00")]
+ [Arguments("2208-01-01T00:00:00")]
public async Task CreateEntryFromFile_LastWriteTimeOutOfRange_ShouldBeFirstJanuary1980(
string lastWriteTimeString)
{
@@ -67,7 +67,7 @@ public async Task CreateEntryFromFile_LastWriteTimeOutOfRange_ShouldBeFirstJanua
await That(entry.LastWriteTime.DateTime).IsEqualTo(expectedTime);
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFile_NullEntryName_ShouldThrowArgumentNullException()
{
FileSystem.Initialize()
@@ -89,7 +89,7 @@ await That(Act).Throws()
.WithParamName("entryName");
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFile_NullSourceFileName_ShouldThrowArgumentNullException()
{
FileSystem.Initialize()
@@ -112,7 +112,7 @@ await That(Act).Throws()
.WithParamName("sourceFileName");
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFile_ReadOnlyArchive_ShouldThrowNotSupportedException()
{
FileSystem.Initialize()
@@ -133,7 +133,7 @@ void Act()
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task CreateEntryFromFile_ShouldCreateEntryWithFileContent()
{
FileSystem.Initialize()
@@ -158,8 +158,8 @@ public async Task CreateEntryFromFile_ShouldCreateEntryWithFileContent()
await That(FileSystem).HasFile("test.txt").WithContent("FooFooFoo");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_DestinationNull_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
{
@@ -182,8 +182,8 @@ await That(Act).Throws()
}
#if FEATURE_COMPRESSION_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToDirectory_DestinationNull_WithOverwrite_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
@@ -206,7 +206,7 @@ void Act()
}
#endif
- [Fact]
+ [Test]
public async Task ExtractToDirectory_ShouldExtractFilesAndDirectories()
{
FileSystem.Initialize()
@@ -227,7 +227,7 @@ public async Task ExtractToDirectory_ShouldExtractFilesAndDirectories()
await That(FileSystem).HasFile("bar/bar.txt");
}
- [Fact]
+ [Test]
public async Task ExtractToDirectory_WithoutOverwrite_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -253,7 +253,7 @@ await That(FileSystem).HasFile("bar/foo.txt")
}
#if FEATURE_COMPRESSION_ADVANCED
- [Fact]
+ [Test]
public async Task ExtractToDirectory_WithOverwrite_ShouldOverwriteExistingFile()
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
index 282ce91e7..0d58fed64 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchive/Tests.cs
@@ -5,10 +5,10 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchive;
[FileSystemTests]
-public partial class Tests
+public class Tests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
#if FEATURE_FILESYSTEM_COMMENT_ENCRYPTED
- [Fact]
+ [Test]
public async Task Comment_ShouldBeInitializedEmpty()
{
FileSystem.Initialize()
@@ -26,8 +26,8 @@ public async Task Comment_ShouldBeInitializedEmpty()
}
#endif
#if FEATURE_FILESYSTEM_COMMENT_ENCRYPTED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Comment_ShouldBeSettable(string comment)
{
FileSystem.Initialize()
@@ -46,7 +46,7 @@ public async Task Comment_ShouldBeSettable(string comment)
}
#endif
- [Fact]
+ [Test]
public async Task Entries_CreateMode_ShouldThrowNotSupportedException()
{
using FileSystemStream stream =
@@ -59,8 +59,8 @@ public async Task Entries_CreateMode_ShouldThrowNotSupportedException()
await That(Act).Throws();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FileSystem_ShouldBeSet(
CompressionLevel compressionLevel)
{
@@ -76,7 +76,7 @@ public async Task FileSystem_ShouldBeSet(
await That(archive.FileSystem).IsEqualTo(FileSystem);
}
- [Fact]
+ [Test]
public async Task GetEntry_WhenNameIsNotFound_ShouldReturnNull()
{
FileSystem.Initialize()
@@ -94,8 +94,8 @@ public async Task GetEntry_WhenNameIsNotFound_ShouldReturnNull()
await That(archive.GetEntry("foo/foo.txt")).IsNotNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Mode_ShouldBeSetCorrectly(ZipArchiveMode mode)
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.Async.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.Async.cs
index 5318cacbb..5fdb0defa 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.Async.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.Async.cs
@@ -8,7 +8,7 @@ namespace Testably.Abstractions.Compression.Tests.ZipArchiveEntry;
public partial class ExtensionTests
{
- [Fact]
+ [Test]
public async Task
ExtractToFileAsync_AccessLengthOnWritableStream_ShouldThrowInvalidOperationException()
{
@@ -24,13 +24,13 @@ public async Task
archive.CreateEntryFromFile("foo.txt", "foo/");
Task Act()
- => archive.ExtractToDirectoryAsync("bar", TestContext.Current.CancellationToken);
+ => archive.ExtractToDirectoryAsync("bar", CancellationToken);
await That(Act).Throws();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToFileAsync_DestinationNull_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
{
@@ -46,15 +46,15 @@ async Task Act()
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
- await archive.Entries.Single().ExtractToFileAsync(null!, TestContext.Current.CancellationToken);
+ await archive.Entries.Single().ExtractToFileAsync(null!, CancellationToken);
}
await That(Act).Throws()
.WithParamName("destinationFileName");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToFileAsync_DestinationNull_WithOverwrite_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
@@ -71,13 +71,13 @@ async Task Act()
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
- await archive.Entries.Single().ExtractToFileAsync(null!, true, TestContext.Current.CancellationToken);
+ await archive.Entries.Single().ExtractToFileAsync(null!, true, CancellationToken);
}
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task ExtractToFileAsync_IncorrectEntryType_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -96,15 +96,15 @@ public async Task ExtractToFileAsync_IncorrectEntryType_ShouldThrowIOException()
IZipArchive archive2 = FileSystem.ZipArchive().New(stream2, ZipArchiveMode.Read);
Task Act()
- => archive2.ExtractToDirectoryAsync("bar", TestContext.Current.CancellationToken);
+ => archive2.ExtractToDirectoryAsync("bar", CancellationToken);
await That(Act).Throws();
}
- [Theory]
- [InlineData("2000-01-01T12:14:15")]
- [InlineData("1980-01-01T00:00:00")]
- [InlineData("2107-12-31T23:59:59")]
+ [Test]
+ [Arguments("2000-01-01T12:14:15")]
+ [Arguments("1980-01-01T00:00:00")]
+ [Arguments("2107-12-31T23:59:59")]
public async Task ExtractToFileAsync_LastWriteTime_ShouldBeCopiedFromFile(string lastWriteTimeString)
{
DateTime lastWriteTime = DateTime.Parse(lastWriteTimeString, CultureInfo.InvariantCulture);
@@ -124,14 +124,14 @@ public async Task ExtractToFileAsync_LastWriteTime_ShouldBeCopiedFromFile(string
CompressionLevel.NoCompression);
IZipArchiveEntry entry = archive.Entries.Single();
- await entry.ExtractToFileAsync("bar/bar.txt", true, TestContext.Current.CancellationToken);
+ await entry.ExtractToFileAsync("bar/bar.txt", true, CancellationToken);
await That(FileSystem).HasFile("bar/bar.txt")
.WithContent("FooFooFoo").And
.WithLastWriteTime(lastWriteTime);
}
- [Fact]
+ [Test]
public async Task ExtractToFileAsync_WithoutOverwrite_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -147,7 +147,7 @@ public async Task ExtractToFileAsync_WithoutOverwrite_ShouldThrowIOException()
IZipArchiveEntry entry = archive.Entries.Single();
Task Act()
- => entry.ExtractToFileAsync("bar/bar.txt", TestContext.Current.CancellationToken);
+ => entry.ExtractToFileAsync("bar/bar.txt", CancellationToken);
await That(Act).Throws()
.WithMessage($"*'{FileSystem.Path.GetFullPath("bar/bar.txt")}'*").AsWildcard();
@@ -155,7 +155,7 @@ await That(FileSystem).HasFile("bar/bar.txt")
.WhoseContent(f => f.IsNotEqualTo("FooFooFoo"));
}
- [Fact]
+ [Test]
public async Task ExtractToFileAsync_WithOverwrite_ShouldOverwriteExistingFile()
{
FileSystem.Initialize()
@@ -170,7 +170,7 @@ public async Task ExtractToFileAsync_WithOverwrite_ShouldOverwriteExistingFile()
IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
IZipArchiveEntry entry = archive.Entries.Single();
- await entry.ExtractToFileAsync("bar/bar.txt", true, TestContext.Current.CancellationToken);
+ await entry.ExtractToFileAsync("bar/bar.txt", true, CancellationToken);
await That(FileSystem).HasFile("bar/bar.txt")
.WithContent("FooFooFoo");
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
index c8e643e51..491399144 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/ExtensionTests.cs
@@ -6,9 +6,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchiveEntry;
[FileSystemTests]
-public partial class ExtensionTests
+public partial class ExtensionTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task
ExtractToFile_AccessLengthOnWritableStream_ShouldThrowInvalidOperationException()
{
@@ -29,8 +29,8 @@ void Act()
await That(Act).Throws();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToFile_DestinationNull_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
{
@@ -53,8 +53,8 @@ await That(Act).Throws()
.WithParamName("destinationFileName");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToFile_DestinationNull_WithOverwrite_ShouldThrowArgumentNullException(
CompressionLevel compressionLevel)
@@ -77,7 +77,7 @@ void Act()
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task ExtractToFile_IncorrectEntryType_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -101,10 +101,10 @@ void Act()
await That(Act).Throws();
}
- [Theory]
- [InlineData("2000-01-01T12:14:15")]
- [InlineData("1980-01-01T00:00:00")]
- [InlineData("2107-12-31T23:59:59")]
+ [Test]
+ [Arguments("2000-01-01T12:14:15")]
+ [Arguments("1980-01-01T00:00:00")]
+ [Arguments("2107-12-31T23:59:59")]
public async Task ExtractToFile_LastWriteTime_ShouldBeCopiedFromFile(string lastWriteTimeString)
{
DateTime lastWriteTime = DateTime.Parse(lastWriteTimeString, CultureInfo.InvariantCulture);
@@ -131,7 +131,7 @@ await That(FileSystem).HasFile("bar/bar.txt")
.WithLastWriteTime(lastWriteTime);
}
- [Fact]
+ [Test]
public async Task ExtractToFile_WithoutOverwrite_ShouldThrowIOException()
{
FileSystem.Initialize()
@@ -157,7 +157,7 @@ await That(FileSystem).HasFile("bar/bar.txt")
.WhoseContent(f => f.IsNotEqualTo("FooFooFoo"));
}
- [Fact]
+ [Test]
public async Task ExtractToFile_WithOverwrite_ShouldOverwriteExistingFile()
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
index afeacae20..31cc19e19 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveEntry/Tests.cs
@@ -6,9 +6,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipArchiveEntry;
[FileSystemTests]
-public partial class Tests
+public class Tests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task Archive_ShouldBeSetToArchive()
{
FileSystem.Initialize()
@@ -28,7 +28,7 @@ public async Task Archive_ShouldBeSetToArchive()
}
#if FEATURE_FILESYSTEM_COMMENT_ENCRYPTED
- [Fact]
+ [Test]
public async Task Comment_ShouldBeInitializedEmpty()
{
FileSystem.Initialize()
@@ -48,8 +48,8 @@ public async Task Comment_ShouldBeInitializedEmpty()
#endif
#if FEATURE_FILESYSTEM_COMMENT_ENCRYPTED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Comment_ShouldBeSettable(string comment)
{
FileSystem.Initialize()
@@ -70,7 +70,7 @@ public async Task Comment_ShouldBeSettable(string comment)
}
#endif
- [Fact]
+ [Test]
public async Task CompressedLength_WithNoCompression_ShouldBeFileLength()
{
Skip.If(Test.IsNetFramework, "Test is brittle on .NET Framework.");
@@ -91,7 +91,7 @@ await That(archive.Entries.Single())
.For(x => x.CompressedLength, l => l.IsEqualTo(9));
}
- [Fact]
+ [Test]
public async Task CompressedLength_WithOptimalCompressionLevel_ShouldBeLessThanFileLength()
{
FileSystem.Initialize()
@@ -111,7 +111,7 @@ await That(archive.Entries.Single())
}
#if FEATURE_COMPRESSION_ADVANCED
- [Fact]
+ [Test]
public async Task Crc32_ShouldBeCalculatedFromTheFileContent()
{
FileSystem.Initialize()
@@ -133,7 +133,7 @@ public async Task Crc32_ShouldBeCalculatedFromTheFileContent()
}
#endif
- [Fact]
+ [Test]
public async Task Delete_ReadMode_ShouldThrowNotSupportedException()
{
FileSystem.Initialize()
@@ -154,7 +154,7 @@ public async Task Delete_ReadMode_ShouldThrowNotSupportedException()
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task Delete_ShouldRemoveEntryFromArchive()
{
FileSystem.Initialize()
@@ -176,8 +176,8 @@ public async Task Delete_ShouldRemoveEntryFromArchive()
}
#if FEATURE_COMPRESSION_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExternalAttributes_ShouldBeSettable(int externalAttributes)
{
FileSystem.Initialize()
@@ -201,7 +201,7 @@ public async Task ExternalAttributes_ShouldBeSettable(int externalAttributes)
}
#endif
- [Fact]
+ [Test]
public async Task FileSystemExtension_ShouldBeSet()
{
FileSystem.Initialize()
@@ -220,7 +220,7 @@ public async Task FileSystemExtension_ShouldBeSet()
await That(entry.FileSystem).IsEqualTo(FileSystem);
}
- [Fact]
+ [Test]
public async Task FullName_ShouldIncludeDirectory()
{
FileSystem.Initialize()
@@ -240,8 +240,8 @@ public async Task FullName_ShouldIncludeDirectory()
await That(entry.Name).IsEqualTo("foo.txt");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task LastWriteTime_ReadOnlyArchive_ShouldThrowNotSupportedException(
DateTime lastWriteTime)
{
@@ -267,8 +267,8 @@ void Act()
await That(Act).Throws();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task LastWriteTime_ShouldBeSettable(DateTime lastWriteTime)
{
FileSystem.Initialize()
@@ -292,7 +292,7 @@ public async Task LastWriteTime_ShouldBeSettable(DateTime lastWriteTime)
await That(entry2.LastWriteTime.DateTime).IsNotEqualTo(lastWriteTime);
}
- [Fact]
+ [Test]
public async Task Open_ShouldBeSetToFileName()
{
FileSystem.Initialize()
@@ -314,7 +314,7 @@ public async Task Open_ShouldBeSetToFileName()
}
#if FEATURE_COMPRESSION_ASYNC
- [Fact]
+ [Test]
public async Task OpenAsync_ShouldBeSetToFileName()
{
FileSystem.Initialize()
@@ -330,13 +330,13 @@ public async Task OpenAsync_ShouldBeSetToFileName()
IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Update);
IZipArchiveEntry entry = archive.Entries.Single();
- Stream resultStream = await entry.OpenAsync(TestContext.Current.CancellationToken);
+ Stream resultStream = await entry.OpenAsync(CancellationToken);
await That(resultStream).HasLength().EqualTo("FooFooFoo".Length);
}
#endif
- [Fact]
+ [Test]
public async Task ToString_ShouldBeSetToFileName()
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
index d3a49593d..236336b3c 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipArchiveFactory/Tests.cs
@@ -1,13 +1,14 @@
-using System.IO;
+using System.Collections.Generic;
+using System.IO;
using System.IO.Compression;
using System.Text;
namespace Testably.Abstractions.Compression.Tests.ZipArchiveFactory;
[FileSystemTests]
-public partial class Tests
+public class Tests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task New_ShouldOpenWithReadMode()
{
FileSystem.Initialize()
@@ -25,7 +26,7 @@ public async Task New_ShouldOpenWithReadMode()
await That(archive.Entries).HasCount().EqualTo(1);
}
- [Fact]
+ [Test]
public async Task New_UpdateMode_ReadOnlyStream_ShouldThrowArgumentException()
{
FileSystem.Initialize()
@@ -46,7 +47,7 @@ await That(Act).Throws()
.WithHResult(-2147024809);
}
- [Fact]
+ [Test]
public async Task New_UpdateMode_ShouldOpenArchive()
{
FileSystem.Initialize()
@@ -65,9 +66,9 @@ public async Task New_UpdateMode_ShouldOpenArchive()
await That(archive.Entries).HasCount().EqualTo(1);
}
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
+ [Test]
+ [Arguments(true)]
+ [Arguments(false)]
public async Task New_WhenLeaveOpen_ShouldDisposeStreamWhenDisposingArchive(bool leaveOpen)
{
FileSystem.Initialize()
@@ -88,8 +89,8 @@ public async Task New_WhenLeaveOpen_ShouldDisposeStreamWhenDisposingArchive(bool
await That(Act).Throws().OnlyIf(!leaveOpen);
}
- [Theory]
- [MemberData(nameof(EntryNameEncoding))]
+ [Test]
+ [MethodDataSource(nameof(EntryNameEncoding))]
public async Task New_WithEntryNameEncoding_ShouldUseEncoding(
string entryName, Encoding encoding, bool encodedCorrectly)
{
@@ -119,23 +120,12 @@ public async Task New_WithEntryNameEncoding_ShouldUseEncoding(
#region Helpers
- #pragma warning disable MA0018
- public static TheoryData EntryNameEncoding()
+ public static IEnumerable> EntryNameEncoding()
{
// ReSharper disable StringLiteralTypo
- TheoryData theoryData = new()
- {
- {
- "Dans mes rêves.mp3", Encoding.Default, true
- },
- {
- "Dans mes rêves.mp3", Encoding.ASCII, false
- },
- };
- // ReSharper restore StringLiteralTypo
- return theoryData;
+ yield return () => ("Dans mes rêves.mp3", Encoding.Default, true);
+ yield return () => ("Dans mes rêves.mp3", Encoding.ASCII, false);
}
- #pragma warning restore MA0018
#endregion
}
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryAsyncTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryAsyncTests.cs
index 56cc5b517..1a2d75576 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryAsyncTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryAsyncTests.cs
@@ -1,4 +1,5 @@
#if FEATURE_COMPRESSION_ASYNC
+using System.Collections.Generic;
using System.IO.Compression;
using System.Text;
#if FEATURE_COMPRESSION_STREAM
@@ -9,10 +10,10 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class CreateFromDirectoryAsyncTests
+public class CreateFromDirectoryAsyncTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_EmptyDirectory_ShouldBeIncluded(
CompressionLevel compressionLevel)
@@ -23,7 +24,7 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", "destination.zip", compressionLevel, false,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
@@ -32,8 +33,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("bar/"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectoryAsync_EmptySource_DoNotIncludeBaseDirectory_ShouldBeEmpty(
CompressionLevel compressionLevel)
{
@@ -42,7 +43,7 @@ public async Task CreateFromDirectoryAsync_EmptySource_DoNotIncludeBaseDirectory
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", "destination.zip", compressionLevel, false,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
@@ -50,8 +51,8 @@ await FileSystem.ZipFile()
await That(archive.Entries).IsEmpty();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_EmptySource_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -61,7 +62,7 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", "destination.zip", compressionLevel, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
@@ -70,8 +71,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("foo/"));
}
- [Theory]
- [MemberData(nameof(EntryNameEncoding))]
+ [Test]
+ [MethodDataSource(nameof(EntryNameEncoding))]
public async Task CreateFromDirectoryAsync_EntryNameEncoding_ShouldUseEncoding(
string entryName, Encoding encoding, bool encodedCorrectly)
{
@@ -81,7 +82,7 @@ public async Task CreateFromDirectoryAsync_EntryNameEncoding_ShouldUseEncoding(
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", "destination.zip", CompressionLevel.NoCompression,
- false, encoding, TestContext.Current.CancellationToken);
+ false, encoding, CancellationToken);
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
@@ -97,8 +98,8 @@ await FileSystem.ZipFile()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectoryAsync_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
{
@@ -108,7 +109,7 @@ public async Task CreateFromDirectoryAsync_IncludeBaseDirectory_ShouldPrependDir
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", "destination.zip", compressionLevel, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive =
FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Read);
@@ -117,8 +118,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("foo/test.txt"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectoryAsync_Overwrite_WithEncoding_ShouldOverwriteFile(
string contents, Encoding encoding)
{
@@ -131,7 +132,7 @@ public async Task CreateFromDirectoryAsync_Overwrite_WithEncoding_ShouldOverwrit
contents);
await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", "destination.zip",
- CompressionLevel.Optimal, false, encoding, TestContext.Current.CancellationToken);
+ CompressionLevel.Optimal, false, encoding, CancellationToken);
IZipArchive archive = FileSystem.ZipFile()
.Open("destination.zip", ZipArchiveMode.Read, encoding);
@@ -140,7 +141,7 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("test.txt"));
}
- [Fact]
+ [Test]
public async Task CreateFromDirectoryAsync_ShouldZipDirectoryContent()
{
FileSystem.Initialize()
@@ -150,7 +151,7 @@ public async Task CreateFromDirectoryAsync_ShouldZipDirectoryContent()
.WithFile("test.txt")));
await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", "destination.zip",
- TestContext.Current.CancellationToken);
+ CancellationToken);
FileSystem.ZipFile().ExtractToDirectory("destination.zip", "destination");
@@ -158,7 +159,7 @@ await That(FileSystem).HasFile("destination/bar/test.txt")
.WithContent().SameAs("foo/bar/test.txt");
}
- [Fact]
+ [Test]
public async Task CreateFromDirectoryAsync_WithReadOnlyStream_ShouldThrowArgumentException()
{
FileSystem.Initialize()
@@ -171,7 +172,7 @@ public async Task CreateFromDirectoryAsync_WithReadOnlyStream_ShouldThrowArgumen
async Task Act()
{
// ReSharper disable once AccessToDisposedClosure
- await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, CancellationToken);
}
await That(Act).Throws()
@@ -180,8 +181,8 @@ await That(Act).Throws()
.WithHResult(-2147024809);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_WithStream_EmptyDirectory_ShouldBeIncluded(
CompressionLevel compressionLevel)
@@ -193,7 +194,7 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", stream, compressionLevel, false,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
@@ -201,8 +202,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("bar/"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_WithStream_EmptySource_DoNotIncludeBaseDirectory_ShouldBeEmpty(
CompressionLevel compressionLevel)
@@ -213,15 +214,15 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", stream, compressionLevel, false,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
await That(archive.Entries).IsEmpty();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_WithStream_EmptySource_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -232,7 +233,7 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", stream, compressionLevel, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
@@ -240,8 +241,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("foo/"));
}
- [Theory]
- [MemberData(nameof(EntryNameEncoding))]
+ [Test]
+ [MethodDataSource(nameof(EntryNameEncoding))]
public async Task CreateFromDirectoryAsync_WithStream_EntryNameEncoding_ShouldUseEncoding(
string entryName, Encoding encoding, bool encodedCorrectly)
{
@@ -252,7 +253,7 @@ public async Task CreateFromDirectoryAsync_WithStream_EntryNameEncoding_ShouldUs
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", stream, CompressionLevel.NoCompression,
- false, encoding, TestContext.Current.CancellationToken);
+ false, encoding, CancellationToken);
using IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
@@ -267,8 +268,8 @@ await FileSystem.ZipFile()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_WithStream_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -280,7 +281,7 @@ public async Task
await FileSystem.ZipFile()
.CreateFromDirectoryAsync("foo", stream, compressionLevel, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
using IZipArchive archive = FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read);
@@ -288,7 +289,7 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("foo/test.txt"));
}
- [Fact]
+ [Test]
public async Task
CreateFromDirectoryAsync_WithStream_NotWritable_ShouldThrowArgumentException()
{
@@ -296,7 +297,7 @@ public async Task
async Task Act()
{
- await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, CancellationToken);
}
await That(Act).Throws()
@@ -305,7 +306,7 @@ await That(Act).Throws()
.WithHResult(-2147024809);
}
- [Fact]
+ [Test]
public async Task
CreateFromDirectoryAsync_WithStream_Null_ShouldThrowArgumentNullException()
{
@@ -313,15 +314,15 @@ public async Task
async Task Act()
{
- await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream, CancellationToken);
}
await That(Act).Throws()
.WithParamName("destination");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectoryAsync_WithStream_Overwrite_WithEncoding_ShouldOverwriteFile(
string contents, Encoding encoding)
@@ -336,7 +337,7 @@ public async Task
using MemoryStream stream = new();
await FileSystem.ZipFile().CreateFromDirectoryAsync("foo", stream,
- CompressionLevel.Optimal, false, encoding, TestContext.Current.CancellationToken);
+ CompressionLevel.Optimal, false, encoding, CancellationToken);
IZipArchive archive =
FileSystem.ZipArchive().New(stream, ZipArchiveMode.Read, true, encoding);
@@ -345,7 +346,7 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("test.txt"));
}
- [Fact]
+ [Test]
public async Task CreateFromDirectoryAsync_WithStream_ShouldZipDirectoryContent()
{
FileSystem.Initialize()
@@ -356,7 +357,7 @@ public async Task CreateFromDirectoryAsync_WithStream_ShouldZipDirectoryContent(
using MemoryStream stream = new();
await FileSystem.ZipFile()
- .CreateFromDirectoryAsync("foo", stream, TestContext.Current.CancellationToken);
+ .CreateFromDirectoryAsync("foo", stream, CancellationToken);
FileSystem.ZipFile().ExtractToDirectory(stream, "destination");
@@ -364,7 +365,7 @@ await That(FileSystem).HasFile("destination/bar/test.txt")
.WithContent().SameAs("foo/bar/test.txt");
}
- [Fact]
+ [Test]
public async Task ShouldNotLock()
{
string directory = "ToBeZipped";
@@ -375,30 +376,19 @@ public async Task ShouldNotLock()
void Act() => FileSystem.Directory.Delete(directory, true);
await FileSystem.ZipFile()
- .CreateFromDirectoryAsync(directory, archive, TestContext.Current.CancellationToken);
+ .CreateFromDirectoryAsync(directory, archive, CancellationToken);
await That(Act).DoesNotThrow();
}
#region Helpers
- #pragma warning disable MA0018
- public static TheoryData EntryNameEncoding()
+ public static IEnumerable> EntryNameEncoding()
{
// ReSharper disable StringLiteralTypo
- TheoryData theoryData = new()
- {
- {
- "Dans mes rêves.mp3", Encoding.Default, true
- },
- {
- "Dans mes rêves.mp3", Encoding.ASCII, false
- },
- };
- // ReSharper restore StringLiteralTypo
- return theoryData;
+ yield return () => ("Dans mes rêves.mp3", Encoding.Default, true);
+ yield return () => ("Dans mes rêves.mp3", Encoding.ASCII, false);
}
- #pragma warning restore MA0018
#endregion
}
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
index 94a284725..39b219f3d 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/CreateFromDirectoryTests.cs
@@ -1,4 +1,5 @@
-using System.IO.Compression;
+using System.Collections.Generic;
+using System.IO.Compression;
using System.Text;
#if FEATURE_COMPRESSION_STREAM
using System.IO;
@@ -8,10 +9,10 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class CreateFromDirectoryTests
+public class CreateFromDirectoryTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_EmptyDirectory_ShouldBeIncluded(
CompressionLevel compressionLevel)
@@ -30,8 +31,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("bar/"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectory_EmptySource_DoNotIncludeBaseDirectory_ShouldBeEmpty(
CompressionLevel compressionLevel)
{
@@ -47,8 +48,8 @@ public async Task CreateFromDirectory_EmptySource_DoNotIncludeBaseDirectory_Shou
await That(archive.Entries).IsEmpty();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_EmptySource_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -66,8 +67,8 @@ await That(archive.Entries).HasSingle()
.Which.For(x => x.FullName, f => f.IsEqualTo("foo/"));
}
- [Theory]
- [MemberData(nameof(EntryNameEncoding))]
+ [Test]
+ [MethodDataSource(nameof(EntryNameEncoding))]
public async Task CreateFromDirectory_EntryNameEncoding_ShouldUseEncoding(
string entryName, Encoding encoding, bool encodedCorrectly)
{
@@ -93,8 +94,8 @@ public async Task CreateFromDirectory_EntryNameEncoding_ShouldUseEncoding(
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectory_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
{
@@ -113,8 +114,8 @@ await That(archive.Entries).HasSingle()
}
#if FEATURE_COMPRESSION_OVERWRITE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectory_Overwrite_WithEncoding_ShouldOverwriteFile(
string contents, Encoding encoding)
{
@@ -137,7 +138,7 @@ await That(archive.Entries).HasSingle()
}
#endif
- [Fact]
+ [Test]
public async Task CreateFromDirectory_ShouldZipDirectoryContent()
{
FileSystem.Initialize()
@@ -155,7 +156,7 @@ await That(FileSystem).HasFile("destination/bar/test.txt")
}
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task CreateFromDirectory_WithReadOnlyStream_ShouldThrowArgumentException()
{
FileSystem.Initialize()
@@ -179,8 +180,8 @@ await That(Act).Throws()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_WithStream_EmptyDirectory_ShouldBeIncluded(
CompressionLevel compressionLevel)
@@ -201,8 +202,8 @@ await That(archive.Entries).HasSingle()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_WithStream_EmptySource_DoNotIncludeBaseDirectory_ShouldBeEmpty(
CompressionLevel compressionLevel)
@@ -221,8 +222,8 @@ public async Task
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_WithStream_EmptySource_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -242,8 +243,8 @@ await That(archive.Entries).HasSingle()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [MemberData(nameof(EntryNameEncoding))]
+ [Test]
+ [MethodDataSource(nameof(EntryNameEncoding))]
public async Task CreateFromDirectory_WithStream_EntryNameEncoding_ShouldUseEncoding(
string entryName, Encoding encoding, bool encodedCorrectly)
{
@@ -271,8 +272,8 @@ public async Task CreateFromDirectory_WithStream_EntryNameEncoding_ShouldUseEnco
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateFromDirectory_WithStream_IncludeBaseDirectory_ShouldPrependDirectoryName(
CompressionLevel compressionLevel)
@@ -293,7 +294,7 @@ await That(archive.Entries).HasSingle()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task
CreateFromDirectory_WithStream_NotWritable_ShouldThrowArgumentException()
{
@@ -312,7 +313,7 @@ await That(Act).Throws()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task
CreateFromDirectory_WithStream_Null_ShouldThrowArgumentNullException()
{
@@ -329,8 +330,8 @@ await That(Act).Throws()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateFromDirectory_WithStream_Overwrite_WithEncoding_ShouldOverwriteFile(
string contents, Encoding encoding)
{
@@ -355,7 +356,7 @@ await That(archive.Entries).HasSingle()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task CreateFromDirectory_WithStream_ShouldZipDirectoryContent()
{
FileSystem.Initialize()
@@ -374,7 +375,7 @@ await That(FileSystem).HasFile("destination/bar/test.txt")
}
#endif
- [Fact]
+ [Test]
public async Task ShouldNotLock()
{
string directory = "ToBeZipped";
@@ -391,23 +392,12 @@ public async Task ShouldNotLock()
#region Helpers
- #pragma warning disable MA0018
- public static TheoryData EntryNameEncoding()
+ public static IEnumerable> EntryNameEncoding()
{
// ReSharper disable StringLiteralTypo
- TheoryData theoryData = new()
- {
- {
- "Dans mes rêves.mp3", Encoding.Default, true
- },
- {
- "Dans mes rêves.mp3", Encoding.ASCII, false
- },
- };
- // ReSharper restore StringLiteralTypo
- return theoryData;
+ yield return () => ("Dans mes rêves.mp3", Encoding.Default, true);
+ yield return () => ("Dans mes rêves.mp3", Encoding.ASCII, false);
}
- #pragma warning restore MA0018
#endregion
}
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryAsyncTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryAsyncTests.cs
index b1bfe6bb4..2e96399fe 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryAsyncTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryAsyncTests.cs
@@ -9,9 +9,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class ExtractToDirectoryAsyncAsyncTests
+public class ExtractToDirectoryAsyncAsyncTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task ExtractToDirectoryAsync_MissingDestinationDirectory_ShouldCreateDirectory()
{
FileSystem.Initialize()
@@ -21,13 +21,13 @@ public async Task ExtractToDirectoryAsync_MissingDestinationDirectory_ShouldCrea
FileSystem.ZipFile().CreateFromDirectory("foo", "destination.zip");
await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar",
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile("bar/test.txt")
.WithContent().SameAs("foo/test.txt");
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectoryAsync_MissingSourceFileName_ShouldThrowArgumentNullException()
{
@@ -37,14 +37,14 @@ public async Task
async Task Act()
{
await FileSystem.ZipFile().ExtractToDirectoryAsync(sourceArchiveFileName, "bar",
- TestContext.Current.CancellationToken);
+ CancellationToken);
}
await That(Act).Throws()
.WithMessage($"*'{FileSystem.Path.GetFullPath(sourceArchiveFileName)}*").AsWildcard();
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectoryAsync_NullAsSourceFileName_ShouldThrowArgumentNullException()
{
@@ -53,15 +53,15 @@ public async Task
async Task Act()
{
- await FileSystem.ZipFile().ExtractToDirectoryAsync(sourceArchiveFileName, "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync(sourceArchiveFileName, "bar", CancellationToken);
}
await That(Act).Throws()
.WithParamName("sourceArchiveFileName");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_Overwrite_ShouldOverwriteFile(
string contents)
{
@@ -76,14 +76,14 @@ public async Task ExtractToDirectoryAsync_Overwrite_ShouldOverwriteFile(
FileSystem.ZipFile().CreateFromDirectory("foo", "destination.zip");
await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar", true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithEncoding_Overwrite_ShouldOverwriteFile(
string contents,
Encoding encoding)
@@ -99,14 +99,14 @@ public async Task ExtractToDirectoryAsync_WithEncoding_Overwrite_ShouldOverwrite
FileSystem.ZipFile().CreateFromDirectory("foo", "destination.zip");
await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar", encoding, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithEncoding_ShouldZipDirectoryContent(
Encoding encoding)
{
@@ -119,14 +119,14 @@ public async Task ExtractToDirectoryAsync_WithEncoding_ShouldZipDirectoryContent
CompressionLevel.Fastest, false, encoding);
await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar", encoding,
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent().SameAs(FileSystem.Path.Combine("foo", "test.txt"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithoutOverwriteAndExistingFile_ShouldOverwriteFile(
string contents)
{
@@ -144,7 +144,7 @@ public async Task ExtractToDirectoryAsync_WithoutOverwriteAndExistingFile_Should
async Task Act()
{
- await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync("destination.zip", "bar", CancellationToken);
}
await That(Act).Throws()
@@ -153,7 +153,7 @@ await That(FileSystem.File.ReadAllText(destinationPath))
.IsNotEqualTo(contents);
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectoryAsync_WithStream_MissingDestinationDirectory_ShouldCreateDirectory()
{
@@ -165,13 +165,13 @@ public async Task
FileSystem.ZipFile().CreateFromDirectory("foo", stream);
await FileSystem.ZipFile()
- .ExtractToDirectoryAsync(stream, "bar", TestContext.Current.CancellationToken);
+ .ExtractToDirectoryAsync(stream, "bar", CancellationToken);
await That(FileSystem).HasFile("bar/test.txt")
.WithContent().SameAs("foo/test.txt");
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectoryAsync_WithStream_NotReadable_ShouldThrowArgumentNullException()
{
@@ -180,7 +180,7 @@ public async Task
async Task Act()
{
- await FileSystem.ZipFile().ExtractToDirectoryAsync(source, "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync(source, "bar", CancellationToken);
}
await That(Act).Throws()
@@ -189,7 +189,7 @@ await That(Act).Throws()
.WithHResult(-2147024809);
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectoryAsync_WithStream_Null_ShouldThrowArgumentNullException()
{
@@ -198,15 +198,15 @@ public async Task
async Task Act()
{
- await FileSystem.ZipFile().ExtractToDirectoryAsync(source, "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync(source, "bar", CancellationToken);
}
await That(Act).Throws()
.WithParamName("source");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithStream_Overwrite_ShouldOverwriteFile(
string contents)
{
@@ -222,14 +222,14 @@ public async Task ExtractToDirectoryAsync_WithStream_Overwrite_ShouldOverwriteFi
FileSystem.ZipFile().CreateFromDirectory("foo", stream);
await FileSystem.ZipFile()
- .ExtractToDirectoryAsync(stream, "bar", true, TestContext.Current.CancellationToken);
+ .ExtractToDirectoryAsync(stream, "bar", true, CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithStream_WithEncoding_Overwrite_ShouldOverwriteFile(
string contents,
Encoding encoding)
@@ -246,14 +246,14 @@ public async Task ExtractToDirectoryAsync_WithStream_WithEncoding_Overwrite_Shou
FileSystem.ZipFile().CreateFromDirectory("foo", stream);
await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", encoding, true,
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectoryAsync_WithStream_WithEncoding_ShouldZipDirectoryContent(
Encoding encoding)
{
@@ -267,14 +267,14 @@ public async Task ExtractToDirectoryAsync_WithStream_WithEncoding_ShouldZipDirec
CompressionLevel.Fastest, false, encoding);
await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", encoding,
- TestContext.Current.CancellationToken);
+ CancellationToken);
await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent().SameAs(FileSystem.Path.Combine("foo", "test.txt"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToDirectoryAsync_WithStream_WithoutOverwriteAndExistingFile_ShouldOverwriteFile(
string contents)
@@ -295,7 +295,7 @@ public async Task
async Task Act()
{
// ReSharper disable once AccessToDisposedClosure
- await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", CancellationToken);
}
await That(Act).Throws()
@@ -304,7 +304,7 @@ await That(FileSystem.File.ReadAllText(destinationPath))
.IsNotEqualTo(contents);
}
- [Fact]
+ [Test]
public async Task ExtractToDirectoryAsync_WithWriteOnlyStream_ShouldThrowArgumentException()
{
FileSystem.Initialize()
@@ -319,7 +319,7 @@ public async Task ExtractToDirectoryAsync_WithWriteOnlyStream_ShouldThrowArgumen
async Task Act()
{
// ReSharper disable once AccessToDisposedClosure
- await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", TestContext.Current.CancellationToken);
+ await FileSystem.ZipFile().ExtractToDirectoryAsync(stream, "bar", CancellationToken);
}
await That(Act).Throws()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
index ef4c4ef42..b1acf35d9 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/ExtractToDirectoryTests.cs
@@ -8,9 +8,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class ExtractToDirectoryTests
+public class ExtractToDirectoryTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task ExtractToDirectory_MissingDestinationDirectory_ShouldCreateDirectory()
{
FileSystem.Initialize()
@@ -25,7 +25,7 @@ await That(FileSystem).HasFile("bar/test.txt")
.WithContent().SameAs("foo/test.txt");
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectory_MissingSourceFileName_ShouldThrowArgumentNullException()
{
@@ -41,7 +41,7 @@ await That(Act).Throws()
.WithMessage($"*'{FileSystem.Path.GetFullPath(sourceArchiveFileName)}*").AsWildcard();
}
- [Fact]
+ [Test]
public async Task
ExtractToDirectory_NullAsSourceFileName_ShouldThrowArgumentNullException()
{
@@ -58,8 +58,8 @@ await That(Act).Throws()
}
#if FEATURE_COMPRESSION_OVERWRITE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_Overwrite_ShouldOverwriteFile(
string contents)
{
@@ -81,8 +81,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
#endif
#if FEATURE_COMPRESSION_OVERWRITE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithEncoding_Overwrite_ShouldOverwriteFile(
string contents,
Encoding encoding)
@@ -104,8 +104,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithEncoding_ShouldZipDirectoryContent(
Encoding encoding)
{
@@ -123,8 +123,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
.WithContent().SameAs(FileSystem.Path.Combine("foo", "test.txt"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithoutOverwriteAndExistingFile_ShouldOverwriteFile(
string contents)
{
@@ -152,7 +152,7 @@ await That(FileSystem.File.ReadAllText(destinationPath))
}
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task
ExtractToDirectory_WithStream_MissingDestinationDirectory_ShouldCreateDirectory()
{
@@ -171,7 +171,7 @@ await That(FileSystem).HasFile("bar/test.txt")
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task
ExtractToDirectory_WithStream_NotReadable_ShouldThrowArgumentNullException()
{
@@ -191,7 +191,7 @@ await That(Act).Throws()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task
ExtractToDirectory_WithStream_Null_ShouldThrowArgumentNullException()
{
@@ -209,8 +209,8 @@ await That(Act).Throws()
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithStream_Overwrite_ShouldOverwriteFile(
string contents)
{
@@ -233,8 +233,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithStream_WithEncoding_Overwrite_ShouldOverwriteFile(
string contents,
Encoding encoding)
@@ -258,8 +258,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ExtractToDirectory_WithStream_WithEncoding_ShouldZipDirectoryContent(
Encoding encoding)
{
@@ -280,8 +280,8 @@ await That(FileSystem).HasFile(FileSystem.Path.Combine("bar", "test.txt"))
#endif
#if FEATURE_COMPRESSION_STREAM
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ExtractToDirectory_WithStream_WithoutOverwriteAndExistingFile_ShouldOverwriteFile(
string contents)
@@ -313,7 +313,7 @@ await That(FileSystem.File.ReadAllText(destinationPath))
#endif
#if FEATURE_COMPRESSION_STREAM
- [Fact]
+ [Test]
public async Task ExtractToDirectory_WithWriteOnlyStream_ShouldThrowArgumentException()
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
index 1c407343d..669535471 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/OpenTests.cs
@@ -3,9 +3,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class OpenTests
+public class OpenTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task Open_CreateMode_ShouldInitializeEmptyArchive()
{
IZipArchive archive = FileSystem.ZipFile().Open("destination.zip", ZipArchiveMode.Create);
@@ -13,7 +13,7 @@ public async Task Open_CreateMode_ShouldInitializeEmptyArchive()
await That(archive.Mode).IsEqualTo(ZipArchiveMode.Create);
}
- [Fact]
+ [Test]
public async Task Open_InvalidMode_ShouldThrowArgumentOutOfRangeException()
{
ZipArchiveMode invalidMode = (ZipArchiveMode)(-1);
@@ -27,9 +27,9 @@ await That(Act).Throws()
.WithParamName("mode");
}
- [Theory]
- [InlineData(ZipArchiveMode.Read)]
- [InlineData(ZipArchiveMode.Update)]
+ [Test]
+ [Arguments(ZipArchiveMode.Read)]
+ [Arguments(ZipArchiveMode.Update)]
public async Task Open_ShouldOpenExistingArchive(ZipArchiveMode mode)
{
FileSystem.Initialize()
@@ -45,7 +45,7 @@ public async Task Open_ShouldOpenExistingArchive(ZipArchiveMode mode)
await That(archive.Entries).HasCount().EqualTo(1);
}
- [Fact]
+ [Test]
public async Task OpenRead_ShouldOpenExistingArchiveInReadMode()
{
FileSystem.Initialize()
diff --git a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
index 73f33f609..fc47b2036 100644
--- a/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
+++ b/Tests/Testably.Abstractions.Compression.Tests/ZipFile/Tests.cs
@@ -1,9 +1,9 @@
namespace Testably.Abstractions.Compression.Tests.ZipFile;
[FileSystemTests]
-public partial class Tests
+public class Tests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task FileSystemExtension_ShouldBeSet()
{
IZipFile result = FileSystem.ZipFile();
diff --git a/Tests/Testably.Abstractions.Parity.Tests/Net10ParityTests.cs b/Tests/Testably.Abstractions.Parity.Tests/Net10ParityTests.cs
index 586d961fd..85b8ec650 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/Net10ParityTests.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/Net10ParityTests.cs
@@ -3,11 +3,12 @@
namespace Testably.Abstractions.Parity.Tests;
+[InheritsTests]
// ReSharper disable once UnusedMember.Global
public class Net10ParityTests : ParityTests
{
- public Net10ParityTests(ITestOutputHelper testOutputHelper)
- : base(new TestHelpers.Parity(), testOutputHelper)
+ public Net10ParityTests()
+ : base(new TestHelpers.Parity())
{
Parity.File.MissingMethods.Add(
typeof(File).GetMethod(nameof(File.OpenHandle)));
diff --git a/Tests/Testably.Abstractions.Parity.Tests/Net48ParityTests.cs b/Tests/Testably.Abstractions.Parity.Tests/Net48ParityTests.cs
index 54bffc9e6..b101ee28b 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/Net48ParityTests.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/Net48ParityTests.cs
@@ -5,6 +5,7 @@
namespace Testably.Abstractions.Parity.Tests;
+[InheritsTests]
public class Net48ParityTests : ParityTests
{
///
@@ -12,8 +13,8 @@ public class Net48ParityTests : ParityTests
///
/// As we only support .NET Standard 2.0 these are blacklisted.
///
- public Net48ParityTests(ITestOutputHelper testOutputHelper)
- : base(new TestHelpers.Parity(), testOutputHelper)
+ public Net48ParityTests()
+ : base(new TestHelpers.Parity())
{
#region Directory
diff --git a/Tests/Testably.Abstractions.Parity.Tests/Net8ParityTests.cs b/Tests/Testably.Abstractions.Parity.Tests/Net8ParityTests.cs
index 4ba4882cf..e4d4e4311 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/Net8ParityTests.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/Net8ParityTests.cs
@@ -3,11 +3,12 @@
namespace Testably.Abstractions.Parity.Tests;
+[InheritsTests]
// ReSharper disable once UnusedMember.Global
public class Net8ParityTests : ParityTests
{
- public Net8ParityTests(ITestOutputHelper testOutputHelper)
- : base(new TestHelpers.Parity(), testOutputHelper)
+ public Net8ParityTests()
+ : base(new TestHelpers.Parity())
{
Parity.File.MissingMethods.Add(
typeof(File).GetMethod(nameof(File.OpenHandle)));
diff --git a/Tests/Testably.Abstractions.Parity.Tests/Net9ParityTests.cs b/Tests/Testably.Abstractions.Parity.Tests/Net9ParityTests.cs
index 80cab2232..04765cc6c 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/Net9ParityTests.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/Net9ParityTests.cs
@@ -3,11 +3,12 @@
namespace Testably.Abstractions.Parity.Tests;
+[InheritsTests]
// ReSharper disable once UnusedMember.Global
public class Net9ParityTests : ParityTests
{
- public Net9ParityTests(ITestOutputHelper testOutputHelper)
- : base(new TestHelpers.Parity(), testOutputHelper)
+ public Net9ParityTests()
+ : base(new TestHelpers.Parity())
{
Parity.File.MissingMethods.Add(
typeof(File).GetMethod(nameof(File.OpenHandle)));
diff --git a/Tests/Testably.Abstractions.Parity.Tests/ParityTests.cs b/Tests/Testably.Abstractions.Parity.Tests/ParityTests.cs
index 869678fb2..c486e1685 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/ParityTests.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/ParityTests.cs
@@ -11,8 +11,7 @@
namespace Testably.Abstractions.Parity.Tests;
public abstract class ParityTests(
- TestHelpers.Parity parity,
- ITestOutputHelper testOutputHelper)
+ TestHelpers.Parity parity)
{
#region Test Setup
@@ -20,208 +19,189 @@ public abstract class ParityTests(
#endregion
- [Fact]
+ [Test]
public async Task IDirectory_EnsureParityWith_Directory()
{
List parityErrors = Parity.Directory
.GetErrorsToStaticType(
- typeof(Directory),
- testOutputHelper);
+ typeof(Directory));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IDirectoryInfoAndIDirectoryInfoFactory_EnsureParityWith_DirectoryInfo()
{
List parityErrors = Parity.DirectoryInfo
.GetErrorsToInstanceType(
- typeof(DirectoryInfo),
- testOutputHelper);
+ typeof(DirectoryInfo));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IDriveInfoAndIDriveInfoFactory_EnsureParityWith_DriveInfo()
{
List parityErrors = Parity.Drive
.GetErrorsToInstanceType(
- typeof(DriveInfo),
- testOutputHelper);
+ typeof(DriveInfo));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IFile_EnsureParityWith_File()
{
List parityErrors = Parity.File
.GetErrorsToStaticType(
- typeof(File),
- testOutputHelper);
+ typeof(File));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IFileInfoAndIFileInfoFactory_EnsureParityWith_FileInfo()
{
List parityErrors = Parity.FileInfo
.GetErrorsToInstanceType(
- typeof(FileInfo),
- testOutputHelper);
+ typeof(FileInfo));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IFileSystemInfo_EnsureParityWith_FileSystemInfo()
{
List parityErrors = Parity.FileSystemInfo
.GetErrorsToInstanceType(
- typeof(FileSystemInfo),
- testOutputHelper);
+ typeof(FileSystemInfo));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task
IFileSystemWatcherAndIFileSystemWatcherFactory_EnsureParityWith_FileSystemWatcher()
{
List parityErrors = Parity.FileSystemWatcher
.GetErrorsToInstanceType(
- typeof(FileSystemWatcher),
- testOutputHelper);
+ typeof(FileSystemWatcher));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task
IFileVersionInfoAndIFileVersionInfoFactory_EnsureParityWith_FileVersionInfo()
{
List parityErrors = Parity.FileVersionInfo
.GetErrorsToInstanceType(
- typeof(FileVersionInfo),
- testOutputHelper);
+ typeof(FileVersionInfo));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IGuid_EnsureParityWith_Guid()
{
List parityErrors = Parity.Guid
.GetErrorsToStaticType(
- typeof(Guid),
- testOutputHelper);
+ typeof(Guid));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IPath_EnsureParityWith_Path()
{
List parityErrors = Parity.Path
.GetErrorsToStaticType(
- typeof(Path),
- testOutputHelper);
+ typeof(Path));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IRandomAndIRandomFactory_EnsureParityWith_Random()
{
List parityErrors = Parity.Random
.GetErrorsToInstanceType(
- typeof(Random),
- testOutputHelper);
+ typeof(Random));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task
ITimerAndITimerFactory_EnsureParityWith_Timer()
{
List parityErrors = Parity.Timer
.GetErrorsToInstanceType(
- typeof(Timer),
- testOutputHelper);
+ typeof(Timer));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task
IStopwatchAndIStopwatchFactory_EnsureParityWith_Stopwatch()
{
List parityErrors = Parity.Stopwatch
.GetErrorsToInstanceType(
- typeof(Stopwatch),
- testOutputHelper);
+ typeof(Stopwatch));
parityErrors.AddRange(Parity.Stopwatch
.GetErrorsToStaticType(
- typeof(Stopwatch),
- testOutputHelper));
+ typeof(Stopwatch)));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IZipArchive_EnsureParityWith_ZipArchive()
{
List parityErrors = Parity.ZipArchive
.GetErrorsToInstanceType(
- typeof(ZipArchive),
- testOutputHelper);
+ typeof(ZipArchive));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IZipArchive_EnsureParityWith_ZipFileExtensions()
{
List parityErrors = Parity.ZipArchive
.GetErrorsToExtensionMethods(
- typeof(ZipFileExtensions),
- testOutputHelper);
+ typeof(ZipFileExtensions));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IZipArchiveEntry_EnsureParityWith_ZipArchiveEntry()
{
List parityErrors = Parity.ZipArchiveEntry
.GetErrorsToInstanceType(
- typeof(ZipArchiveEntry),
- testOutputHelper);
+ typeof(ZipArchiveEntry));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IZipArchiveEntry_EnsureParityWith_ZipFileExtensions()
{
List parityErrors = Parity.ZipArchiveEntry
.GetErrorsToExtensionMethods(
- typeof(ZipFileExtensions),
- testOutputHelper);
+ typeof(ZipFileExtensions));
await That(parityErrors).IsEmpty();
}
- [Fact]
+ [Test]
public async Task IZipFile_EnsureParityWith_ZipFile()
{
List parityErrors = Parity.ZipFile
.GetErrorsToStaticType(
- typeof(ZipFile),
- testOutputHelper);
+ typeof(ZipFile));
await That(parityErrors).IsEmpty();
}
diff --git a/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/ParityCheck.cs b/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/ParityCheck.cs
index 5618becca..3d891360d 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/ParityCheck.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/ParityCheck.cs
@@ -52,52 +52,52 @@ public ParityCheck(Type[]? excludeBaseTypes = null,
}
public List GetErrorsToExtensionMethods(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
List parityErrors = [];
parityErrors.AddRange(GetParityErrorsBetweenExtensionMethods(
- systemType, testOutputHelper));
+ systemType));
return parityErrors;
}
public List GetErrorsToInstanceType(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
List parityErrors = [];
parityErrors.AddRange(GetParityErrorsBetweenInstanceProperties(
- systemType, testOutputHelper));
+ systemType));
parityErrors.AddRange(GetParityErrorsBetweenInstanceMethods(
- systemType, testOutputHelper));
+ systemType));
return parityErrors;
}
public List GetErrorsToInstanceType(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
List parityErrors = [];
parityErrors.AddRange(
GetParityErrorsBetweenInstanceConstructors(
- systemType, testOutputHelper));
+ systemType));
parityErrors.AddRange(GetParityErrorsBetweenInstanceProperties(
- systemType, testOutputHelper));
+ systemType));
parityErrors.AddRange(GetParityErrorsBetweenInstanceMethods(
- systemType, testOutputHelper));
+ systemType));
return parityErrors;
}
public List GetErrorsToStaticType(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
List parityErrors = [];
parityErrors.AddRange(GetParityErrorsBetweenStaticFields(
- systemType, testOutputHelper));
+ systemType));
parityErrors.AddRange(GetParityErrorsBetweenStaticMethods(
- systemType, testOutputHelper));
+ systemType));
return parityErrors;
}
private IEnumerable GetParityErrorsBetweenExtensionMethods(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (MethodInfo method in systemType
.GetMethods(
@@ -116,7 +116,7 @@ private IEnumerable GetParityErrorsBetweenExtensionMethods
continue;
}
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for static method {method.PrintMethod($"{systemType.Name}.", "this ")}");
if (!typeof(TAbstraction)
.ContainsEquivalentExtensionMethod(method))
@@ -128,7 +128,7 @@ private IEnumerable GetParityErrorsBetweenExtensionMethods
private IEnumerable GetParityErrorsBetweenInstanceConstructors<
TAbstractionFactory>(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (ConstructorInfo constructor in systemType
.GetConstructors()
@@ -136,7 +136,7 @@ private IEnumerable GetParityErrorsBetweenInstanceConstructors<
.OrderBy(f => f.Name)
.ThenBy(m => m.GetParameters().Length))
{
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for constructor {constructor.PrintConstructor()}");
if (!typeof(TAbstractionFactory)
.ContainsEquivalentMethod(constructor))
@@ -147,7 +147,7 @@ private IEnumerable GetParityErrorsBetweenInstanceConstructors<
}
private IEnumerable GetParityErrorsBetweenInstanceMethods(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (MethodInfo method in systemType
.GetMethods(
@@ -160,7 +160,7 @@ private IEnumerable GetParityErrorsBetweenInstanceMethods(
.OrderBy(m => m.Name)
.ThenBy(m => m.GetParameters().Length))
{
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for method {method.PrintMethod($"{systemType.Name}.")}");
if (!typeof(TAbstraction)
.ContainsEquivalentMethod(method))
@@ -171,7 +171,7 @@ private IEnumerable GetParityErrorsBetweenInstanceMethods(
}
private IEnumerable GetParityErrorsBetweenInstanceProperties(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (PropertyInfo property in systemType
.GetProperties(
@@ -183,7 +183,7 @@ private IEnumerable GetParityErrorsBetweenInstanceProperties !p.IsSpecialName)
.OrderBy(p => p.Name))
{
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for property {property.PrintProperty($"{systemType.Name}.")}");
if (!typeof(TAbstraction)
.ContainsEquivalentProperty(property))
@@ -194,7 +194,7 @@ private IEnumerable GetParityErrorsBetweenInstanceProperties GetParityErrorsBetweenStaticFields(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (FieldInfo field in systemType
.GetFields(
@@ -204,7 +204,7 @@ private IEnumerable GetParityErrorsBetweenStaticFields(
.Where(f => !f.IsSpecialName)
.OrderBy(f => f.Name))
{
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for static field {field.PrintField($"{systemType.Name}.")}");
if (!typeof(TAbstraction)
.ContainsEquivalentProperty(field))
@@ -215,7 +215,7 @@ private IEnumerable GetParityErrorsBetweenStaticFields(
}
private IEnumerable GetParityErrorsBetweenStaticMethods(
- Type systemType, ITestOutputHelper testOutputHelper)
+ Type systemType)
{
foreach (MethodInfo method in systemType
.GetMethods(
@@ -226,7 +226,7 @@ private IEnumerable GetParityErrorsBetweenStaticMethods(
.OrderBy(f => f.Name)
.ThenBy(m => m.GetParameters().Length))
{
- testOutputHelper.WriteLine(
+ Console.WriteLine(
$"Check parity for static method {method.PrintMethod($"{systemType.Name}.")}");
if (!typeof(TAbstraction)
.ContainsEquivalentMethod(method))
diff --git a/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/Usings.cs b/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/Usings.cs
index d94e613d6..eea765a00 100644
--- a/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/Usings.cs
+++ b/Tests/Testably.Abstractions.Parity.Tests/TestHelpers/Usings.cs
@@ -1,5 +1,5 @@
global using System;
global using System.IO.Abstractions;
-global using Xunit;
+global using TUnit;
global using aweXpect;
global using static aweXpect.Expect;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/AwaitableCallbackExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/AwaitableCallbackExtensionsTests.cs
index cfd49ebc5..04d4f10eb 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/AwaitableCallbackExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/AwaitableCallbackExtensionsTests.cs
@@ -10,8 +10,8 @@ public class AwaitableCallbackExtensionsTests
#if NET6_0_OR_GREATER
public sealed class ToAsyncEnumerableTests
{
- [Fact]
- public async Task ShouldReturnAllEvents()
+ [Test]
+ public async Task ShouldReturnAllEvents(CancellationToken cancellationToken)
{
MockFileSystem fileSystem = new();
IAwaitableCallback sut = fileSystem.Notify.OnEvent();
@@ -22,9 +22,9 @@ public async Task ShouldReturnAllEvents()
fileSystem.Directory.Delete("Test");
ChangeDescription[] results = await sut
- .ToAsyncEnumerable(cancellationToken: TestContext.Current.CancellationToken)
+ .ToAsyncEnumerable(cancellationToken: cancellationToken)
.Take(6)
- .ToArrayAsync(cancellationToken: TestContext.Current.CancellationToken);
+ .ToArrayAsync(cancellationToken: cancellationToken);
await That(results[0]).IsEquivalentTo(new
{
@@ -52,8 +52,8 @@ await That(results[5]).IsEquivalentTo(new
});
}
- [Fact]
- public async Task WithCancelledToken_ShouldAbort()
+ [Test]
+ public async Task WithCancelledToken_ShouldAbort(CancellationToken cancellationToken)
{
MockFileSystem fileSystem = new();
IAwaitableCallback sut = fileSystem.Notify
@@ -66,24 +66,24 @@ public async Task WithCancelledToken_ShouldAbort()
for (int i = 0; i < 10; i++)
{
fileSystem.Directory.CreateDirectory($"Test{i}");
- await Task.Delay(100, TestContext.Current.CancellationToken);
+ await Task.Delay(100, cancellationToken);
if (i == 5)
{
// ReSharper disable once AccessToDisposedClosure
cts.Cancel();
}
}
- }, TestContext.Current.CancellationToken);
+ }, cancellationToken);
ChangeDescription[] results = await sut.ToAsyncEnumerable(cancellationToken: token)
.Take(10)
- .ToArrayAsync(cancellationToken: TestContext.Current.CancellationToken);
+ .ToArrayAsync(cancellationToken: cancellationToken);
await That(results.Length).IsEqualTo(6);
}
- [Fact]
- public async Task WithFilter_ShouldOnlyReturnMatchingEvents()
+ [Test]
+ public async Task WithFilter_ShouldOnlyReturnMatchingEvents(CancellationToken cancellationToken)
{
MockFileSystem fileSystem = new();
IAwaitableCallback sut = fileSystem.Notify
@@ -95,9 +95,9 @@ public async Task WithFilter_ShouldOnlyReturnMatchingEvents()
fileSystem.Directory.Delete("Test");
ChangeDescription[] results = await sut
- .ToAsyncEnumerable(cancellationToken: TestContext.Current.CancellationToken)
+ .ToAsyncEnumerable(cancellationToken: cancellationToken)
.Take(2)
- .ToArrayAsync(cancellationToken: TestContext.Current.CancellationToken);
+ .ToArrayAsync(cancellationToken: cancellationToken);
await That(results[0]).IsEquivalentTo(new
{
@@ -113,8 +113,8 @@ await That(results[1]).IsEquivalentTo(new
});
}
- [Fact]
- public async Task WithIntTimeout_ShouldAbortAfterwards()
+ [Test]
+ public async Task WithIntTimeout_ShouldAbortAfterwards(CancellationToken cancellationToken)
{
MockFileSystem fileSystem = new();
IAwaitableCallback sut = fileSystem.Notify
@@ -125,20 +125,20 @@ public async Task WithIntTimeout_ShouldAbortAfterwards()
for (int i = 0; i < 10; i++)
{
fileSystem.Directory.CreateDirectory($"Test{i}");
- await Task.Delay(100, TestContext.Current.CancellationToken);
+ await Task.Delay(100, cancellationToken);
}
- }, TestContext.Current.CancellationToken);
+ }, cancellationToken);
ChangeDescription[] results = await sut
- .ToAsyncEnumerable(150, cancellationToken: TestContext.Current.CancellationToken)
+ .ToAsyncEnumerable(150, cancellationToken: cancellationToken)
.Take(10)
- .ToArrayAsync(cancellationToken: TestContext.Current.CancellationToken);
+ .ToArrayAsync(cancellationToken: cancellationToken);
await That(results.Length).IsLessThan(9);
}
- [Fact]
- public async Task WithTimeout_ShouldAbortAfterwards()
+ [Test]
+ public async Task WithTimeout_ShouldAbortAfterwards(CancellationToken cancellationToken)
{
MockFileSystem fileSystem = new();
IAwaitableCallback sut = fileSystem.Notify
@@ -149,15 +149,15 @@ public async Task WithTimeout_ShouldAbortAfterwards()
for (int i = 0; i < 10; i++)
{
fileSystem.Directory.CreateDirectory($"Test{i}");
- await Task.Delay(100, TestContext.Current.CancellationToken);
+ await Task.Delay(100, cancellationToken);
}
- }, TestContext.Current.CancellationToken);
+ }, cancellationToken);
ChangeDescription[] results = await sut
.ToAsyncEnumerable(TimeSpan.FromMilliseconds(150),
- cancellationToken: TestContext.Current.CancellationToken)
+ cancellationToken: cancellationToken)
.Take(10)
- .ToArrayAsync(cancellationToken: TestContext.Current.CancellationToken);
+ .ToArrayAsync(cancellationToken: cancellationToken);
await That(results.Length).IsLessThan(9);
}
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeDescriptionTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeDescriptionTests.cs
index 5c1a06061..d7bc03623 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeDescriptionTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeDescriptionTests.cs
@@ -6,8 +6,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystem;
public class ChangeDescriptionTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldIncludeChangeType(
WatcherChangeTypes changeType,
FileSystemTypes fileSystemType,
@@ -28,8 +28,8 @@ public async Task ToString_ShouldIncludeChangeType(
await That(result).Contains(changeType.ToString());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldIncludeFileSystemType(
WatcherChangeTypes changeType,
FileSystemTypes fileSystemType,
@@ -50,8 +50,8 @@ public async Task ToString_ShouldIncludeFileSystemType(
await That(result).Contains(fileSystemType.ToString());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldIncludeNotifyFilters(
WatcherChangeTypes changeType,
FileSystemTypes fileSystemType,
@@ -72,8 +72,8 @@ public async Task ToString_ShouldIncludeNotifyFilters(
await That(result).Contains(notifyFilters.ToString());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldIncludePath(
WatcherChangeTypes changeType,
FileSystemTypes fileSystemType,
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeHandlerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeHandlerTests.cs
index 4d7751778..1fdaf2a61 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeHandlerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/ChangeHandlerTests.cs
@@ -1,10 +1,11 @@
using aweXpect.Synchronous;
+using System.Collections.Generic;
using System.IO;
using Testably.Abstractions.Testing.FileSystem;
namespace Testably.Abstractions.Testing.Tests.FileSystem;
-public class ChangeHandlerTests(ITestOutputHelper testOutputHelper)
+public class ChangeHandlerTests
{
#region Test Setup
@@ -12,8 +13,8 @@ public class ChangeHandlerTests(ITestOutputHelper testOutputHelper)
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_CustomException_ShouldNotCreateDirectory(
string path, Exception exceptionToThrow)
{
@@ -31,8 +32,8 @@ public async Task CreateDirectory_CustomException_ShouldNotCreateDirectory(
await That(exception).IsEqualTo(exceptionToThrow);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_CustomException_ShouldOnlyTriggerChangeOccurring(
string path, Exception exceptionToThrow)
{
@@ -47,8 +48,8 @@ public async Task CreateDirectory_CustomException_ShouldOnlyTriggerChangeOccurri
await That(receivedPath!).IsNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
CreateDirectory_WithParentDirectories_ShouldTriggerNotificationForEachDirectory(
string path1, string path2, string path3)
@@ -60,7 +61,7 @@ public async Task
using IAwaitableCallback onEvent = FileSystem.Notify
.OnEvent(c =>
{
- testOutputHelper.WriteLine($"Received event {c}");
+ Console.WriteLine($"Received event {c}");
eventCount++;
},
c => c.ChangeType == WatcherChangeTypes.Created);
@@ -71,8 +72,8 @@ public async Task
await That(eventCount).IsEqualTo(3);
}
- [Theory]
- [MemberData(nameof(NotificationTriggeringMethods))]
+ [Test]
+ [MethodDataSource(nameof(NotificationTriggeringMethods))]
public async Task ExecuteCallback_ShouldTriggerNotification(
Action? initialization,
Action callback,
@@ -96,7 +97,7 @@ public async Task ExecuteCallback_ShouldTriggerNotification(
await That(receivedPath).IsEqualTo(FileSystem.Path.GetFullPath(path));
}
- [Fact]
+ [Test]
public async Task Watcher_ShouldNotTriggerWhenFileSystemWatcherDoesNotMatch()
{
FileSystem.Directory.CreateDirectory("bar");
@@ -114,7 +115,7 @@ void Act() =>
await That(Act).Throws();
}
- [Fact]
+ [Test]
public async Task Watcher_ShouldTriggerWhenFileSystemWatcherSendsNotification()
{
bool isTriggered = false;
@@ -126,7 +127,7 @@ public async Task Watcher_ShouldTriggerWhenFileSystemWatcherSendsNotification()
using IAwaitableCallback onEvent = FileSystem.Watcher.OnTriggered();
FileSystem.File.WriteAllText(@"foo.txt", "some-text");
- onEvent.Wait(timeout: 5000);
+ onEvent.Wait(timeout: 30000);
await That(isTriggered).IsTrue();
}
@@ -134,37 +135,21 @@ public async Task Watcher_ShouldTriggerWhenFileSystemWatcherSendsNotification()
#region Helpers
public static
- TheoryData<
+ IEnumerable<(
Action?,
Action,
WatcherChangeTypes,
FileSystemTypes,
- string> NotificationTriggeringMethods()
+ string)> NotificationTriggeringMethods()
{
- return new TheoryData<
- Action?,
- Action,
- WatcherChangeTypes,
- FileSystemTypes,
- string>
- {
- {
- null, (f, p) => f.Directory.CreateDirectory(p), WatcherChangeTypes.Created,
- FileSystemTypes.Directory, $"path_{Guid.NewGuid()}"
- },
- {
- (f, p) => f.Directory.CreateDirectory(p), (f, p) => f.Directory.Delete(p),
- WatcherChangeTypes.Deleted, FileSystemTypes.Directory, $"path_{Guid.NewGuid()}"
- },
- {
- null, (f, p) => f.File.WriteAllText(p, null), WatcherChangeTypes.Created,
- FileSystemTypes.File, $"path_{Guid.NewGuid()}"
- },
- {
- (f, p) => f.File.WriteAllText(p, null), (f, p) => f.File.Delete(p),
- WatcherChangeTypes.Deleted, FileSystemTypes.File, $"path_{Guid.NewGuid()}"
- },
- };
+ yield return (null, (f, p) => f.Directory.CreateDirectory(p), WatcherChangeTypes.Created,
+ FileSystemTypes.Directory, $"path_{Guid.NewGuid()}");
+ yield return ((f, p) => f.Directory.CreateDirectory(p), (f, p) => f.Directory.Delete(p),
+ WatcherChangeTypes.Deleted, FileSystemTypes.Directory, $"path_{Guid.NewGuid()}");
+ yield return (null, (f, p) => f.File.WriteAllText(p, null), WatcherChangeTypes.Created,
+ FileSystemTypes.File, $"path_{Guid.NewGuid()}");
+ yield return ((f, p) => f.File.WriteAllText(p, null), (f, p) => f.File.Delete(p),
+ WatcherChangeTypes.Deleted, FileSystemTypes.File, $"path_{Guid.NewGuid()}");
}
#endregion
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultAccessControlStrategyTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultAccessControlStrategyTests.cs
index 37aaff048..7ea23b1cb 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultAccessControlStrategyTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultAccessControlStrategyTests.cs
@@ -11,7 +11,7 @@ public class DefaultAccessControlStrategyTests
#endregion
- [Fact]
+ [Test]
public async Task Constructor_NullCallback_ShouldThrowArgumentNullException()
{
void Act()
@@ -22,7 +22,7 @@ void Act()
await That(Act).ThrowsExactly().WithParamName("callback");
}
- [Fact]
+ [Test]
public async Task IsAccessGranted_ShouldUseCallback()
{
DefaultAccessControlStrategy sut = new((p, _) => p.StartsWith('a'));
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultSafeFileHandleStrategyTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultSafeFileHandleStrategyTests.cs
index 189f7ea29..956dd89ad 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultSafeFileHandleStrategyTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DefaultSafeFileHandleStrategyTests.cs
@@ -13,7 +13,7 @@ public class DefaultSafeFileHandleStrategyTests
#endregion
- [Fact]
+ [Test]
public async Task Constructor_NullCallback_ShouldThrowArgumentNullException()
{
void Act()
@@ -24,7 +24,7 @@ void Act()
await That(Act).ThrowsExactly().WithParamName("callback");
}
- [Fact]
+ [Test]
public async Task MapSafeFileHandle_ShouldReturnExpectedValue()
{
SafeFileHandle fooSafeFileHandle = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DirectoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DirectoryMockTests.cs
index 9e8fcf62f..63140d62c 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DirectoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DirectoryMockTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.FileSystem;
public class DirectoryMockTests
{
- [Fact]
+ [Test]
public async Task
EnumerateDirectories_UnauthorizedParentAccess_ShouldThrowUnauthorizedAccessExceptionImmediately()
{
@@ -25,7 +25,7 @@ await That(Act).Throws()
.WithHResult(-2147024891);
}
- [Fact]
+ [Test]
public async Task
EnumerateFiles_UnauthorizedParentAccess_ShouldThrowUnauthorizedAccessExceptionImmediately()
{
@@ -46,7 +46,7 @@ await That(Act).Throws()
.WithHResult(-2147024891);
}
- [Fact]
+ [Test]
public async Task
EnumerateFileSystemEntries_UnauthorizedParentAccess_ShouldThrowUnauthorizedAccessExceptionImmediately()
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DriveInfoMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DriveInfoMockTests.cs
index 74b468087..dd1c8c967 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DriveInfoMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/DriveInfoMockTests.cs
@@ -12,8 +12,8 @@ public class DriveInfoMockTests
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_CannotGetNegative(long size)
{
FileSystem.WithDrive(d => d.SetTotalSize(size));
@@ -24,8 +24,8 @@ public async Task AvailableFreeSpace_CannotGetNegative(long size)
await That(drive.AvailableFreeSpace).IsEqualTo(size);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_NotEnoughSpace_ShouldThrowIOException(
int fileSize, string path)
{
@@ -41,8 +41,8 @@ void Act()
await That(drive.AvailableFreeSpace).IsEqualTo(fileSize - 1);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_ShouldBeChangedWhenAppendingToAFile(
string fileContent1, string fileContent2, int expectedRemainingBytes,
string path, Encoding encoding)
@@ -60,10 +60,10 @@ public async Task AvailableFreeSpace_ShouldBeChangedWhenAppendingToAFile(
await That(drive.AvailableFreeSpace).IsEqualTo(expectedRemainingBytes);
}
- [Theory]
- [InlineAutoData(0)]
- [InlineAutoData(1)]
- [InlineAutoData(10)]
+ [Test]
+ [AutoArguments(0)]
+ [AutoArguments(1)]
+ [AutoArguments(10)]
public async Task AvailableFreeSpace_ShouldBeChangedWhenWorkingWithStreams(
int reduceLength, string path, string previousContent)
{
@@ -81,8 +81,8 @@ public async Task AvailableFreeSpace_ShouldBeChangedWhenWorkingWithStreams(
await That(drive.AvailableFreeSpace).IsEqualTo(previousFreeSpace + reduceLength);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_ShouldBeReducedByWritingToFile(
int fileSize, string path)
{
@@ -97,8 +97,8 @@ public async Task AvailableFreeSpace_ShouldBeReducedByWritingToFile(
await That(drive.AvailableFreeSpace).IsEqualTo(0);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_ShouldBeReleasedWhenDeletingAFile(
int fileSize, string path)
{
@@ -114,8 +114,8 @@ public async Task AvailableFreeSpace_ShouldBeReleasedWhenDeletingAFile(
await That(drive.AvailableFreeSpace).IsEqualTo(fileSize);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AvailableFreeSpace_ShouldBeSetTotalSize(long size)
{
FileSystem.WithDrive(d => d.SetTotalSize(size));
@@ -125,10 +125,10 @@ public async Task AvailableFreeSpace_ShouldBeSetTotalSize(long size)
await That(drive.AvailableFreeSpace).IsEqualTo(size);
}
- [Theory]
- [InlineData(@"//foo", @"//foo")]
- [InlineData(@"//foo/bar", @"//foo")]
- [InlineData(@"//foo/bar/xyz", @"//foo")]
+ [Test]
+ [Arguments(@"//foo", @"//foo")]
+ [Arguments(@"//foo/bar", @"//foo")]
+ [Arguments(@"//foo/bar/xyz", @"//foo")]
public async Task New_DriveNameWithUncPath_ShouldUseTopMostDirectory(
string driveName, string expectedName)
{
@@ -141,8 +141,8 @@ public async Task New_DriveNameWithUncPath_ShouldUseTopMostDirectory(
await That(drive.Name).IsEqualTo(expectedName);
}
- [Theory]
- [InlineData("foo")]
+ [Test]
+ [Arguments("foo")]
public async Task New_InvalidDriveName_ShouldThrowArgumentException(string driveName)
{
Exception? exception = Record.Exception(() =>
@@ -153,7 +153,7 @@ public async Task New_InvalidDriveName_ShouldThrowArgumentException(string drive
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task New_Null_ShouldReturnNull()
{
IDriveInfo? drive =
@@ -162,7 +162,7 @@ public async Task New_Null_ShouldReturnNull()
await That(drive).IsNull();
}
- [Fact]
+ [Test]
public async Task New_UncPath_ShouldSetFlag()
{
IDriveInfo drive =
@@ -171,9 +171,9 @@ public async Task New_UncPath_ShouldSetFlag()
await That((drive as DriveInfoMock)?.IsUncPath).IsTrue();
}
- [Theory]
- [InlineData("C", "C:\\")]
- [InlineData("d", "D:\\")]
+ [Test]
+ [Arguments("C", "C:\\")]
+ [Arguments("d", "D:\\")]
public async Task New_ValidDriveName_ShouldAppendColonAndSlash(
string driveName, string expectedDriveName)
{
@@ -183,8 +183,8 @@ public async Task New_ValidDriveName_ShouldAppendColonAndSlash(
await That(result.Name).IsEqualTo(expectedDriveName);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NotReady_AccessDirectory_ShouldThrowIOException(
string path)
{
@@ -198,8 +198,8 @@ public async Task NotReady_AccessDirectory_ShouldThrowIOException(
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NotReady_AccessFile_ShouldThrowIOException(
string path, string contents)
{
@@ -214,7 +214,7 @@ public async Task NotReady_AccessFile_ShouldThrowIOException(
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task SetDriveFormat_Default_ShouldBeNTFS()
{
FileSystem.WithDrive(d => d.SetDriveFormat());
@@ -223,8 +223,8 @@ public async Task SetDriveFormat_Default_ShouldBeNTFS()
await That(drive.DriveFormat).IsEqualTo("NTFS");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetDriveFormat_ShouldChangeDriveFormat(string driveFormat)
{
FileSystem.WithDrive(d => d.SetDriveFormat(driveFormat));
@@ -233,7 +233,7 @@ public async Task SetDriveFormat_ShouldChangeDriveFormat(string driveFormat)
await That(drive.DriveFormat).IsEqualTo(driveFormat);
}
- [Fact]
+ [Test]
public async Task SetDriveType_Default_ShouldBeFixed()
{
FileSystem.WithDrive(d => d.SetDriveType());
@@ -242,8 +242,8 @@ public async Task SetDriveType_Default_ShouldBeFixed()
await That(drive.DriveType).IsEqualTo(DriveType.Fixed);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetDriveType_ShouldChangeDriveType(DriveType driveType)
{
FileSystem.WithDrive(d => d.SetDriveType(driveType));
@@ -252,9 +252,9 @@ public async Task SetDriveType_ShouldChangeDriveType(DriveType driveType)
await That(drive.DriveType).IsEqualTo(driveType);
}
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
+ [Test]
+ [Arguments(true)]
+ [Arguments(false)]
public async Task SetIsReady_ShouldChangeIsReady(bool isReady)
{
FileSystem.WithDrive(d => d.SetIsReady(isReady));
@@ -263,7 +263,7 @@ public async Task SetIsReady_ShouldChangeIsReady(bool isReady)
await That(drive.IsReady).IsEqualTo(isReady);
}
- [Fact]
+ [Test]
public async Task SetTotalSize_Default_ShouldBe1Gigabyte()
{
FileSystem.WithDrive(d => d.SetTotalSize());
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileMockTests.cs
index a4b10f6b1..62b92215b 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileMockTests.cs
@@ -10,8 +10,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystem;
public class FileMockTests
{
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetAttributes_SafeFileHandle_WithMissingFile_ShouldThrowFileNotFoundException(
string path)
{
@@ -29,8 +29,8 @@ public async Task GetAttributes_SafeFileHandle_WithMissingFile_ShouldThrowFileNo
}
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupportedExceptionOnWindows(
string path)
{
@@ -54,8 +54,8 @@ public async Task GetUnixFileMode_SafeFileHandle_ShouldThrowPlatformNotSupported
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetAttributes_SafeFileHandle_ShouldUpdateValue(
string path, FileAttributes attributes)
{
@@ -75,8 +75,8 @@ public async Task SetAttributes_SafeFileHandle_ShouldUpdateValue(
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetCreationTime(string path, DateTime creationTime)
{
MockFileSystem fileSystem = new();
@@ -88,8 +88,8 @@ public async Task SetCreationTime(string path, DateTime creationTime)
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetCreationTime_SafeFileHandle_ShouldUpdateValue(
string path, DateTime creationTime)
{
@@ -107,8 +107,8 @@ public async Task SetCreationTime_SafeFileHandle_ShouldUpdateValue(
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetCreationTimeUtc(string path, DateTime creationTime)
{
MockFileSystem fileSystem = new();
@@ -120,8 +120,8 @@ public async Task SetCreationTimeUtc(string path, DateTime creationTime)
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetCreationTimeUtc_SafeFileHandle_ShouldUpdateValue(
string path, DateTime creationTimeUtc)
{
@@ -140,8 +140,8 @@ public async Task SetCreationTimeUtc_SafeFileHandle_ShouldUpdateValue(
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetLastAccessTime_SafeFileHandle_ShouldUpdateValue(
string path, DateTime lastAccessTime)
{
@@ -160,8 +160,8 @@ public async Task SetLastAccessTime_SafeFileHandle_ShouldUpdateValue(
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetLastAccessTimeUtc_SafeFileHandle_ShouldUpdateValue(
string path, DateTime lastAccessTimeUtc)
{
@@ -180,8 +180,8 @@ public async Task SetLastAccessTimeUtc_SafeFileHandle_ShouldUpdateValue(
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetLastWriteTime_SafeFileHandle_ShouldUpdateValue(
string path, DateTime lastWriteTime)
{
@@ -200,8 +200,8 @@ public async Task SetLastWriteTime_SafeFileHandle_ShouldUpdateValue(
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetLastWriteTimeUtc_SafeFileHandle_ShouldUpdateValue(
string path, DateTime lastWriteTimeUtc)
{
@@ -220,8 +220,8 @@ public async Task SetLastWriteTimeUtc_SafeFileHandle_ShouldUpdateValue(
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetUnixFileMode_SafeFileHandle_ShouldUpdateValue(
string path, UnixFileMode mode)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.SafeFileHandle.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.SafeFileHandle.cs
index dba2dcd33..db4e47f4f 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.SafeFileHandle.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.SafeFileHandle.cs
@@ -8,8 +8,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystem;
public sealed partial class FileStreamFactoryMockTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public void MissingFile_ShouldThrowFileNotFoundException(
string path, string contents)
{
@@ -33,8 +33,8 @@ public void MissingFile_ShouldThrowFileNotFoundException(
.Which.Message.Should().Contain($"'{MockFileSystem.Path.GetFullPath(path)}'");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public void UnregisteredFileHandle_ShouldThrowNotSupportedException(
string path, string contents)
{
@@ -55,8 +55,8 @@ public void UnregisteredFileHandle_ShouldThrowNotSupportedException(
nameof(MockFileSystem.WithSafeFileHandleStrategy));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public void UnregisteredFileHandle_WithBufferSize_ShouldThrowNotSupportedException(
string path, string contents, int bufferSize)
{
@@ -77,8 +77,8 @@ public void UnregisteredFileHandle_WithBufferSize_ShouldThrowNotSupportedExcepti
nameof(MockFileSystem.WithSafeFileHandleStrategy));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public void
UnregisteredFileHandle_WithBufferSizeAndIsAsync_ShouldThrowNotSupportedException(
string path, string contents, int bufferSize, bool isAsync)
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.cs
index 927d54d05..a7354a34f 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileStreamFactoryMockTests.cs
@@ -4,7 +4,7 @@
namespace Testably.Abstractions.Testing.Tests.FileSystem;
-[Collection(nameof(IDirectoryCleaner))]
+[NotInParallel(nameof(IDirectoryCleaner))]
public sealed class FileStreamFactoryMockTests : IDisposable
{
#region Test Setup
@@ -28,8 +28,8 @@ public void Dispose()
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Wrap_ShouldThrowNotSupportedException(
string path, string contents)
{
@@ -46,11 +46,11 @@ public async Task Wrap_ShouldThrowNotSupportedException(
}
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Theory]
- [InlineAutoData(FileMode.CreateNew)]
- [InlineAutoData(FileMode.Create)]
- [InlineAutoData(FileMode.OpenOrCreate)]
- [InlineAutoData(FileMode.Append)]
+ [Test]
+ [AutoArguments(FileMode.CreateNew)]
+ [AutoArguments(FileMode.Create)]
+ [AutoArguments(FileMode.OpenOrCreate)]
+ [AutoArguments(FileMode.Append)]
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility",
Justification = "Skip.If(Test.RunsOnWindows) handles platform check.")]
public async Task New_ShouldSetUnixFileMode(FileMode mode, string path)
@@ -70,9 +70,9 @@ public async Task New_ShouldSetUnixFileMode(FileMode mode, string path)
await That(result).IsEqualTo(options.UnixCreateMode);
}
- [Theory]
- [InlineAutoData(FileMode.Open)]
- [InlineAutoData(FileMode.Truncate)]
+ [Test]
+ [AutoArguments(FileMode.Open)]
+ [AutoArguments(FileMode.Truncate)]
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility",
Justification = "Skip.If(Test.RunsOnWindows) handles platform check.")]
public async Task New_ShouldThrowArgumentException_When_InvalidFileMode(FileMode mode,
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemExtensibilityTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemExtensibilityTests.cs
index b794592e7..6453861a1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemExtensibilityTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemExtensibilityTests.cs
@@ -1,20 +1,17 @@
+using System.Collections.Generic;
+
namespace Testably.Abstractions.Testing.Tests.FileSystem;
public class FileSystemExtensibilityTests
{
- #region Test Setup
-
- public static TheoryData GetFileSystems
- => new()
- {
- (IFileSystem)new RealFileSystem(),
- (IFileSystem)new MockFileSystem(),
- };
-
- #endregion
+ public static IEnumerable> GetFileSystems()
+ {
+ yield return () => new RealFileSystem();
+ yield return () => new MockFileSystem();
+ }
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task Directory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IDirectory sut = fileSystem.Directory;
@@ -24,8 +21,8 @@ public async Task Directory_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task DirectoryInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IDirectoryInfo sut = fileSystem.DirectoryInfo.New("foo");
@@ -35,8 +32,8 @@ public async Task DirectoryInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task DirectoryInfoFactory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IDirectoryInfoFactory sut = fileSystem.DirectoryInfo;
@@ -46,8 +43,8 @@ public async Task DirectoryInfoFactory_ShouldSetExtensionPoint(IFileSystem fileS
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task DriveInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IDriveInfo sut = fileSystem.DriveInfo.GetDrives()[0];
@@ -57,8 +54,8 @@ public async Task DriveInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task DriveInfoFactory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IDriveInfoFactory sut = fileSystem.DriveInfo;
@@ -68,8 +65,8 @@ public async Task DriveInfoFactory_ShouldSetExtensionPoint(IFileSystem fileSyste
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task File_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFile sut = fileSystem.File;
@@ -79,8 +76,8 @@ public async Task File_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileInfo sut = fileSystem.FileInfo.New("foo");
@@ -90,8 +87,8 @@ public async Task FileInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileInfoFactory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileInfoFactory sut = fileSystem.FileInfo;
@@ -101,8 +98,8 @@ public async Task FileInfoFactory_ShouldSetExtensionPoint(IFileSystem fileSystem
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileStreamFactory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileStreamFactory sut = fileSystem.FileStream;
@@ -112,8 +109,8 @@ public async Task FileStreamFactory_ShouldSetExtensionPoint(IFileSystem fileSyst
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileSystemInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileSystemInfo sut = fileSystem.FileInfo.New("foo");
@@ -123,8 +120,8 @@ public async Task FileSystemInfo_ShouldSetExtensionPoint(IFileSystem fileSystem)
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileSystemWatcher_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileSystemWatcher sut = fileSystem.FileSystemWatcher.New();
@@ -134,8 +131,8 @@ public async Task FileSystemWatcher_ShouldSetExtensionPoint(IFileSystem fileSyst
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task FileSystemWatcherFactory_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IFileSystemWatcherFactory sut = fileSystem.FileSystemWatcher;
@@ -145,8 +142,8 @@ public async Task FileSystemWatcherFactory_ShouldSetExtensionPoint(IFileSystem f
await That(result).IsSameAs(fileSystem);
}
- [Theory]
- [MemberData(nameof(GetFileSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetFileSystems))]
public async Task Path_ShouldSetExtensionPoint(IFileSystem fileSystem)
{
IPath sut = fileSystem.Path;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherFactoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherFactoryMockTests.cs
index 0a09f884c..19bcdc603 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherFactoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherFactoryMockTests.cs
@@ -3,7 +3,7 @@
namespace Testably.Abstractions.Testing.Tests.FileSystem;
-[Collection(nameof(IDirectoryCleaner))]
+[NotInParallel(nameof(IDirectoryCleaner))]
public sealed class FileSystemWatcherFactoryMockTests : IDisposable
{
#region Test Setup
@@ -29,8 +29,8 @@ public void Dispose()
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Wrap_ShouldUsePropertiesFromFileSystemWatcher(
string path, bool includeSubdirectories, NotifyFilters notifyFilter,
int internalBufferSize, bool enableRaisingEvents, string filter)
@@ -56,8 +56,8 @@ public async Task Wrap_ShouldUsePropertiesFromFileSystemWatcher(
}
#if FEATURE_FILESYSTEMWATCHER_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Wrap_WithFilters_ShouldUsePropertiesFromFileSystemWatcher(
string[] filters)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherMockTests.cs
index d49e81997..f2849da84 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileSystemWatcherMockTests.cs
@@ -4,7 +4,7 @@
namespace Testably.Abstractions.Testing.Tests.FileSystem;
-[Collection(nameof(IDirectoryCleaner))]
+[NotInParallel(nameof(IDirectoryCleaner))]
public sealed class FileSystemWatcherMockTests : IDisposable
{
#region Test Setup
@@ -32,8 +32,8 @@ public void Dispose()
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Error_DefaultTo64Messages_ShouldBeTriggeredWhenBufferOverflows(
string path)
{
@@ -63,7 +63,7 @@ public async Task Error_DefaultTo64Messages_ShouldBeTriggeredWhenBufferOverflows
// ReSharper disable once AccessToDisposedClosure
try
{
- block1.Wait(10000, TestContext.Current.CancellationToken);
+ block1.Wait(10000, TestContext.Current!.Execution.CancellationToken);
}
catch (ObjectDisposedException)
{
@@ -82,14 +82,14 @@ public async Task Error_DefaultTo64Messages_ShouldBeTriggeredWhenBufferOverflows
FileSystem.Directory.CreateDirectory($"{i}_{path}");
}
- await That(block2.Wait(10000, TestContext.Current.CancellationToken)).IsTrue();
+ await That(block2.Wait(10000, TestContext.Current!.Execution.CancellationToken)).IsTrue();
await That(result).IsNotNull();
await That(result!.GetException()).IsExactly();
}
- [Theory]
- [InlineAutoData(4096)]
- [InlineAutoData(8192)]
+ [Test]
+ [AutoArguments(4096)]
+ [AutoArguments(8192)]
public async Task Error_ShouldBeTriggeredWhenBufferOverflows(
int internalBufferSize, string path)
{
@@ -120,7 +120,7 @@ public async Task Error_ShouldBeTriggeredWhenBufferOverflows(
// ReSharper disable once AccessToDisposedClosure
try
{
- block1.Wait(5000, TestContext.Current.CancellationToken);
+ block1.Wait(30000, TestContext.Current!.Execution.CancellationToken);
}
catch (ObjectDisposedException)
{
@@ -140,14 +140,14 @@ public async Task Error_ShouldBeTriggeredWhenBufferOverflows(
FileSystem.Directory.CreateDirectory($"{i}_{path}");
}
- await That(block2.Wait(5000, TestContext.Current.CancellationToken)).IsTrue();
+ await That(block2.Wait(30000, TestContext.Current!.Execution.CancellationToken)).IsTrue();
await That(result).IsNotNull();
await That(result!.GetException()).IsExactly();
}
#if FEATURE_FILESYSTEMWATCHER_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Filter_ShouldResetFiltersToOnlyContainASingleValue(
string[] filters, string expectedFilter)
{
@@ -168,8 +168,8 @@ public async Task Filter_ShouldResetFiltersToOnlyContainASingleValue(
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task InternalBufferSize_ShouldResetQueue(string path1, string path2)
{
Skip.If(true, "Brittle test fails on build system (disabled in #284)");
@@ -199,7 +199,7 @@ public async Task InternalBufferSize_ShouldResetQueue(string path1, string path2
// ReSharper disable once AccessToDisposedClosure
try
{
- block1.Wait(100, TestContext.Current.CancellationToken);
+ block1.Wait(100, TestContext.Current!.Execution.CancellationToken);
}
catch (ObjectDisposedException)
{
@@ -230,17 +230,17 @@ public async Task InternalBufferSize_ShouldResetQueue(string path1, string path2
FileSystem.Directory.CreateDirectory($"{i}_{path2}");
}
- await That(block2.Wait(100, TestContext.Current.CancellationToken)).IsFalse();
+ await That(block2.Wait(100, TestContext.Current!.Execution.CancellationToken)).IsFalse();
await That(result).IsNull();
}
#if CAN_SIMULATE_OTHER_OS
public sealed class EventArgsTests
{
- [Theory]
- [InlineAutoData(SimulationMode.Linux)]
- [InlineAutoData(SimulationMode.MacOS)]
- [InlineAutoData(SimulationMode.Windows)]
+ [Test]
+ [AutoArguments(SimulationMode.Linux)]
+ [AutoArguments(SimulationMode.MacOS)]
+ [AutoArguments(SimulationMode.Windows)]
public async Task FileSystemEventArgs_ShouldUseDirectorySeparatorFromSimulatedFileSystem(
SimulationMode simulationMode, string parentDirectory, string directoryName)
{
@@ -269,7 +269,7 @@ public async Task FileSystemEventArgs_ShouldUseDirectorySeparatorFromSimulatedFi
fileSystemWatcher.NotifyFilter = NotifyFilters.DirectoryName;
fileSystemWatcher.EnableRaisingEvents = true;
fileSystem.Directory.CreateDirectory(expectedFullPath);
- ms.Wait(5000, TestContext.Current.CancellationToken);
+ ms.Wait(30000, TestContext.Current!.Execution.CancellationToken);
await That(result).IsNotNull();
await That(result!.FullPath).IsEqualTo(expectedFullPath);
@@ -279,10 +279,10 @@ public async Task FileSystemEventArgs_ShouldUseDirectorySeparatorFromSimulatedFi
#endif
#if CAN_SIMULATE_OTHER_OS
- [Theory]
- [InlineAutoData(SimulationMode.Linux)]
- [InlineAutoData(SimulationMode.MacOS)]
- [InlineAutoData(SimulationMode.Windows)]
+ [Test]
+ [AutoArguments(SimulationMode.Linux)]
+ [AutoArguments(SimulationMode.MacOS)]
+ [AutoArguments(SimulationMode.Windows)]
public async Task RenamedEventArgs_ShouldUseDirectorySeparatorFromSimulatedFileSystem(
SimulationMode simulationMode, string parentDirectory,
string sourceName, string destinationName)
@@ -316,7 +316,7 @@ public async Task RenamedEventArgs_ShouldUseDirectorySeparatorFromSimulatedFileS
fileSystemWatcher.NotifyFilter = NotifyFilters.FileName;
fileSystemWatcher.EnableRaisingEvents = true;
fileSystem.File.Move(expectedOldFullPath, expectedFullPath);
- ms.Wait(5000, TestContext.Current.CancellationToken);
+ ms.Wait(30000, TestContext.Current!.Execution.CancellationToken);
await That(result).IsNotNull();
await That(result!.FullPath).IsEqualTo(expectedFullPath);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileVersionInfoFactoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileVersionInfoFactoryMockTests.cs
index 4e5a9a364..4af16d18c 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileVersionInfoFactoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/FileVersionInfoFactoryMockTests.cs
@@ -2,14 +2,14 @@
public sealed class FileVersionInfoFactoryMockTests
{
- [Theory]
- [InlineData(".", "foo", "*", true)]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "*", true)]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task ShouldSupportGlobPattern(
string baseDirectory, string fileName, string globPattern, bool expectMatch)
{
@@ -25,8 +25,8 @@ public async Task ShouldSupportGlobPattern(
await That(result.Comments).IsEqualTo(expected);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WhenRegistered_ShouldReturnFileVersionInfoWithRegisteredValues(
string comments)
{
@@ -39,8 +39,8 @@ public async Task WhenRegistered_ShouldReturnFileVersionInfoWithRegisteredValues
await That(result.Comments).IsEqualTo(comments);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WhenRegisteredUnderDifferentName_ShouldReturnDefaultValues(
string comments)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/PathMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/PathMockTests.cs
index 986309f35..46a0bae6a 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystem/PathMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystem/PathMockTests.cs
@@ -5,11 +5,11 @@ namespace Testably.Abstractions.Testing.Tests.FileSystem;
public sealed class PathMockTests
{
#if CAN_SIMULATE_OTHER_OS
- [Theory]
- [InlineAutoData(SimulationMode.Native)]
- [InlineAutoData(SimulationMode.Linux)]
- [InlineAutoData(SimulationMode.MacOS)]
- [InlineAutoData(SimulationMode.Windows)]
+ [Test]
+ [AutoArguments(SimulationMode.Native)]
+ [AutoArguments(SimulationMode.Linux)]
+ [AutoArguments(SimulationMode.MacOS)]
+ [AutoArguments(SimulationMode.Windows)]
public async Task GetTempFileName_WithCollisions_ShouldThrowIOException(
SimulationMode simulationMode, int fixedRandomValue)
{
@@ -31,8 +31,8 @@ void Act()
await That(fileSystem.File.Exists(result)).IsTrue();
}
#else
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetTempFileName_WithCollisions_ShouldThrowIOException(
int fixedRandomValue)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryCleanerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryCleanerTests.cs
index 2f4da4ac9..9839cbc07 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryCleanerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryCleanerTests.cs
@@ -5,7 +5,7 @@
namespace Testably.Abstractions.Testing.Tests.FileSystemInitializer;
-[Collection(nameof(IDirectoryCleaner))]
+[NotInParallel(nameof(IDirectoryCleaner))]
public class DirectoryCleanerTests
{
#region Test Setup
@@ -17,8 +17,8 @@ public DirectoryCleanerTests()
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Dispose_PermanentFailure_ShouldNotThrowException(
Exception exception)
{
@@ -56,7 +56,7 @@ await That(receivedLogs).Contains(m =>
await That(receivedLogs).DoesNotContain("Cleanup was successful :-)");
}
- [Fact]
+ [Test]
public async Task Dispose_ShouldForceDeleteCurrentDirectory()
{
MockFileSystem sut = new();
@@ -70,7 +70,7 @@ public async Task Dispose_ShouldForceDeleteCurrentDirectory()
await That(receivedLogs).Contains("Cleanup was successful :-)");
}
- [Fact]
+ [Test]
public async Task Dispose_ShouldResetCurrentDirectory()
{
MockFileSystem sut = new();
@@ -81,8 +81,8 @@ public async Task Dispose_ShouldResetCurrentDirectory()
await That(sut.Directory.GetCurrentDirectory()).IsNotEqualTo(currentDirectory);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Dispose_TemporaryFailure_ShouldRetryAgain(
Exception exception)
{
@@ -103,7 +103,7 @@ public async Task Dispose_TemporaryFailure_ShouldRetryAgain(
await That(sut.Directory.Exists(currentDirectory)).IsFalse();
}
- [Fact]
+ [Test]
public async Task InitializeBasePath_ShouldCreateDirectoryAndLogBasePath()
{
MockFileSystem sut = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryDescriptionTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryDescriptionTests.cs
index 0646669d0..05e3d43a0 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryDescriptionTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/DirectoryDescriptionTests.cs
@@ -5,8 +5,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystemInitializer;
public class DirectoryDescriptionTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Children_ShouldBeSortedAlphabetically(string[] childNames)
{
DirectoryDescription sut = new("foo",
@@ -19,7 +19,7 @@ await That(sut.Children.Select(c => c.Name)).IsInAscendingOrder()
.Using(StringComparer.Ordinal);
}
- [Fact]
+ [Test]
public async Task Index_AccessToMissingChildShouldThrowTestingException()
{
DirectoryDescription sut = new("foo");
@@ -32,7 +32,7 @@ void Act()
await That(Act).ThrowsExactly().WithMessage("*'bar'*").AsWildcard();
}
- [Fact]
+ [Test]
public async Task Index_ShouldGiveAccessToExistingChildDirectory()
{
DirectoryDescription child = new("bar");
@@ -43,7 +43,7 @@ public async Task Index_ShouldGiveAccessToExistingChildDirectory()
await That(result).IsSameAs(child);
}
- [Fact]
+ [Test]
public async Task Index_ShouldGiveAccessToNestedChildren()
{
FileDescription child3 = new("child3", "some-content");
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileDescriptionTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileDescriptionTests.cs
index d7520a9d6..b14e89a87 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileDescriptionTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileDescriptionTests.cs
@@ -4,8 +4,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystemInitializer;
public class FileDescriptionTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Constructor_WithBytes_ShouldSetBytes(byte[] bytes)
{
FileDescription sut = new("foo", bytes);
@@ -14,8 +14,8 @@ public async Task Constructor_WithBytes_ShouldSetBytes(byte[] bytes)
await That(sut.Bytes).IsEqualTo(bytes).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Constructor_WithContent_ShouldSetContent(string content)
{
FileDescription sut = new("foo", content);
@@ -24,7 +24,7 @@ public async Task Constructor_WithContent_ShouldSetContent(string content)
await That(sut.Bytes).IsNull();
}
- [Fact]
+ [Test]
public async Task Index_AccessShouldThrowTestingException()
{
FileDescription sut = new("foo");
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileSystemInitializerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileSystemInitializerTests.cs
index 119d9be5f..88780ed71 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileSystemInitializerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileSystemInitializerTests.cs
@@ -6,8 +6,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystemInitializer;
public class FileSystemInitializerTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_DirectoryDescriptions_ShouldCreateDirectories(
DirectoryDescription[] directories)
{
@@ -23,8 +23,8 @@ public async Task With_DirectoryDescriptions_ShouldCreateDirectories(
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_DirectoryDescriptions_WithSubdirectories_ShouldCreateDirectories(
string parent, DirectoryDescription[] directories)
{
@@ -42,8 +42,8 @@ public async Task With_DirectoryDescriptions_WithSubdirectories_ShouldCreateDire
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_FileDescription_WithBytes_ShouldCreateFileContent(string name,
byte[] bytes)
{
@@ -58,8 +58,8 @@ public async Task With_FileDescription_WithBytes_ShouldCreateFileContent(string
await That(fileSystem.File.ReadAllBytes(name)).IsEqualTo(bytes);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_FileDescription_WithContent_ShouldCreateFileContent(string name,
string content)
{
@@ -74,8 +74,8 @@ public async Task With_FileDescription_WithContent_ShouldCreateFileContent(strin
await That(fileSystem.File.ReadAllText(name)).IsEqualTo(content);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_FileDescriptions_ShouldCreateFiles(FileDescription[] files)
{
MockFileSystem fileSystem = new();
@@ -90,9 +90,9 @@ public async Task With_FileDescriptions_ShouldCreateFiles(FileDescription[] file
}
}
- [Theory]
- [InlineAutoData(true)]
- [InlineAutoData(false)]
+ [Test]
+ [AutoArguments(true)]
+ [AutoArguments(false)]
public async Task With_FileDescriptions_ShouldSetIsReadOnlyFlag(bool isReadOnly, string name)
{
FileDescription description = new(name)
@@ -109,8 +109,8 @@ public async Task With_FileDescriptions_ShouldSetIsReadOnlyFlag(bool isReadOnly,
await That(fileSystem.FileInfo.New(name).IsReadOnly).IsEqualTo(isReadOnly);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_FilesAndDirectories_ShouldBothBeCreated(string fileName,
string directoryName)
{
@@ -126,8 +126,8 @@ public async Task With_FilesAndDirectories_ShouldBothBeCreated(string fileName,
await That(fileSystem.Directory.Exists(directoryName)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_FilesAndDirectoriesWithMultiplePathComponents_ShouldBeCreatedAtTheCorrectPath(
string level1, string level2, string fileName)
{
@@ -145,8 +145,8 @@ public async Task With_FilesAndDirectoriesWithMultiplePathComponents_ShouldBeCre
await That(fileSystem.File.Exists(filePath)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task With_AbsoluteDirectoryWithChildren_ShouldBeCreatedAtTheCorrectPath(
string level1, string level2, string fileName)
{
@@ -164,8 +164,8 @@ public async Task With_AbsoluteDirectoryWithChildren_ShouldBeCreatedAtTheCorrect
await That(fileSystem.File.Exists(filePath)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFile_ExistingDirectory_ShouldThrowTestingException(string path)
{
MockFileSystem fileSystem = new();
@@ -180,8 +180,8 @@ void Act()
await That(Act).ThrowsExactly().WithMessage($"*{path}*").AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFile_ExistingFile_ShouldThrowTestingException(string path)
{
MockFileSystem fileSystem = new();
@@ -194,8 +194,8 @@ void Act()
await That(Act).ThrowsExactly().WithMessage($"*{path}*").AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFile_HasStringContent_ShouldWriteFileContent(string path)
{
MockFileSystem fileSystem = new();
@@ -208,8 +208,8 @@ public async Task WithFile_HasStringContent_ShouldWriteFileContent(string path)
await That(fileSystem.File.ReadAllText(path)).IsEqualTo("foo");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFile_MissingDirectory_ShouldCreateDirectory(string directoryPath,
string fileName)
{
@@ -224,8 +224,8 @@ public async Task WithFile_MissingDirectory_ShouldCreateDirectory(string directo
await That(fileSystem.Directory.Exists(directoryPath)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFile_MultiplePathComponents_ShouldCreateDirectories(string level1,
string level2, string level3, string fileName)
{
@@ -242,8 +242,8 @@ public async Task WithFile_MultiplePathComponents_ShouldCreateDirectories(string
await That(fileSystem.Directory.Exists(Path.Combine(level1, level2, level3))).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSubdirectories_ShouldCreateAllDirectories(string[] paths)
{
MockFileSystem fileSystem = new();
@@ -261,8 +261,8 @@ public async Task WithSubdirectories_ShouldCreateAllDirectories(string[] paths)
await That(result).IsEqualTo(sut);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSubdirectory_ExistingDirectory_ShouldThrowTestingException(string path)
{
MockFileSystem fileSystem = new();
@@ -275,8 +275,8 @@ void Act()
await That(Act).ThrowsExactly().WithMessage($"*{path}*").AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSubdirectory_ExistingFile_ShouldThrowTestingException(string path)
{
MockFileSystem fileSystem = new();
@@ -289,8 +289,8 @@ void Act()
await That(Act).ThrowsExactly().WithMessage($"*{path}*").AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSubdirectory_MultipleDirectoryLevels(string level1, string level2)
{
string path = Path.Combine(level1, level2);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileVersionInfoBuilderTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileVersionInfoBuilderTests.cs
index d544d81a0..cdfc9f15b 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileVersionInfoBuilderTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/FileVersionInfoBuilderTests.cs
@@ -2,8 +2,8 @@
public class FileVersionInfoBuilderTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ShouldBePossibleToChainMethods(
string comments,
string companyName,
@@ -68,8 +68,8 @@ public async Task ShouldBePossibleToChainMethods(
await That(result.SpecialBuild).IsEqualTo(specialBuild);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithComments_ShouldSetComments(string comments)
{
MockFileSystem fileSystem = new();
@@ -81,8 +81,8 @@ public async Task WithComments_ShouldSetComments(string comments)
await That(result.Comments).IsEqualTo(comments);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithCompanyName_ShouldSetCompanyName(string? companyName)
{
MockFileSystem fileSystem = new();
@@ -94,8 +94,8 @@ public async Task WithCompanyName_ShouldSetCompanyName(string? companyName)
await That(result.CompanyName).IsEqualTo(companyName);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithFileDescription_ShouldSetFileDescription(string? fileDescription)
{
MockFileSystem fileSystem = new();
@@ -107,12 +107,12 @@ public async Task WithFileDescription_ShouldSetFileDescription(string? fileDescr
await That(result.FileDescription).IsEqualTo(fileDescription);
}
- [Theory]
- [InlineData("1", 1, 0)]
- [InlineData("0.1", 0, 1)]
- [InlineData("1.2", 1, 2)]
- [InlineData("1.2.3", 1, 2, 3)]
- [InlineData("1.2.3.4", 1, 2, 3, 4)]
+ [Test]
+ [Arguments("1", 1, 0)]
+ [Arguments("0.1", 0, 1)]
+ [Arguments("1.2", 1, 2)]
+ [Arguments("1.2.3", 1, 2, 3)]
+ [Arguments("1.2.3.4", 1, 2, 3, 4)]
public async Task WithFileVersion_ShouldSetFileVersion(
string? fileVersion,
int fileMajorPart, int fileMinorPart, int fileBuildPart = 0, int filePrivatePart = 0)
@@ -130,22 +130,22 @@ public async Task WithFileVersion_ShouldSetFileVersion(
await That(result.FilePrivatePart).IsEqualTo(filePrivatePart);
}
- [Theory]
- [InlineData("1-foo", 1, 0)]
- [InlineData("1+bar", 1, 0)]
- [InlineData("1some-text", 1, 0)]
- [InlineData("0.1-foo", 0, 1)]
- [InlineData("0.1+bar", 0, 1)]
- [InlineData("0.1some-text", 0, 1)]
- [InlineData("1.2-foo", 1, 2)]
- [InlineData("1.2+bar", 1, 2)]
- [InlineData("1.2some-text", 1, 2)]
- [InlineData("1.2.3-foo", 1, 2, 3)]
- [InlineData("1.2.3+bar", 1, 2, 3)]
- [InlineData("1.2.3some-text", 1, 2, 3)]
- [InlineData("1.2.3.4-foo", 1, 2, 3, 4)]
- [InlineData("1.2.3.4+bar", 1, 2, 3, 4)]
- [InlineData("1.2.3.4some-text", 1, 2, 3, 4)]
+ [Test]
+ [Arguments("1-foo", 1, 0)]
+ [Arguments("1+bar", 1, 0)]
+ [Arguments("1some-text", 1, 0)]
+ [Arguments("0.1-foo", 0, 1)]
+ [Arguments("0.1+bar", 0, 1)]
+ [Arguments("0.1some-text", 0, 1)]
+ [Arguments("1.2-foo", 1, 2)]
+ [Arguments("1.2+bar", 1, 2)]
+ [Arguments("1.2some-text", 1, 2)]
+ [Arguments("1.2.3-foo", 1, 2, 3)]
+ [Arguments("1.2.3+bar", 1, 2, 3)]
+ [Arguments("1.2.3some-text", 1, 2, 3)]
+ [Arguments("1.2.3.4-foo", 1, 2, 3, 4)]
+ [Arguments("1.2.3.4+bar", 1, 2, 3, 4)]
+ [Arguments("1.2.3.4some-text", 1, 2, 3, 4)]
public async Task WithFileVersion_WhenContainsPreReleaseInfo_ShouldIgnorePreReleaseInfo(
string? fileVersion,
int fileMajorPart, int fileMinorPart, int fileBuildPart = 0, int filePrivatePart = 0)
@@ -162,11 +162,11 @@ public async Task WithFileVersion_WhenContainsPreReleaseInfo_ShouldIgnorePreRele
await That(result.FilePrivatePart).IsEqualTo(filePrivatePart);
}
- [Theory]
- [InlineData("")]
- [InlineData("-1")]
- [InlineData("+1.2.3-bar")]
- [InlineData("abc")]
+ [Test]
+ [Arguments("")]
+ [Arguments("-1")]
+ [Arguments("+1.2.3-bar")]
+ [Arguments("abc")]
public async Task WithFileVersion_WhenStringIsInvalid_ShouldNotSetFileVersionParts(
string? fileVersion)
{
@@ -183,8 +183,8 @@ public async Task WithFileVersion_WhenStringIsInvalid_ShouldNotSetFileVersionPar
await That(result.FilePrivatePart).IsEqualTo(0);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithInternalName_ShouldSetInternalName(string? internalName)
{
MockFileSystem fileSystem = new();
@@ -196,8 +196,8 @@ public async Task WithInternalName_ShouldSetInternalName(string? internalName)
await That(result.InternalName).IsEqualTo(internalName);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithIsDebug_ShouldSetIsDebug(bool isDebug)
{
MockFileSystem fileSystem = new();
@@ -209,8 +209,8 @@ public async Task WithIsDebug_ShouldSetIsDebug(bool isDebug)
await That(result.IsDebug).IsEqualTo(isDebug);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithIsPatched_ShouldSetIsPatched(bool isPatched)
{
MockFileSystem fileSystem = new();
@@ -222,8 +222,8 @@ public async Task WithIsPatched_ShouldSetIsPatched(bool isPatched)
await That(result.IsPatched).IsEqualTo(isPatched);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithIsPreRelease_ShouldSetIsPreRelease(bool isPreRelease)
{
MockFileSystem fileSystem = new();
@@ -235,8 +235,8 @@ public async Task WithIsPreRelease_ShouldSetIsPreRelease(bool isPreRelease)
await That(result.IsPreRelease).IsEqualTo(isPreRelease);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithIsPrivateBuild_ShouldSetIsPrivateBuild(bool isPrivateBuild)
{
MockFileSystem fileSystem = new();
@@ -248,8 +248,8 @@ public async Task WithIsPrivateBuild_ShouldSetIsPrivateBuild(bool isPrivateBuild
await That(result.IsPrivateBuild).IsEqualTo(isPrivateBuild);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithIsSpecialBuild_ShouldSetIsSpecialBuild(bool isSpecialBuild)
{
MockFileSystem fileSystem = new();
@@ -261,8 +261,8 @@ public async Task WithIsSpecialBuild_ShouldSetIsSpecialBuild(bool isSpecialBuild
await That(result.IsSpecialBuild).IsEqualTo(isSpecialBuild);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithLanguage_ShouldSetLanguage(string? language)
{
MockFileSystem fileSystem = new();
@@ -274,8 +274,8 @@ public async Task WithLanguage_ShouldSetLanguage(string? language)
await That(result.Language).IsEqualTo(language);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithLegalCopyright_ShouldSetLegalCopyright(string? legalCopyright)
{
MockFileSystem fileSystem = new();
@@ -287,8 +287,8 @@ public async Task WithLegalCopyright_ShouldSetLegalCopyright(string? legalCopyri
await That(result.LegalCopyright).IsEqualTo(legalCopyright);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithLegalTrademarks_ShouldSetLegalTrademarks(string? legalTrademarks)
{
MockFileSystem fileSystem = new();
@@ -300,8 +300,8 @@ public async Task WithLegalTrademarks_ShouldSetLegalTrademarks(string? legalTrad
await That(result.LegalTrademarks).IsEqualTo(legalTrademarks);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithOriginalFilename_ShouldSetOriginalFilename(string? originalFilename)
{
MockFileSystem fileSystem = new();
@@ -313,8 +313,8 @@ public async Task WithOriginalFilename_ShouldSetOriginalFilename(string? origina
await That(result.OriginalFilename).IsEqualTo(originalFilename);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithPrivateBuild_ShouldSetPrivateBuild(string? privateBuild)
{
MockFileSystem fileSystem = new();
@@ -326,8 +326,8 @@ public async Task WithPrivateBuild_ShouldSetPrivateBuild(string? privateBuild)
await That(result.PrivateBuild).IsEqualTo(privateBuild);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithProductName_ShouldSetProductName(string? productName)
{
MockFileSystem fileSystem = new();
@@ -339,12 +339,12 @@ public async Task WithProductName_ShouldSetProductName(string? productName)
await That(result.ProductName).IsEqualTo(productName);
}
- [Theory]
- [InlineData("1", 1, 0)]
- [InlineData("0.1", 0, 1)]
- [InlineData("1.2", 1, 2)]
- [InlineData("1.2.3", 1, 2, 3)]
- [InlineData("1.2.3.4", 1, 2, 3, 4)]
+ [Test]
+ [Arguments("1", 1, 0)]
+ [Arguments("0.1", 0, 1)]
+ [Arguments("1.2", 1, 2)]
+ [Arguments("1.2.3", 1, 2, 3)]
+ [Arguments("1.2.3.4", 1, 2, 3, 4)]
public async Task WithProductVersion_ShouldSetProductVersion(
string? productVersion,
int fileMajorPart, int fileMinorPart, int fileBuildPart = 0, int filePrivatePart = 0)
@@ -362,22 +362,22 @@ public async Task WithProductVersion_ShouldSetProductVersion(
await That(result.ProductPrivatePart).IsEqualTo(filePrivatePart);
}
- [Theory]
- [InlineData("1-foo", 1, 0)]
- [InlineData("1+bar", 1, 0)]
- [InlineData("1some-text", 1, 0)]
- [InlineData("0.1-foo", 0, 1)]
- [InlineData("0.1+bar", 0, 1)]
- [InlineData("0.1some-text", 0, 1)]
- [InlineData("1.2-foo", 1, 2)]
- [InlineData("1.2+bar", 1, 2)]
- [InlineData("1.2some-text", 1, 2)]
- [InlineData("1.2.3-foo", 1, 2, 3)]
- [InlineData("1.2.3+bar", 1, 2, 3)]
- [InlineData("1.2.3some-text", 1, 2, 3)]
- [InlineData("1.2.3.4-foo", 1, 2, 3, 4)]
- [InlineData("1.2.3.4+bar", 1, 2, 3, 4)]
- [InlineData("1.2.3.4some-text", 1, 2, 3, 4)]
+ [Test]
+ [Arguments("1-foo", 1, 0)]
+ [Arguments("1+bar", 1, 0)]
+ [Arguments("1some-text", 1, 0)]
+ [Arguments("0.1-foo", 0, 1)]
+ [Arguments("0.1+bar", 0, 1)]
+ [Arguments("0.1some-text", 0, 1)]
+ [Arguments("1.2-foo", 1, 2)]
+ [Arguments("1.2+bar", 1, 2)]
+ [Arguments("1.2some-text", 1, 2)]
+ [Arguments("1.2.3-foo", 1, 2, 3)]
+ [Arguments("1.2.3+bar", 1, 2, 3)]
+ [Arguments("1.2.3some-text", 1, 2, 3)]
+ [Arguments("1.2.3.4-foo", 1, 2, 3, 4)]
+ [Arguments("1.2.3.4+bar", 1, 2, 3, 4)]
+ [Arguments("1.2.3.4some-text", 1, 2, 3, 4)]
public async Task WithProductVersion_WhenContainsPreReleaseInfo_ShouldIgnorePreReleaseInfo(
string? productVersion,
int fileMajorPart, int fileMinorPart, int fileBuildPart = 0, int filePrivatePart = 0)
@@ -394,11 +394,11 @@ public async Task WithProductVersion_WhenContainsPreReleaseInfo_ShouldIgnorePreR
await That(result.ProductPrivatePart).IsEqualTo(filePrivatePart);
}
- [Theory]
- [InlineData("")]
- [InlineData("-1")]
- [InlineData("+1.2.3-bar")]
- [InlineData("abc")]
+ [Test]
+ [Arguments("")]
+ [Arguments("-1")]
+ [Arguments("+1.2.3-bar")]
+ [Arguments("abc")]
public async Task WithProductVersion_WhenStringIsInvalid_ShouldNotSetProductVersionParts(
string? productVersion)
{
@@ -415,8 +415,8 @@ public async Task WithProductVersion_WhenStringIsInvalid_ShouldNotSetProductVers
await That(result.ProductPrivatePart).IsEqualTo(0);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSpecialBuild_ShouldSetSpecialBuild(string? specialBuild)
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/TestingExceptionTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/TestingExceptionTests.cs
index 5653fd42f..e9f1db98f 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/TestingExceptionTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializer/TestingExceptionTests.cs
@@ -7,8 +7,8 @@ namespace Testably.Abstractions.Testing.Tests.FileSystemInitializer;
public class TestingExceptionTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
TestingException_SerializationAndDeserialization_ShouldKeepMessageAndInnerException(
string message, Exception innerException)
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerExtensionsTests.cs
index 24a72f988..58008d2e8 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerExtensionsTests.cs
@@ -2,16 +2,15 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Reflection;
-using Testably.Abstractions.TestHelpers.Settings;
using Testably.Abstractions.Testing.Initializer;
+using Assembly = System.Reflection.Assembly;
namespace Testably.Abstractions.Testing.Tests;
-[Collection("RealFileSystemTests")]
-public class FileSystemInitializerExtensionsTests(TestSettingsFixture fixture)
+[NotInParallel(nameof(RealFileSystem))]
+public class FileSystemInitializerExtensionsTests
{
- [Fact]
+ [Test]
public async Task Initialize_WithAFile_ShouldCreateFile()
{
MockFileSystem sut = new();
@@ -21,8 +20,8 @@ public async Task Initialize_WithAFile_ShouldCreateFile()
await That(sut.Directory.EnumerateFiles(".")).HasSingle();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("txt")]
public async Task Initialize_WithAFile_WithExtension_ShouldCreateFileWithExtension(
string extension)
{
@@ -33,7 +32,7 @@ public async Task Initialize_WithAFile_WithExtension_ShouldCreateFileWithExtensi
await That(sut.Directory.EnumerateFiles(".", $"*.{extension}")).HasSingle();
}
- [Fact]
+ [Test]
public async Task Initialize_WithASubdirectory_ShouldCreateDirectory()
{
MockFileSystem sut = new();
@@ -43,8 +42,8 @@ public async Task Initialize_WithASubdirectory_ShouldCreateDirectory()
await That(sut.Directory.EnumerateDirectories(".")).HasSingle();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("foo.txt")]
public async Task Initialize_WithFile_Existing_ShouldThrowTestingException(string fileName)
{
MockFileSystem sut = new();
@@ -55,11 +54,11 @@ void Act()
sut.Initialize().WithFile(fileName);
}
- await That(Act).ThrowsExactly().WithMessage("*fileName*").AsWildcard();
+ await That(Act).ThrowsExactly().WithMessage($"*{fileName}*").AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("foo.txt", new byte[]{ 0x1, 0x2, 0x3, })]
public async Task Initialize_WithFile_HasBytesContent_ShouldCreateFileWithGivenFileContent(
string fileName, byte[] fileContent)
{
@@ -74,8 +73,8 @@ public async Task Initialize_WithFile_HasBytesContent_ShouldCreateFileWithGivenF
await That(result).IsEqualTo(fileContent).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("foo.txt", "file-content")]
public async Task Initialize_WithFile_HasStringContent_ShouldCreateFileWithGivenFileContent(
string fileName, string fileContent)
{
@@ -90,8 +89,8 @@ public async Task Initialize_WithFile_HasStringContent_ShouldCreateFileWithGiven
await That(result).IsEqualTo(fileContent);
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("foo.txt")]
public async Task Initialize_WithFile_ShouldCreateFileWithGivenFileName(string fileName)
{
MockFileSystem sut = new();
@@ -101,7 +100,7 @@ public async Task Initialize_WithFile_ShouldCreateFileWithGivenFileName(string f
await That(sut.Directory.EnumerateFiles(".", fileName)).HasSingle();
}
- [Fact]
+ [Test]
public async Task Initialize_WithNestedSubdirectories_ShouldCreateAllNestedDirectories()
{
MockFileSystem sut = new();
@@ -120,9 +119,9 @@ public async Task Initialize_WithNestedSubdirectories_ShouldCreateAllNestedDirec
await That(result).Contains(sut.Path.Combine(".", "foo", "bar", "xyz"));
}
- [Theory]
- [InlineData(false)]
- [InlineData(true)]
+ [Test]
+ [Arguments(false)]
+ [Arguments(true)]
public async Task Initialize_WithOptions_ShouldConsiderValueOfInitializeTempDirectory(
bool initializeTempDirectory)
{
@@ -134,8 +133,8 @@ public async Task Initialize_WithOptions_ShouldConsiderValueOfInitializeTempDire
await That(sut.Directory.Exists(sut.Path.GetTempPath())).IsEqualTo(initializeTempDirectory);
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-directory")]
public async Task Initialize_WithSubdirectory_Existing_ShouldThrowTestingException(
string directoryName)
{
@@ -149,8 +148,8 @@ await That(Act).ThrowsExactly().WithMessage($"*{directoryName}
.AsWildcard();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-directory")]
public async Task Initialize_WithSubdirectory_ShouldCreateDirectoryWithGivenDirectoryName(
string directoryName)
{
@@ -161,8 +160,8 @@ public async Task Initialize_WithSubdirectory_ShouldCreateDirectoryWithGivenDire
await That(sut.Directory.EnumerateDirectories(".", directoryName)).HasSingle();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-directory")]
public async Task Initialize_WithSubdirectory_ShouldExist(string directoryName)
{
MockFileSystem sut = new();
@@ -174,8 +173,8 @@ public async Task Initialize_WithSubdirectory_ShouldExist(string directoryName)
await That(result.Directory.Exists).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-path")]
public async Task
InitializeEmbeddedResourcesFromAssembly_ShouldCopyAllMatchingResourceFilesInDirectory(
string path)
@@ -200,8 +199,8 @@ await That(result2)
.Contains(x => x.EndsWith("SubResourceFile1.txt", StringComparison.Ordinal));
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-path")]
public async Task
InitializeEmbeddedResourcesFromAssembly_WithoutRecurseSubdirectories_ShouldOnlyCopyTopmostFilesInRelativePath(
string path)
@@ -224,8 +223,8 @@ public async Task
await That(fileSystem.Directory.Exists(Path.Combine(path, "SubResource"))).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-path")]
public async Task
InitializeEmbeddedResourcesFromAssembly_WithRelativePath_ShouldCopyAllResourceInMatchingPathInDirectory(
string path)
@@ -246,8 +245,8 @@ await That(result)
.Contains(x => x.EndsWith("SubResourceFile1.txt", StringComparison.Ordinal));
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-directory")]
public async Task InitializeFromRealDirectory_MissingDrive_ShouldCreateDrive(
string directoryName)
{
@@ -282,7 +281,7 @@ public async Task InitializeFromRealDirectory_MissingDrive_ShouldCreateDrive(
}
}
- [Fact]
+ [Test]
public async Task InitializeFromRealDirectory_ShouldCopyFileToTargetDirectory()
{
SkipIfRealFileSystemShouldBeSkipped();
@@ -306,7 +305,7 @@ public async Task InitializeFromRealDirectory_ShouldCopyFileToTargetDirectory()
}
}
- [Fact]
+ [Test]
public async Task
InitializeFromRealDirectory_ShouldRecursivelyCopyDirectoriesToTargetDirectory()
{
@@ -335,7 +334,7 @@ await That(fileSystem).HasFile(fileSystem.Path.Combine(tempPath, "subdir", "test
}
}
- [Fact]
+ [Test]
public async Task
InitializeFromRealDirectory_WhenDirectoryDoesNotExist_ShouldThrowDirectoryNotFoundException()
{
@@ -353,8 +352,8 @@ await That(Act).Throws()
.WithMessage($"The directory '{tempPath}' does not exist.");
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-directory")]
public async Task InitializeIn_MissingDrive_ShouldCreateDrive(string directoryName)
{
Skip.IfNot(Test.RunsOnWindows);
@@ -378,8 +377,8 @@ public async Task InitializeIn_MissingDrive_ShouldCreateDrive(string directoryNa
await That(sut.DriveInfo.GetDrives()).HasCount(drives.Length + 1);
}
- [Theory]
- [AutoData]
+ [Test]
+ [Arguments("my-path")]
public async Task InitializeIn_ShouldSetCurrentDirectory(string path)
{
MockFileSystem sut = new();
@@ -393,19 +392,14 @@ public async Task InitializeIn_ShouldSetCurrentDirectory(string path)
#region Helpers
- private void SkipIfRealFileSystemShouldBeSkipped()
+ private static void SkipIfRealFileSystemShouldBeSkipped()
{
#if DEBUG
- if (fixture.RealFileSystemTests != TestSettingStatus.AlwaysEnabled)
- {
- aweXpect.Skip.Test(
- $"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
- }
+ Skip.If(Settings.RealFileSystemTests == Settings.TestSettingStatus.AlwaysDisabled,
+ $"Tests against the real file system are {Settings.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
#else
- if (fixture.RealFileSystemTests == TestSettingStatus.AlwaysDisabled)
- {
- aweXpect.Skip.Test($"Tests against the real file system are {fixture.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
- }
+ Skip.If(Settings.RealFileSystemTests != Settings.TestSettingStatus.AlwaysEnabled,
+ $"Tests against the real file system are {Settings.RealFileSystemTests}. You can enable them by executing the corresponding tests in Testably.Abstractions.TestSettings.RealFileSystemTests.");
#endif
}
diff --git a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerOptionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerOptionsTests.cs
index f1a5a0507..24c70bea0 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerOptionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/FileSystemInitializerOptionsTests.cs
@@ -2,7 +2,7 @@
public sealed class FileSystemInitializerOptionsTests
{
- [Fact]
+ [Test]
public async Task InitializeTempDirectory_ShouldBeInitializedToTrue()
{
FileSystemInitializerOptions sut = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/AssemblyNameExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/AssemblyNameExtensionsTests.cs
index c467fec4c..2df504a30 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/AssemblyNameExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/AssemblyNameExtensionsTests.cs
@@ -1,11 +1,12 @@
using System.Reflection;
using Testably.Abstractions.Testing.Helpers;
+using Assembly = System.Reflection.Assembly;
namespace Testably.Abstractions.Testing.Tests.Helpers;
public class AssemblyNameExtensionsTests
{
- [Fact]
+ [Test]
public async Task GetNameOrDefault_ExecutingAssembly_ShouldReturnCorrectString()
{
AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName();
@@ -15,7 +16,7 @@ public async Task GetNameOrDefault_ExecutingAssembly_ShouldReturnCorrectString()
await That(result).IsEqualTo("Testably.Abstractions.Testing.Tests");
}
- [Fact]
+ [Test]
public async Task GetNameOrDefault_NullName_ShouldReturnEmptyString()
{
AssemblyName assemblyName = Assembly.GetExecutingAssembly().GetName();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/CallerArgumentExpressionAttribute.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/CallerArgumentExpressionAttribute.cs
deleted file mode 100644
index 3dfe0cf41..000000000
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/CallerArgumentExpressionAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-#if !NET6_0_OR_GREATER
-using System.Diagnostics.CodeAnalysis;
-
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices
-{
- ///
- /// Indicates that a parameter captures the expression passed for another parameter as a string.
- ///
- [AttributeUsage(AttributeTargets.Parameter)]
- [ExcludeFromCodeCoverage]
- internal sealed class CallerArgumentExpressionAttribute : Attribute
- {
- ///
- /// Gets the name of the parameter whose expression should be captured as a string.
- ///
- public string ParameterName { get; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The name of the parameter whose expression should be captured as a string.
- public CallerArgumentExpressionAttribute(string parameterName)
- {
- ParameterName = parameterName;
- }
- }
-}
-
-#endif
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/CharExtensionMethodsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/CharExtensionMethodsTests.cs
index 783faf926..21ae7828e 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/CharExtensionMethodsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/CharExtensionMethodsTests.cs
@@ -4,13 +4,13 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public sealed class CharExtensionMethodsTests
{
- [Theory]
- [InlineData('A')]
- [InlineData('Z')]
- [InlineData('a')]
- [InlineData('z')]
- [InlineData('M')]
- [InlineData('d')]
+ [Test]
+ [Arguments('A')]
+ [Arguments('Z')]
+ [Arguments('a')]
+ [Arguments('z')]
+ [Arguments('M')]
+ [Arguments('d')]
public async Task IsAsciiLetter_WithAsciiLetterChar_ShouldReturnTrue(char c)
{
bool result = c.IsAsciiLetter();
@@ -18,14 +18,14 @@ public async Task IsAsciiLetter_WithAsciiLetterChar_ShouldReturnTrue(char c)
await That(result).IsTrue();
}
- [Theory]
- [InlineData((char)64)]
- [InlineData((char)91)]
- [InlineData((char)96)]
- [InlineData((char)123)]
- [InlineData((char)55)]
- [InlineData((char)0)]
- [InlineData((char)127)]
+ [Test]
+ [Arguments((char)64)]
+ [Arguments((char)91)]
+ [Arguments((char)96)]
+ [Arguments((char)123)]
+ [Arguments((char)55)]
+ [Arguments((char)0)]
+ [Arguments((char)127)]
public async Task IsAsciiLetter_WithNonAsciiLetterChar_ShouldReturnFalse(char c)
{
bool result = c.IsAsciiLetter();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/EncryptionHelperTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/EncryptionHelperTests.cs
index aba83381d..c0fc9b046 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/EncryptionHelperTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/EncryptionHelperTests.cs
@@ -4,8 +4,8 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class EncryptionHelperTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Decrypt_ShouldBeDifferentThanBefore(byte[] bytes)
{
byte[] encryptedBytes = EncryptionHelper.Encrypt(bytes);
@@ -15,8 +15,8 @@ public async Task Decrypt_ShouldBeDifferentThanBefore(byte[] bytes)
await That(result).IsNotEqualTo(encryptedBytes).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Encrypt_ShouldBeDifferentThanBefore(byte[] bytes)
{
byte[] result = EncryptionHelper.Encrypt(bytes);
@@ -24,8 +24,8 @@ public async Task Encrypt_ShouldBeDifferentThanBefore(byte[] bytes)
await That(result).IsNotEqualTo(bytes).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Encrypt_ThenDecrypt_ShouldBeEquivalentToBefore(byte[] bytes)
{
byte[] encrypted = EncryptionHelper.Encrypt(bytes);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/EnumerationOptionsHelperTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/EnumerationOptionsHelperTests.cs
index 0d98ae39b..fb9ab3be5 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/EnumerationOptionsHelperTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/EnumerationOptionsHelperTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class EnumerationOptionsHelperTests
{
- [Fact]
+ [Test]
public async Task FromSearchOption_InvalidValue_ShouldThrowArgumentOutOfRangeException()
{
SearchOption invalidSearchOption = (SearchOption)(-1);
@@ -19,7 +19,7 @@ void Act()
}
#if NET6_0_OR_GREATER
- [Fact]
+ [Test]
public async Task MatchesPattern_InvalidMatchType_ShouldThrowArgumentOutOfRangeException()
{
EnumerationOptions invalidEnumerationOptions = new()
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExceptionFactoryTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExceptionFactoryTests.cs
index 00077b875..2db391046 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExceptionFactoryTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExceptionFactoryTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public sealed class ExceptionFactoryTests
{
- [Fact]
+ [Test]
public async Task NotSupportedSafeFileHandle_ShouldMentionWithSafeFileHandleStrategy()
{
NotSupportedException sut = ExceptionFactory.NotSupportedSafeFileHandle();
@@ -12,7 +12,7 @@ public async Task NotSupportedSafeFileHandle_ShouldMentionWithSafeFileHandleStra
await That(sut.Message).Contains(nameof(MockFileSystem.WithSafeFileHandleStrategy));
}
- [Fact]
+ [Test]
public async Task OperationNotSupportedOnThisPlatform_ShouldMentionPlatform()
{
PlatformNotSupportedException sut = ExceptionFactory.OperationNotSupportedOnThisPlatform();
@@ -20,9 +20,9 @@ public async Task OperationNotSupportedOnThisPlatform_ShouldMentionPlatform()
await That(sut.Message).Contains("platform");
}
- [Theory]
- [InlineAutoData(SimulationMode.Windows, false)]
- [InlineAutoData(SimulationMode.Windows, true)]
+ [Test]
+ [AutoArguments(SimulationMode.Windows, false)]
+ [AutoArguments(SimulationMode.Windows, true)]
public async Task PathCannotBeEmpty_ShouldSetParamNameExceptOnNetFramework(
SimulationMode type, bool isNetFramework, string paramName)
{
@@ -43,7 +43,7 @@ public async Task PathCannotBeEmpty_ShouldSetParamNameExceptOnNetFramework(
}
}
- [Fact]
+ [Test]
public async Task SearchPatternCannotContainTwoDots_ShouldMentionTwoDots()
{
ArgumentException sut = ExceptionFactory.SearchPatternCannotContainTwoDots();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.SimulatedPathTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.SimulatedPathTests.cs
index bcdcef072..a7e34f498 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.SimulatedPathTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.SimulatedPathTests.cs
@@ -5,10 +5,10 @@ public sealed partial class ExecuteTests
#if CAN_SIMULATE_OTHER_OS
public sealed class SimulatedPathTests
{
- [Theory]
- [InlineData(SimulationMode.Linux)]
- [InlineData(SimulationMode.MacOS)]
- [InlineData(SimulationMode.Windows)]
+ [Test]
+ [Arguments(SimulationMode.Linux)]
+ [Arguments(SimulationMode.MacOS)]
+ [Arguments(SimulationMode.Windows)]
public async Task FileSystem_ShouldBeMockFileSystem(SimulationMode simulationMode)
{
MockFileSystem sut = new(o => o.SimulatingOperatingSystem(simulationMode));
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.cs
index f8863787a..332f65771 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/ExecuteTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public sealed partial class ExecuteTests
{
- [Fact]
+ [Test]
public async Task Constructor_ForLinux_ShouldInitializeAccordingly()
{
#pragma warning disable CS0618
@@ -18,7 +18,7 @@ public async Task Constructor_ForLinux_ShouldInitializeAccordingly()
await That(sut.StringComparisonMode).IsEqualTo(StringComparison.Ordinal);
}
- [Fact]
+ [Test]
public async Task Constructor_ForMacOS_ShouldInitializeAccordingly()
{
#pragma warning disable CS0618
@@ -32,7 +32,7 @@ public async Task Constructor_ForMacOS_ShouldInitializeAccordingly()
await That(sut.StringComparisonMode).IsEqualTo(StringComparison.OrdinalIgnoreCase);
}
- [Fact]
+ [Test]
public async Task Constructor_ForWindows_ShouldInitializeAccordingly()
{
#pragma warning disable CS0618
@@ -46,7 +46,7 @@ public async Task Constructor_ForWindows_ShouldInitializeAccordingly()
await That(sut.StringComparisonMode).IsEqualTo(StringComparison.OrdinalIgnoreCase);
}
- [Fact]
+ [Test]
public async Task Constructor_UnsupportedSimulationMode_ShouldThrowNotSupportedException()
{
void Act()
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FilePlatformIndependenceExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FilePlatformIndependenceExtensionsTests.cs
index d2e1ab64d..61d6a97c1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FilePlatformIndependenceExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FilePlatformIndependenceExtensionsTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class FilePlatformIndependenceExtensionsTests
{
- [Fact]
+ [Test]
public async Task NormalizePath_Null_ShouldReturnNull()
{
string? path = null;
@@ -15,8 +15,8 @@ public async Task NormalizePath_Null_ShouldReturnNull()
await That(path).IsNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NormalizePath_Unix_RootedPath_ShouldRemoveDriveInfo(string part1)
{
Skip.If(Test.RunsOnWindows);
@@ -30,8 +30,8 @@ public async Task NormalizePath_Unix_RootedPath_ShouldRemoveDriveInfo(string par
await That(path).IsEqualTo(expectedPath);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NormalizePath_Unix_ShouldReplaceAltDirectorySeparatorChar(
string part1, string part2)
{
@@ -52,8 +52,8 @@ public async Task NormalizePath_Unix_ShouldReplaceAltDirectorySeparatorChar(
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NormalizePath_Windows_ShouldAlsoKeepAltDirectorySeparatorChar(
string part1, string part2)
{
@@ -73,7 +73,7 @@ public async Task NormalizePath_Windows_ShouldAlsoKeepAltDirectorySeparatorChar(
}
}
- [Fact]
+ [Test]
public async Task PrefixRoot_Null_ShouldReturnNull()
{
string? path = null;
@@ -83,8 +83,8 @@ public async Task PrefixRoot_Null_ShouldReturnNull()
await That(result).IsNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task PrefixRoot_RootedPath_ShouldReturnPath(string path)
{
path = path.PrefixRoot(new MockFileSystem());
@@ -94,8 +94,8 @@ public async Task PrefixRoot_RootedPath_ShouldReturnPath(string path)
await That(result).IsEqualTo(path);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task PrefixRoot_UnRootedPath_ShouldPrefixRoot(string path)
{
string result = path.PrefixRoot(new MockFileSystem());
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensibilityTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensibilityTests.cs
index b3400140f..156a067ef 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensibilityTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensibilityTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public sealed class FileSystemExtensibilityTests
{
- [Fact]
+ [Test]
public async Task ToString_Empty_ShouldBeEmptyArray()
{
FileSystemExtensibility extensibility = new();
@@ -14,7 +14,7 @@ public async Task ToString_Empty_ShouldBeEmptyArray()
await That(result).IsEqualTo("[]");
}
- [Fact]
+ [Test]
public async Task ToString_WithMetadata_Should()
{
FileSystemExtensibility extensibility = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensionsTests.cs
index ead742321..aae336fa1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/FileSystemExtensionsTests.cs
@@ -5,8 +5,8 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class FileSystemExtensionsTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetMoveLocation_LocationNotUnderSource_ShouldThrowNotSupportedException(
string location, string source, string destination)
{
@@ -26,7 +26,7 @@ await That(Act).ThrowsExactly()
.Contains($"'{sut.Path.GetFullPath(source)}'"));
}
- [Fact]
+ [Test]
public async Task RandomOrDefault_WithMockFileSystem_ShouldUseRandomFromRandomSystem()
{
MockFileSystem fileSystem = new();
@@ -37,7 +37,7 @@ public async Task RandomOrDefault_WithMockFileSystem_ShouldUseRandomFromRandomSy
await That(result).IsEqualTo(fileSystem.RandomSystem.Random.Shared);
}
- [Fact]
+ [Test]
public async Task RandomOrDefault_WithRealFileSystem_ShouldUseSharedRandom()
{
RealFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/PathHelperTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/PathHelperTests.cs
index 43c3d9391..c4c1054d9 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/PathHelperTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/PathHelperTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class PathHelperTests
{
- [Fact]
+ [Test]
public async Task
EnsureValidFormat_WithWhiteSpaceAndIncludeIsEmptyCheck_ShouldThrowArgumentException()
{
@@ -20,8 +20,8 @@ void Act()
await That(Act).ThrowsExactly().WithHResult(-2147024809);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetFullPathOrWhiteSpace_NormalPath_ShouldReturnFullPath(string path)
{
MockFileSystem fileSystem = new();
@@ -33,7 +33,7 @@ public async Task GetFullPathOrWhiteSpace_NormalPath_ShouldReturnFullPath(string
await That(result).IsEqualTo(expectedPath);
}
- [Fact]
+ [Test]
public async Task GetFullPathOrWhiteSpace_Null_ShouldReturnEmptyString()
{
MockFileSystem fileSystem = new();
@@ -44,9 +44,9 @@ public async Task GetFullPathOrWhiteSpace_Null_ShouldReturnEmptyString()
await That(result).IsEqualTo("");
}
- [Theory]
- [InlineData(" ")]
- [InlineData("\t")]
+ [Test]
+ [Arguments(" ")]
+ [Arguments("\t")]
public async Task GetFullPathOrWhiteSpace_WhiteSpace_ShouldReturnPath(string path)
{
MockFileSystem fileSystem = new();
@@ -56,8 +56,8 @@ public async Task GetFullPathOrWhiteSpace_WhiteSpace_ShouldReturnPath(string pat
await That(result).IsEqualTo(path);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task IsUncPath_AltDirectorySeparatorChar_ShouldReturnTrue(string path)
{
string prefix = new(Path.AltDirectorySeparatorChar, 2);
@@ -68,8 +68,8 @@ public async Task IsUncPath_AltDirectorySeparatorChar_ShouldReturnTrue(string pa
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task IsUncPath_DirectorySeparatorChar_ShouldReturnTrue(string path)
{
string prefix = new(Path.DirectorySeparatorChar, 2);
@@ -80,8 +80,8 @@ public async Task IsUncPath_DirectorySeparatorChar_ShouldReturnTrue(string path)
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task IsUncPath_MixedDirectorySeparatorChars_ShouldReturnFalse(string path)
{
Skip.IfNot(Test.RunsOnWindows,
@@ -94,7 +94,7 @@ public async Task IsUncPath_MixedDirectorySeparatorChars_ShouldReturnFalse(strin
await That(result).IsFalse();
}
- [Fact]
+ [Test]
public async Task IsUncPath_Null_ShouldReturnFalse()
{
string? path = null;
@@ -104,7 +104,7 @@ public async Task IsUncPath_Null_ShouldReturnFalse()
await That(result).IsFalse();
}
- [Fact]
+ [Test]
public async Task
ThrowCommonExceptionsIfPathIsInvalid_StartWithNull_ShouldThrowArgumentException()
{
@@ -119,10 +119,10 @@ void Act()
}
#if CAN_SIMULATE_OTHER_OS
- [Theory]
- [InlineData('|')]
- [InlineData((char)1)]
- [InlineData((char)31)]
+ [Test]
+ [Arguments('|')]
+ [Arguments((char)1)]
+ [Arguments((char)31)]
public async Task ThrowCommonExceptionsIfPathIsInvalid_WithInvalidCharacters(
char invalidChar)
{
@@ -139,7 +139,7 @@ void Act()
}
#endif
- [Fact]
+ [Test]
public async Task
ThrowCommonExceptionsIfPathToTargetIsInvalid_NullCharacter_ShouldThrowArgumentException()
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Helpers/RandomSystemExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Helpers/RandomSystemExtensionsTests.cs
index 1eecebfcf..88540b583 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Helpers/RandomSystemExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Helpers/RandomSystemExtensionsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Helpers;
public class RandomSystemExtensionsTests
{
- [Fact]
+ [Test]
public async Task GenerateRandomFileExtension_ShouldNotStartWithDotOrReturnEmptyString()
{
MockRandomSystem randomSystem = new(
@@ -34,7 +34,7 @@ public async Task GenerateRandomFileExtension_ShouldNotStartWithDotOrReturnEmpty
}
}
- [Fact]
+ [Test]
public async Task GenerateRandomFileName_ShouldGenerateEdgeCases()
{
MockRandomSystem randomSystem = new(
diff --git a/Tests/Testably.Abstractions.Testing.Tests/InterceptionHandlerExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/InterceptionHandlerExtensionsTests.cs
index 186909545..2bcba2075 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/InterceptionHandlerExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/InterceptionHandlerExtensionsTests.cs
@@ -8,8 +8,8 @@ public class InterceptionHandlerExtensionsTests
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Changing_File_OtherEvent_ShouldNotTrigger(
string path, Exception exceptionToThrow)
{
@@ -26,8 +26,8 @@ public async Task Changing_File_OtherEvent_ShouldNotTrigger(
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Changing_File_ShouldConsiderBasePath(string path1, string path2,
Exception exceptionToThrow)
{
@@ -44,13 +44,13 @@ public async Task Changing_File_ShouldConsiderBasePath(string path1, string path
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineAutoData(".", "foo", "f*o", true)]
- [InlineAutoData(".", "foo", "*fo", false)]
- [InlineAutoData("bar", "foo", "f*o", true)]
- [InlineAutoData("bar", "foo", "baz/f*o", false)]
- [InlineAutoData("bar", "foo", "/f*o", false)]
- [InlineAutoData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [AutoArguments(".", "foo", "f*o", true)]
+ [AutoArguments(".", "foo", "*fo", false)]
+ [AutoArguments("bar", "foo", "f*o", true)]
+ [AutoArguments("bar", "foo", "baz/f*o", false)]
+ [AutoArguments("bar", "foo", "/f*o", false)]
+ [AutoArguments("bar", "foo", "**/f*o", true)]
public async Task Changing_File_ShouldConsiderGlobPattern(
string basePath, string fileName, string globPattern, bool expectedResult,
Exception exceptionToThrow)
@@ -82,9 +82,9 @@ public async Task Changing_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task Changing_File_ShouldUsePredicate(bool expectedResult, string path,
Exception exceptionToThrow)
{
@@ -113,8 +113,8 @@ public async Task Changing_File_ShouldUsePredicate(bool expectedResult, string p
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Creating_Directory_OtherEvent_ShouldNotTrigger(
string path, Exception exceptionToThrow)
{
@@ -131,8 +131,8 @@ public async Task Creating_Directory_OtherEvent_ShouldNotTrigger(
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Creating_Directory_ShouldConsiderBasePath(
string path1, string path2, Exception exceptionToThrow)
{
@@ -148,13 +148,13 @@ public async Task Creating_Directory_ShouldConsiderBasePath(
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineAutoData(".", "foo", "f*o", true)]
- [InlineAutoData(".", "foo", "*fo", false)]
- [InlineAutoData("bar", "foo", "f*o", true)]
- [InlineAutoData("bar", "foo", "baz/f*o", false)]
- [InlineAutoData("bar", "foo", "/f*o", false)]
- [InlineAutoData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [AutoArguments(".", "foo", "f*o", true)]
+ [AutoArguments(".", "foo", "*fo", false)]
+ [AutoArguments("bar", "foo", "f*o", true)]
+ [AutoArguments("bar", "foo", "baz/f*o", false)]
+ [AutoArguments("bar", "foo", "/f*o", false)]
+ [AutoArguments("bar", "foo", "**/f*o", true)]
public async Task Creating_Directory_ShouldConsiderGlobPattern(
string basePath, string fileName, string globPattern, bool expectedResult,
Exception exceptionToThrow)
@@ -186,9 +186,9 @@ public async Task Creating_Directory_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task Creating_Directory_ShouldUsePredicate(bool expectedResult, string path,
Exception exceptionToThrow)
{
@@ -216,8 +216,8 @@ public async Task Creating_Directory_ShouldUsePredicate(bool expectedResult, str
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Creating_File_OtherEvent_ShouldNotTrigger(
string path, Exception exceptionToThrow)
{
@@ -234,8 +234,8 @@ public async Task Creating_File_OtherEvent_ShouldNotTrigger(
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Creating_File_ShouldConsiderBasePath(string path1, string path2,
Exception exceptionToThrow)
{
@@ -251,13 +251,13 @@ public async Task Creating_File_ShouldConsiderBasePath(string path1, string path
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineAutoData(".", "foo", "f*o", true)]
- [InlineAutoData(".", "foo", "*fo", false)]
- [InlineAutoData("bar", "foo", "f*o", true)]
- [InlineAutoData("bar", "foo", "baz/f*o", false)]
- [InlineAutoData("bar", "foo", "/f*o", false)]
- [InlineAutoData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [AutoArguments(".", "foo", "f*o", true)]
+ [AutoArguments(".", "foo", "*fo", false)]
+ [AutoArguments("bar", "foo", "f*o", true)]
+ [AutoArguments("bar", "foo", "baz/f*o", false)]
+ [AutoArguments("bar", "foo", "/f*o", false)]
+ [AutoArguments("bar", "foo", "**/f*o", true)]
public async Task Creating_File_ShouldConsiderGlobPattern(
string basePath, string fileName, string globPattern, bool expectedResult,
Exception exceptionToThrow)
@@ -289,9 +289,9 @@ public async Task Creating_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task Creating_File_ShouldUsePredicate(bool expectedResult, string path,
Exception exceptionToThrow)
{
@@ -319,8 +319,8 @@ public async Task Creating_File_ShouldUsePredicate(bool expectedResult, string p
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Deleting_Directory_OtherEvent_ShouldNotTrigger(
string path, Exception exceptionToThrow)
{
@@ -336,8 +336,8 @@ public async Task Deleting_Directory_OtherEvent_ShouldNotTrigger(
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Deleting_Directory_ShouldConsiderBasePath(
string path1, string path2, Exception exceptionToThrow)
{
@@ -354,13 +354,13 @@ public async Task Deleting_Directory_ShouldConsiderBasePath(
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineAutoData(".", "foo", "f*o", true)]
- [InlineAutoData(".", "foo", "*fo", false)]
- [InlineAutoData("bar", "foo", "f*o", true)]
- [InlineAutoData("bar", "foo", "baz/f*o", false)]
- [InlineAutoData("bar", "foo", "/f*o", false)]
- [InlineAutoData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [AutoArguments(".", "foo", "f*o", true)]
+ [AutoArguments(".", "foo", "*fo", false)]
+ [AutoArguments("bar", "foo", "f*o", true)]
+ [AutoArguments("bar", "foo", "baz/f*o", false)]
+ [AutoArguments("bar", "foo", "/f*o", false)]
+ [AutoArguments("bar", "foo", "**/f*o", true)]
public async Task Deleting_Directory_ShouldConsiderGlobPattern(
string basePath, string directoryName, string globPattern, bool expectedResult,
Exception exceptionToThrow)
@@ -392,9 +392,9 @@ public async Task Deleting_Directory_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task Deleting_Directory_ShouldUsePredicate(bool expectedResult, string path,
Exception exceptionToThrow)
{
@@ -423,8 +423,8 @@ public async Task Deleting_Directory_ShouldUsePredicate(bool expectedResult, str
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Deleting_File_OtherEvent_ShouldNotTrigger(
string path, Exception exceptionToThrow)
{
@@ -440,8 +440,8 @@ public async Task Deleting_File_OtherEvent_ShouldNotTrigger(
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Deleting_File_ShouldConsiderBasePath(string path1, string path2,
Exception exceptionToThrow)
{
@@ -458,13 +458,13 @@ public async Task Deleting_File_ShouldConsiderBasePath(string path1, string path
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineAutoData(".", "foo", "f*o", true)]
- [InlineAutoData(".", "foo", "*fo", false)]
- [InlineAutoData("bar", "foo", "f*o", true)]
- [InlineAutoData("bar", "foo", "baz/f*o", false)]
- [InlineAutoData("bar", "foo", "/f*o", false)]
- [InlineAutoData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [AutoArguments(".", "foo", "f*o", true)]
+ [AutoArguments(".", "foo", "*fo", false)]
+ [AutoArguments("bar", "foo", "f*o", true)]
+ [AutoArguments("bar", "foo", "baz/f*o", false)]
+ [AutoArguments("bar", "foo", "/f*o", false)]
+ [AutoArguments("bar", "foo", "**/f*o", true)]
public async Task Deleting_File_ShouldConsiderGlobPattern(
string basePath, string fileName, string globPattern, bool expectedResult,
Exception exceptionToThrow)
@@ -496,9 +496,9 @@ public async Task Deleting_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task Deleting_File_ShouldUsePredicate(bool expectedResult, string path,
Exception exceptionToThrow)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemExtensionsTests.cs
index 2211e1ff1..4b9d12ec8 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemExtensionsTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests;
public class MockFileSystemExtensionsTests
{
- [Fact]
+ [Test]
public async Task GetDefaultDrive_WithoutDrives_ShouldThrowInvalidOperationException()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemInitializationTests.cs b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemInitializationTests.cs
index 75b66718b..d7436b977 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemInitializationTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemInitializationTests.cs
@@ -7,7 +7,7 @@ namespace Testably.Abstractions.Testing.Tests;
public class MockFileSystemInitializationTests
{
#if CAN_SIMULATE_OTHER_OS
- [Fact]
+ [Test]
public async Task MockFileSystem_WhenSimulatingLinux_ShouldBeLinux()
{
MockFileSystem sut = new(o => o
@@ -21,7 +21,7 @@ public async Task MockFileSystem_WhenSimulatingLinux_ShouldBeLinux()
#endif
#if CAN_SIMULATE_OTHER_OS
- [Fact]
+ [Test]
public async Task MockFileSystem_WhenSimulatingMacOS_ShouldBeMac()
{
MockFileSystem sut = new(o => o
@@ -35,7 +35,7 @@ public async Task MockFileSystem_WhenSimulatingMacOS_ShouldBeMac()
#endif
#if CAN_SIMULATE_OTHER_OS
- [Fact]
+ [Test]
public async Task MockFileSystem_WhenSimulatingWindows_ShouldBeWindows()
{
MockFileSystem sut = new(o => o
@@ -48,7 +48,7 @@ public async Task MockFileSystem_WhenSimulatingWindows_ShouldBeWindows()
}
#endif
- [Fact]
+ [Test]
public async Task MockFileSystem_WithCurrentDirectory_ShouldInitializeCurrentDirectory()
{
string expected = Directory.GetCurrentDirectory();
@@ -59,8 +59,8 @@ public async Task MockFileSystem_WithCurrentDirectory_ShouldInitializeCurrentDir
await That(result).IsEqualTo(expected);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task MockFileSystem_WithExplicitCurrentDirectory_ShouldInitializeCurrentDirectory(
string path)
{
@@ -72,7 +72,7 @@ public async Task MockFileSystem_WithExplicitCurrentDirectory_ShouldInitializeCu
await That(result).IsEqualTo(expected);
}
- [Fact]
+ [Test]
public async Task
MockFileSystem_WithoutCurrentDirectory_ShouldUseDefaultDriveAsCurrentDirectory()
{
@@ -85,8 +85,8 @@ public async Task
}
#if CAN_SIMULATE_OTHER_OS
- [Theory]
- [MemberData(nameof(ValidOperatingSystems))]
+ [Test]
+ [MethodDataSource(nameof(ValidOperatingSystems))]
public async Task SimulatingOperatingSystem_ValidOSPlatform_ShouldSetOperatingSystem(
SimulationMode simulationMode)
{
@@ -99,7 +99,7 @@ public async Task SimulatingOperatingSystem_ValidOSPlatform_ShouldSetOperatingSy
}
#endif
- [Fact]
+ [Test]
public async Task UseCurrentDirectory_Empty_ShouldUseCurrentDirectory()
{
string expected = Directory.GetCurrentDirectory();
@@ -111,8 +111,8 @@ public async Task UseCurrentDirectory_Empty_ShouldUseCurrentDirectory()
await That(sut.CurrentDirectory).IsEqualTo(expected);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task UseCurrentDirectory_WithPath_ShouldUsePathCurrentDirectory(string path)
{
MockFileSystem.MockFileSystemOptions sut = new();
@@ -123,8 +123,8 @@ public async Task UseCurrentDirectory_WithPath_ShouldUsePathCurrentDirectory(str
await That(sut.CurrentDirectory).IsEqualTo(path);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task UseRandomProvider_ShouldUseFixedRandomValue(int fixedRandomValue)
{
MockFileSystem fileSystem = new(options => options
@@ -139,8 +139,8 @@ public async Task UseRandomProvider_ShouldUseFixedRandomValue(int fixedRandomVal
await That(results).All().AreEqualTo(fixedRandomValue);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task UseTimeSystem_ShouldUseProvidedTimeSystem(int offsetSeconds)
{
DateTime simulatedNow = DateTime.Now.AddSeconds(offsetSeconds);
@@ -154,12 +154,12 @@ public async Task UseTimeSystem_ShouldUseProvidedTimeSystem(int offsetSeconds)
await That(result).IsEqualTo(simulatedNow);
}
- #region Helpers
-
#if CAN_SIMULATE_OTHER_OS
- public static TheoryData ValidOperatingSystems()
- => new(SimulationMode.Linux, SimulationMode.MacOS, SimulationMode.Windows);
+ public static IEnumerable ValidOperatingSystems()
+ {
+ yield return SimulationMode.Linux;
+ yield return SimulationMode.MacOS;
+ yield return SimulationMode.Windows;
+ }
#endif
-
- #endregion
}
diff --git a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemTests.cs b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemTests.cs
index caf3c0831..f8294fce1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/MockFileSystemTests.cs
@@ -12,8 +12,8 @@ namespace Testably.Abstractions.Testing.Tests;
public class MockFileSystemTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FileSystemMock_File_Decrypt(string path, string contents)
{
MockFileSystem sut = new();
@@ -29,8 +29,8 @@ public async Task FileSystemMock_File_Decrypt(string path, string contents)
await That(sut.File.ReadAllText(path)).IsEqualTo(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FileSystemMock_File_Encrypt(string path, string contents)
{
MockFileSystem sut = new();
@@ -43,8 +43,8 @@ public async Task FileSystemMock_File_Encrypt(string path, string contents)
await That(sut.File.ReadAllText(path)).IsNotEqualTo(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FileSystemMock_FileInfo_Decrypt(string path, string contents)
{
MockFileSystem sut = new();
@@ -60,8 +60,8 @@ public async Task FileSystemMock_FileInfo_Decrypt(string path, string contents)
await That(sut.File.ReadAllText(path)).IsEqualTo(contents);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FileSystemMock_FileInfo_Encrypt(string path, string contents)
{
MockFileSystem sut = new();
@@ -74,7 +74,7 @@ public async Task FileSystemMock_FileInfo_Encrypt(string path, string contents)
await That(sut.File.ReadAllText(path)).IsNotEqualTo(contents);
}
- [Fact]
+ [Test]
public async Task FileSystemMock_ShouldBeInitializedWithADefaultDrive()
{
MockFileSystem sut = new();
@@ -91,10 +91,10 @@ public async Task FileSystemMock_ShouldBeInitializedWithADefaultDrive()
await That(drive.VolumeLabel).IsNotNullOrEmpty();
}
- [Theory]
- [InlineData("A:\\")]
- [InlineData("G:\\")]
- [InlineData("z:\\")]
+ [Test]
+ [Arguments("A:\\")]
+ [Arguments("G:\\")]
+ [Arguments("z:\\")]
public async Task FileSystemMock_ShouldInitializeDriveFromCurrentDirectory(string driveName)
{
Skip.If(!Test.RunsOnWindows);
@@ -108,7 +108,7 @@ await That(drives)
.Contains(d => string.Equals(d.Name, driveName, StringComparison.Ordinal));
}
- [Fact]
+ [Test]
public async Task ToString_ShouldContainStorageInformation()
{
MockFileSystem sut = new();
@@ -119,8 +119,8 @@ public async Task ToString_ShouldContainStorageInformation()
await That(result).Contains("directories: 1, files: 1");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
WithAccessControl_Denied_CreateDirectoryShouldThrowUnauthorizedAccessException(
string path)
@@ -139,8 +139,8 @@ public async Task
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithAccessControl_ShouldConsiderPath(
string allowedPath, string deniedPath)
{
@@ -160,7 +160,7 @@ public async Task WithAccessControl_ShouldConsiderPath(
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task
WithAccessControlStrategy_OutsideWindows_ShouldThrowPlatformNotSupportedException()
{
@@ -177,8 +177,8 @@ await That(Act).Throws()
.WithMessage("Access control lists are only supported on Windows.");
}
- [Theory]
- [InlineData("D:\\")]
+ [Test]
+ [Arguments("D:\\")]
public async Task WithDrive_Duplicate_ShouldUpdateExistingDrive(string driveName)
{
Skip.IfNot(Test.RunsOnWindows, "Linux does not support different drives.");
@@ -195,7 +195,7 @@ public async Task WithDrive_Duplicate_ShouldUpdateExistingDrive(string driveName
await That(drive.TotalSize).IsEqualTo(200);
}
- [Fact]
+ [Test]
public async Task WithDrive_ExistingName_ShouldUpdateDrive()
{
MockFileSystem sut = new();
@@ -209,8 +209,8 @@ await That(drives).HasSingle()
.Matching(d => string.Equals(d.Name, driveName, StringComparison.Ordinal));
}
- [Theory]
- [InlineData("D:\\")]
+ [Test]
+ [Arguments("D:\\")]
public async Task WithDrive_NewName_ShouldCreateNewDrives(string driveName)
{
Skip.IfNot(Test.RunsOnWindows, "Linux does not support different drives.");
@@ -225,9 +225,9 @@ await That(drives).HasSingle()
.Matching(d => string.Equals(d.Name, driveName, StringComparison.Ordinal));
}
- [Theory]
- [InlineData("D")]
- [InlineData("D:")]
+ [Test]
+ [Arguments("D")]
+ [Arguments("D:")]
public async Task WithDrive_ShouldHavePathSeparatorSuffix(string driveName)
{
Skip.IfNot(Test.RunsOnWindows, "Linux does not support different drives.");
@@ -243,7 +243,7 @@ await That(drives).HasSingle().Matching(d
=> string.Equals(d.Name, expectedDriveName, StringComparison.Ordinal));
}
- [Fact]
+ [Test]
public async Task WithDrive_ShouldInitializeDrivesWithRootDirectory()
{
Skip.IfNot(Test.RunsOnWindows, "Linux does not support different drives.");
@@ -257,8 +257,8 @@ public async Task WithDrive_ShouldInitializeDrivesWithRootDirectory()
await That(fileSystemInfos).HasCount(0);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithDrive_WithCallback_ShouldUpdateDrive(long totalSize)
{
MockFileSystem sut = new();
@@ -272,8 +272,8 @@ public async Task WithDrive_WithCallback_ShouldUpdateDrive(long totalSize)
}
#if NET6_0_OR_GREATER
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSafeFileHandleStrategy_DefaultStrategy_ShouldUseMappedSafeFileHandleMock(
string path, string contents)
{
@@ -292,8 +292,8 @@ public async Task WithSafeFileHandleStrategy_DefaultStrategy_ShouldUseMappedSafe
#endif
#if NET6_0_OR_GREATER
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithSafeFileHandleStrategy_NullStrategy_ShouldThrowException(
string path, string contents)
{
@@ -307,8 +307,8 @@ void Act()
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithUncDrive_ShouldCreateUncDrive(
string path, string contents)
{
@@ -321,7 +321,7 @@ public async Task WithUncDrive_ShouldCreateUncDrive(
await That(result).IsEqualTo(contents);
}
- [Fact]
+ [Test]
public async Task WithUncDrive_ShouldInitializeDrivesWithRootDirectory()
{
MockFileSystem sut = new();
@@ -337,8 +337,8 @@ public async Task WithUncDrive_ShouldInitializeDrivesWithRootDirectory()
await That(fileSystemInfos).HasCount(0);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithUncDrive_ShouldNotBeIncludedInGetDrives(
string server)
{
@@ -354,8 +354,8 @@ public async Task WithUncDrive_ShouldNotBeIncludedInGetDrives(
await That(sut.DriveInfo.GetDrives().Length).IsEqualTo(expectedDrives);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithUncDrive_WriteBytes_ShouldReduceAvailableFreeSpace(
string server, string path, byte[] bytes)
{
@@ -372,7 +372,7 @@ public async Task WithUncDrive_WriteBytes_ShouldReduceAvailableFreeSpace(
}
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task
WithUnixFileModeStrategy_OnWindows_ShouldThrowPlatformNotSupportedException()
{
@@ -391,8 +391,8 @@ await That(Act).Throws()
#endif
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithUnixFileModeStrategy_ShouldConsiderPath(
string allowedPath, string deniedPath)
{
@@ -413,8 +413,8 @@ public async Task WithUnixFileModeStrategy_ShouldConsiderPath(
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WriteAllText_OnUncPath_ShouldThrowDirectoryNotFoundException(
string path, string contents)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/MockRandomSystemTests.cs b/Tests/Testably.Abstractions.Testing.Tests/MockRandomSystemTests.cs
index ad99ffcd0..360f846b2 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/MockRandomSystemTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/MockRandomSystemTests.cs
@@ -2,7 +2,7 @@
public class MockRandomSystemTests
{
- [Fact]
+ [Test]
public async Task ToString_ShouldContainMockRandomSystem()
{
MockRandomSystem randomSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/MockTimeSystemTests.cs b/Tests/Testably.Abstractions.Testing.Tests/MockTimeSystemTests.cs
index b9d6f7146..0af1aca69 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/MockTimeSystemTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/MockTimeSystemTests.cs
@@ -5,57 +5,57 @@ namespace Testably.Abstractions.Testing.Tests;
public class MockTimeSystemTests
{
- [Fact]
+ [Test]
public async Task Delay_Infinite_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
Exception? exception =
await Record.ExceptionAsync(()
- => timeSystem.Task.Delay(Timeout.Infinite, TestContext.Current.CancellationToken));
+ => timeSystem.Task.Delay(Timeout.Infinite, TestContext.Current!.Execution.CancellationToken));
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Delay_InfiniteTimeSpan_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
Exception? exception =
await Record.ExceptionAsync(()
=> timeSystem.Task.Delay(Timeout.InfiniteTimeSpan,
- TestContext.Current.CancellationToken));
+ TestContext.Current!.Execution.CancellationToken));
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Delay_LessThanInfinite_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
async Task Act()
- => await timeSystem.Task.Delay(-2, TestContext.Current.CancellationToken);
+ => await timeSystem.Task.Delay(-2, TestContext.Current!.Execution.CancellationToken);
await That(Act).ThrowsExactly()
.WithParamName("millisecondsDelay");
}
- [Fact]
+ [Test]
public async Task Delay_LessThanInfiniteTimeSpan_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
async Task Act()
=> await timeSystem.Task.Delay(TimeSpan.FromMilliseconds(-2),
- TestContext.Current.CancellationToken);
+ TestContext.Current!.Execution.CancellationToken);
await That(Act).ThrowsExactly().WithParamName("delay");
}
- [Theory]
- [InlineData(DateTimeKind.Local)]
- [InlineData(DateTimeKind.Unspecified)]
- [InlineData(DateTimeKind.Utc)]
+ [Test]
+ [Arguments(DateTimeKind.Local)]
+ [Arguments(DateTimeKind.Unspecified)]
+ [Arguments(DateTimeKind.Utc)]
public async Task DifferenceBetweenDateTimeNowAndDateTimeUtcNow_ShouldBeLocalTimeZoneOffsetFromUtc(DateTimeKind dateTimeKind)
{
DateTime now = TimeTestHelper.GetRandomTime(DateTimeKind.Local);
@@ -68,7 +68,7 @@ public async Task DifferenceBetweenDateTimeNowAndDateTimeUtcNow_ShouldBeLocalTim
await That(actualDifference).IsEqualTo(expectedDifference);
}
- [Fact]
+ [Test]
public async Task Sleep_Infinite_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
@@ -78,7 +78,7 @@ public async Task Sleep_Infinite_ShouldNotThrowException()
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Sleep_InfiniteTimeSpan_ShouldNotThrowException()
{
MockTimeSystem timeSystem = new();
@@ -88,7 +88,7 @@ public async Task Sleep_InfiniteTimeSpan_ShouldNotThrowException()
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Sleep_LessThanInfinite_ShouldThrowArgumentOutOfRangeException()
{
MockTimeSystem timeSystem = new();
@@ -98,7 +98,7 @@ public async Task Sleep_LessThanInfinite_ShouldThrowArgumentOutOfRangeException(
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task Sleep_LessThanInfiniteTimeSpan_ShouldThrowArgumentOutOfRangeException()
{
MockTimeSystem timeSystem = new();
@@ -109,7 +109,7 @@ public async Task Sleep_LessThanInfiniteTimeSpan_ShouldThrowArgumentOutOfRangeEx
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task ToString_WithFixedContainer_ShouldContainTimeProvider()
{
DateTime now = TimeTestHelper.GetRandomTime();
@@ -121,7 +121,7 @@ public async Task ToString_WithFixedContainer_ShouldContainTimeProvider()
await That(result).Contains($"{now}Z");
}
- [Fact]
+ [Test]
public async Task ToString_WithNowContainer_ShouldContainTimeProvider()
{
MockTimeSystem timeSystem = new(TimeProvider.Now());
@@ -132,7 +132,7 @@ public async Task ToString_WithNowContainer_ShouldContainTimeProvider()
await That(result).Contains($"{timeSystem.DateTime.UtcNow}Z");
}
- [Fact]
+ [Test]
public async Task ToString_WithRandomContainer_ShouldContainTimeProvider()
{
MockTimeSystem timeSystem = new(TimeProvider.Random());
diff --git a/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.WithExecuteWhileWaiting.cs b/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.WithExecuteWhileWaiting.cs
index e01554622..81875189b 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.WithExecuteWhileWaiting.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.WithExecuteWhileWaiting.cs
@@ -2,8 +2,8 @@ namespace Testably.Abstractions.Testing.Tests;
public partial class NotificationHandlerExtensionsTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnChanged_File_OtherEvent_ShouldNotTrigger(
string path)
{
@@ -24,8 +24,8 @@ public async Task WithExecuteWhileWaiting_OnChanged_File_OtherEvent_ShouldNotTri
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldConsiderBasePath(string path1,
string path2)
{
@@ -48,13 +48,13 @@ public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldConsiderBasePath(
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -86,8 +86,8 @@ public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldConsiderGlobPatte
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldNotifyWhenFileIsChanged(
string path)
{
@@ -105,9 +105,9 @@ public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldNotifyWhenFileIsC
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldUsePredicate(bool expectedResult,
string path)
{
@@ -138,8 +138,8 @@ public async Task WithExecuteWhileWaiting_OnChanged_File_ShouldUsePredicate(bool
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnCreated_Directory_OtherEvent_ShouldNotTrigger(
string path)
{
@@ -161,8 +161,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_Directory_OtherEvent_ShouldN
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldConsiderBasePath(
string path1, string path2)
{
@@ -183,13 +183,13 @@ public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldConsiderBase
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -221,8 +221,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldConsiderGlob
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
WithExecuteWhileWaiting_OnCreated_Directory_ShouldNotifyWhenDirectoryIsCreated(string path)
{
@@ -239,9 +239,9 @@ public async Task
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldUsePredicate(
bool expectedResult, string path)
{
@@ -271,8 +271,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_Directory_ShouldUsePredicate
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnCreated_File_OtherEvent_ShouldNotTrigger(
string path)
{
@@ -294,8 +294,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_File_OtherEvent_ShouldNotTri
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldConsiderBasePath(string path1,
string path2)
{
@@ -316,13 +316,13 @@ public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldConsiderBasePath(
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -354,8 +354,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldConsiderGlobPatte
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldNotifyWhenFileIsCreated(
string path)
{
@@ -372,9 +372,9 @@ public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldNotifyWhenFileIsC
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldUsePredicate(bool expectedResult,
string path)
{
@@ -404,8 +404,8 @@ public async Task WithExecuteWhileWaiting_OnCreated_File_ShouldUsePredicate(bool
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnDeleted_Directory_OtherEvent_ShouldNotTrigger(
string path)
{
@@ -426,8 +426,8 @@ public async Task WithExecuteWhileWaiting_OnDeleted_Directory_OtherEvent_ShouldN
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldConsiderBasePath(
string path1, string path2)
{
@@ -450,13 +450,13 @@ public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldConsiderBase
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldConsiderGlobPattern(
string basePath, string directoryName, string globPattern, bool expectedResult)
{
@@ -489,8 +489,8 @@ public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldConsiderGlob
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
WithExecuteWhileWaiting_OnDeleted_Directory_ShouldNotifyWhenDirectoryIsDeleted(string path)
{
@@ -508,9 +508,9 @@ public async Task
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldUsePredicate(
bool expectedResult, string path)
{
@@ -541,8 +541,8 @@ public async Task WithExecuteWhileWaiting_OnDeleted_Directory_ShouldUsePredicate
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnDeleted_File_OtherEvent_ShouldNotTrigger(
string path)
{
@@ -563,8 +563,8 @@ public async Task WithExecuteWhileWaiting_OnDeleted_File_OtherEvent_ShouldNotTri
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldConsiderBasePath(string path1,
string path2)
{
@@ -587,13 +587,13 @@ public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldConsiderBasePath(
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -626,8 +626,8 @@ public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldConsiderGlobPatte
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldNotifyWhenFileIsDeleted(
string path)
{
@@ -645,9 +645,9 @@ public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldNotifyWhenFileIsD
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task WithExecuteWhileWaiting_OnDeleted_File_ShouldUsePredicate(bool expectedResult,
string path)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.cs
index 5d553fedd..4c307f851 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/NotificationHandlerExtensionsTests.cs
@@ -10,8 +10,8 @@ public partial class NotificationHandlerExtensionsTests
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnChanged_File_OtherEvent_ShouldNotTrigger(string path)
{
bool isNotified = false;
@@ -31,8 +31,8 @@ public async Task OnChanged_File_OtherEvent_ShouldNotTrigger(string path)
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnChanged_File_ShouldConsiderBasePath(string path1, string path2)
{
bool isNotified = false;
@@ -52,13 +52,13 @@ public async Task OnChanged_File_ShouldConsiderBasePath(string path1, string pat
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task OnChanged_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -88,8 +88,8 @@ public async Task OnChanged_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnChanged_File_ShouldNotifyWhenFileIsChanged(string path)
{
bool isNotified = false;
@@ -105,9 +105,9 @@ public async Task OnChanged_File_ShouldNotifyWhenFileIsChanged(string path)
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task OnChanged_File_ShouldUsePredicate(bool expectedResult, string path)
{
bool isNotified = false;
@@ -136,8 +136,8 @@ public async Task OnChanged_File_ShouldUsePredicate(bool expectedResult, string
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_Directory_OtherEvent_ShouldNotTrigger(string path)
{
bool isNotified = false;
@@ -157,8 +157,8 @@ public async Task OnCreated_Directory_OtherEvent_ShouldNotTrigger(string path)
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_Directory_ShouldConsiderBasePath(string path1, string path2)
{
bool isNotified = false;
@@ -177,13 +177,13 @@ public async Task OnCreated_Directory_ShouldConsiderBasePath(string path1, strin
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task OnCreated_Directory_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -214,8 +214,8 @@ public async Task OnCreated_Directory_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_Directory_ShouldNotifyWhenDirectoryIsCreated(string path)
{
bool isNotified = false;
@@ -229,9 +229,9 @@ public async Task OnCreated_Directory_ShouldNotifyWhenDirectoryIsCreated(string
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task OnCreated_Directory_ShouldUsePredicate(bool expectedResult, string path)
{
bool isNotified = false;
@@ -259,8 +259,8 @@ public async Task OnCreated_Directory_ShouldUsePredicate(bool expectedResult, st
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_File_OtherEvent_ShouldNotTrigger(string path)
{
bool isNotified = false;
@@ -280,8 +280,8 @@ public async Task OnCreated_File_OtherEvent_ShouldNotTrigger(string path)
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_File_ShouldConsiderBasePath(string path1, string path2)
{
bool isNotified = false;
@@ -300,13 +300,13 @@ public async Task OnCreated_File_ShouldConsiderBasePath(string path1, string pat
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task OnCreated_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -337,8 +337,8 @@ public async Task OnCreated_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnCreated_File_ShouldNotifyWhenFileIsCreated(string path)
{
bool isNotified = false;
@@ -352,9 +352,9 @@ public async Task OnCreated_File_ShouldNotifyWhenFileIsCreated(string path)
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task OnCreated_File_ShouldUsePredicate(bool expectedResult, string path)
{
bool isNotified = false;
@@ -382,8 +382,8 @@ public async Task OnCreated_File_ShouldUsePredicate(bool expectedResult, string
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_Directory_OtherEvent_ShouldNotTrigger(string path)
{
bool isNotified = false;
@@ -402,8 +402,8 @@ public async Task OnDeleted_Directory_OtherEvent_ShouldNotTrigger(string path)
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_Directory_ShouldConsiderBasePath(string path1, string path2)
{
bool isNotified = false;
@@ -424,13 +424,13 @@ public async Task OnDeleted_Directory_ShouldConsiderBasePath(string path1, strin
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task OnDeleted_Directory_ShouldConsiderGlobPattern(
string basePath, string directoryName, string globPattern, bool expectedResult)
{
@@ -462,8 +462,8 @@ public async Task OnDeleted_Directory_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_Directory_ShouldNotifyWhenDirectoryIsDeleted(string path)
{
bool isNotified = false;
@@ -478,9 +478,9 @@ public async Task OnDeleted_Directory_ShouldNotifyWhenDirectoryIsDeleted(string
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task OnDeleted_Directory_ShouldUsePredicate(bool expectedResult, string path)
{
bool isNotified = false;
@@ -509,8 +509,8 @@ public async Task OnDeleted_Directory_ShouldUsePredicate(bool expectedResult, st
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_File_OtherEvent_ShouldNotTrigger(string path)
{
bool isNotified = false;
@@ -529,8 +529,8 @@ public async Task OnDeleted_File_OtherEvent_ShouldNotTrigger(string path)
await That(isNotified).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_File_ShouldConsiderBasePath(string path1, string path2)
{
bool isNotified = false;
@@ -551,13 +551,13 @@ public async Task OnDeleted_File_ShouldConsiderBasePath(string path1, string pat
await That(isNotified).IsFalse();
}
- [Theory]
- [InlineData(".", "foo", "f*o", true)]
- [InlineData(".", "foo", "*fo", false)]
- [InlineData("bar", "foo", "f*o", true)]
- [InlineData("bar", "foo", "baz/f*o", false)]
- [InlineData("bar", "foo", "/f*o", false)]
- [InlineData("bar", "foo", "**/f*o", true)]
+ [Test]
+ [Arguments(".", "foo", "f*o", true)]
+ [Arguments(".", "foo", "*fo", false)]
+ [Arguments("bar", "foo", "f*o", true)]
+ [Arguments("bar", "foo", "baz/f*o", false)]
+ [Arguments("bar", "foo", "/f*o", false)]
+ [Arguments("bar", "foo", "**/f*o", true)]
public async Task OnDeleted_File_ShouldConsiderGlobPattern(
string directoryPath, string fileName, string globPattern, bool expectedResult)
{
@@ -589,8 +589,8 @@ public async Task OnDeleted_File_ShouldConsiderGlobPattern(
await That(isNotified).IsEqualTo(expectedResult);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task OnDeleted_File_ShouldNotifyWhenFileIsDeleted(string path)
{
bool isNotified = false;
@@ -605,9 +605,9 @@ public async Task OnDeleted_File_ShouldNotifyWhenFileIsDeleted(string path)
await That(isNotified).IsTrue();
}
- [Theory]
- [InlineAutoData(false)]
- [InlineAutoData(true)]
+ [Test]
+ [AutoArguments(false)]
+ [AutoArguments(true)]
public async Task OnDeleted_File_ShouldUsePredicate(bool expectedResult, string path)
{
bool isNotified = false;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.WaitAsync.cs b/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.WaitAsync.cs
index 53f9f383c..f17af2ae1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.WaitAsync.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.WaitAsync.cs
@@ -6,7 +6,7 @@ public partial class NotificationTests
{
public sealed class WaitAsync
{
- [Fact]
+ [Test]
public async Task AwaitableCallback_Amount_ShouldOnlyReturnAfterNumberOfCallbacks()
{
MockTimeSystem timeSystem = new();
@@ -22,21 +22,21 @@ public async Task AwaitableCallback_Amount_ShouldOnlyReturnAfterNumberOfCallback
_ = Task.Run(async () =>
{
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
TimeSpan[] result = await onThreadSleep.WaitAsync(count: 7,
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
await That(receivedCount).IsGreaterThanOrEqualTo(7);
await That(result.Length).IsEqualTo(7);
}
- [Fact]
+ [Test]
public async Task
AwaitableCallback_CancellationTokenCancelled_ShouldThrowOperationCancelledException()
{
@@ -54,7 +54,7 @@ public async Task
try
{
// Delay larger than cancellation after 10ms
- ms.Wait(TestContext.Current.CancellationToken);
+ ms.Wait(TestContext.Current!.Execution.CancellationToken);
timeSystem.Thread.Sleep(1);
}
catch (ObjectDisposedException)
@@ -75,7 +75,7 @@ public async Task
ms.Set();
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_ShouldWaitForCallbackExecution()
{
using ManualResetEventSlim ms = new();
@@ -97,17 +97,17 @@ public async Task AwaitableCallback_ShouldWaitForCallbackExecution()
while (!ms.IsSet)
{
timeSystem.Thread.Sleep(1);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
}
catch (ObjectDisposedException)
{
// Ignore any ObjectDisposedException
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
await onThreadSleep.WaitAsync(
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
await That(isCalled).IsTrue();
}
finally
@@ -116,7 +116,7 @@ await onThreadSleep.WaitAsync(
}
}
- [Fact]
+ [Test]
public async Task
AwaitableCallback_TimeoutExpired_ShouldThrowOperationCancelledException()
{
@@ -134,7 +134,7 @@ public async Task
try
{
// Delay larger than timeout of 10ms
- ms.Wait(TestContext.Current.CancellationToken);
+ ms.Wait(TestContext.Current!.Execution.CancellationToken);
timeSystem.Thread.Sleep(1);
}
catch (ObjectDisposedException)
@@ -146,7 +146,7 @@ public async Task
Exception? exception = await Record.ExceptionAsync(async () =>
{
await onThreadSleep.WaitAsync(1, TimeSpan.FromMilliseconds(10),
- TestContext.Current.CancellationToken);
+ TestContext.Current!.Execution.CancellationToken);
});
await That(exception).IsExactly();
@@ -154,7 +154,7 @@ await onThreadSleep.WaitAsync(1, TimeSpan.FromMilliseconds(10),
ms.Set();
}
- [Fact]
+ [Test]
public async Task
AwaitableCallback_WaitAsync_AfterDispose_ShouldThrowObjectDisposedException()
{
@@ -167,14 +167,14 @@ public async Task
async Task Act()
{
await onThreadSleep.WaitAsync(timeout: 20000,
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
}
await That(Act).ThrowsExactly()
.WithMessage("The awaitable callback is already disposed.");
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackExecution()
{
int secondThreadMilliseconds = 42;
@@ -185,29 +185,29 @@ public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackE
using IAwaitableCallback onThreadSleep =
timeSystem.On.ThreadSleep();
- _ = Task.Delay(50, TestContext.Current.CancellationToken)
+ _ = Task.Delay(50, TestContext.Current!.Execution.CancellationToken)
.ContinueWith(_ => timeSystem.Thread.Sleep(firstThreadMilliseconds),
- TestContext.Current.CancellationToken)
+ TestContext.Current!.Execution.CancellationToken)
.ContinueWith(
- async _ => await Task.Delay(20, TestContext.Current.CancellationToken),
- TestContext.Current.CancellationToken)
+ async _ => await Task.Delay(20, TestContext.Current!.Execution.CancellationToken),
+ TestContext.Current!.Execution.CancellationToken)
.ContinueWith(_ => timeSystem.Thread.Sleep(secondThreadMilliseconds),
- TestContext.Current.CancellationToken);
+ TestContext.Current!.Execution.CancellationToken);
TimeSpan[] result1 =
await onThreadSleep.WaitAsync(
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
TimeSpan[] result2 =
await onThreadSleep.WaitAsync(
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
await That(result1).HasSingle().Which
.Satisfies(f => f.Milliseconds == firstThreadMilliseconds);
await That(result2).HasSingle().Which
.Satisfies(f => f.Milliseconds == secondThreadMilliseconds);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Execute_ShouldBeExecutedBeforeWait(int milliseconds)
{
MockTimeSystem timeSystem = new();
@@ -219,11 +219,11 @@ public async Task Execute_ShouldBeExecutedBeforeWait(int milliseconds)
receivedMilliseconds = (int)t.TotalMilliseconds;
});
timeSystem.Thread.Sleep(milliseconds);
- await onThreadSleep.WaitAsync(cancellationToken: TestContext.Current.CancellationToken);
+ await onThreadSleep.WaitAsync(cancellationToken: TestContext.Current!.Execution.CancellationToken);
await That(receivedMilliseconds).IsEqualTo(milliseconds);
}
- [Fact]
+ [Test]
public async Task ExecuteWhileWaiting_ShouldExecuteCallback()
{
MockTimeSystem timeSystem = new();
@@ -234,7 +234,7 @@ public async Task ExecuteWhileWaiting_ShouldExecuteCallback()
timeSystem.Thread.Sleep(10);
TimeSpan[] result =
await onThreadSleep.WaitAsync(
- cancellationToken: TestContext.Current.CancellationToken);
+ cancellationToken: TestContext.Current!.Execution.CancellationToken);
await That(result).HasSingle().Which.Satisfies(f => f.Milliseconds == 10);
}
}
diff --git a/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs b/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs
index a066814b5..0f08fbcb9 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests;
public partial class NotificationTests
{
- [Fact]
+ [Test]
public async Task AwaitableCallback_Amount_ShouldOnlyReturnAfterNumberOfCallbacks()
{
MockTimeSystem timeSystem = new();
@@ -20,19 +20,19 @@ public async Task AwaitableCallback_Amount_ShouldOnlyReturnAfterNumberOfCallback
_ = Task.Run(async () =>
{
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
wait.Wait(7);
await That(receivedCount).IsGreaterThanOrEqualTo(7);
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_Dispose_ShouldStopListening()
{
MockTimeSystem timeSystem = new();
@@ -46,11 +46,11 @@ public async Task AwaitableCallback_Dispose_ShouldStopListening()
wait.Dispose();
timeSystem.Thread.Sleep(1);
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
await That(isCalled).IsFalse();
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_DisposeFromExecuteWhileWaiting_ShouldStopListening()
{
MockTimeSystem timeSystem = new();
@@ -65,11 +65,11 @@ public async Task AwaitableCallback_DisposeFromExecuteWhileWaiting_ShouldStopLis
wait.Dispose();
timeSystem.Thread.Sleep(1);
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
await That(isCalled).IsFalse();
}
- [Fact]
+ [Test]
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("TODO: Remove once the obsolete filter overload is removed from the public API.")]
#endif
@@ -85,19 +85,19 @@ public async Task AwaitableCallback_Filter_ShouldOnlyUpdateAfterFilteredValue()
_ = Task.Run(async () =>
{
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
wait.Wait(t => t.TotalMilliseconds > 6);
await That(receivedCount).IsGreaterThanOrEqualTo(6);
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_Predicate_ShouldOnlyUpdateAfterFilteredValue()
{
MockTimeSystem timeSystem = new();
@@ -113,11 +113,11 @@ public async Task AwaitableCallback_Predicate_ShouldOnlyUpdateAfterFilteredValue
// ReSharper disable once AccessToDisposedClosure
try
{
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
ms.Set();
@@ -126,13 +126,13 @@ public async Task AwaitableCallback_Predicate_ShouldOnlyUpdateAfterFilteredValue
{
// Ignore any ObjectDisposedException
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
- ms.Wait(30000, TestContext.Current.CancellationToken);
+ ms.Wait(30000, TestContext.Current!.Execution.CancellationToken);
await That(receivedCount).IsLessThanOrEqualTo(4);
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_ShouldWaitForCallbackExecution()
{
using ManualResetEventSlim ms = new();
@@ -154,14 +154,14 @@ public async Task AwaitableCallback_ShouldWaitForCallbackExecution()
while (!ms.IsSet)
{
timeSystem.Thread.Sleep(1);
- await Task.Delay(1, TestContext.Current.CancellationToken);
+ await Task.Delay(1, TestContext.Current!.Execution.CancellationToken);
}
}
catch (ObjectDisposedException)
{
// Ignore any ObjectDisposedException
}
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
wait.Wait();
await That(isCalled).IsTrue();
@@ -172,7 +172,7 @@ public async Task AwaitableCallback_ShouldWaitForCallbackExecution()
}
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_TimeoutExpired_ShouldThrowTimeoutException()
{
MockTimeSystem timeSystem = new();
@@ -189,7 +189,7 @@ public async Task AwaitableCallback_TimeoutExpired_ShouldThrowTimeoutException()
try
{
// Delay larger than timeout of 10ms
- ms.Wait(TestContext.Current.CancellationToken);
+ ms.Wait(TestContext.Current!.Execution.CancellationToken);
timeSystem.Thread.Sleep(1);
}
catch (ObjectDisposedException)
@@ -208,7 +208,7 @@ public async Task AwaitableCallback_TimeoutExpired_ShouldThrowTimeoutException()
ms.Set();
}
- [Fact]
+ [Test]
public async Task
AwaitableCallback_Wait_AfterDispose_ShouldThrowObjectDisposedException()
{
@@ -227,7 +227,7 @@ await That(Act).ThrowsExactly()
.WithMessage("The awaitable callback is already disposed.");
}
- [Fact]
+ [Test]
public async Task
AwaitableCallback_Wait_WithCount_AfterDispose_ShouldThrowObjectDisposedException()
{
@@ -246,7 +246,7 @@ await That(Act).ThrowsExactly()
.WithMessage("The awaitable callback is already disposed.");
}
- [Fact]
+ [Test]
public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackExecution()
{
int secondThreadMilliseconds = 42;
@@ -269,7 +269,7 @@ public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackE
// ReSharper disable once AccessToDisposedClosure
try
{
- listening.Wait(1000, TestContext.Current.CancellationToken);
+ listening.Wait(1000, TestContext.Current!.Execution.CancellationToken);
timeSystem.Thread.Sleep(firstThreadMilliseconds);
}
catch (ObjectDisposedException)
@@ -286,7 +286,7 @@ public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackE
// ReSharper disable once AccessToDisposedClosure
try
{
- listening.Wait(1000, TestContext.Current.CancellationToken);
+ listening.Wait(1000, TestContext.Current!.Execution.CancellationToken);
// ReSharper disable once AccessToDisposedClosure
if (!ms.IsSet)
{
@@ -305,8 +305,8 @@ public async Task AwaitableCallback_WaitedPreviously_ShouldWaitAgainForCallbackE
await That(isCalledFromSecondThread).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("TODO: Remove once the obsolete ExecuteWhileWaiting method is removed from the public API.")]
#endif
@@ -334,8 +334,8 @@ public async Task Execute_ShouldBeExecutedBeforeWait(int milliseconds)
await That(isExecuted).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("TODO: Remove once the obsolete ExecuteWhileWaiting method is removed from the public API.")]
#endif
@@ -366,7 +366,7 @@ public async Task Execute_WithReturnValue_ShouldBeExecutedAndReturnValue(
await That(isExecuted).IsTrue();
}
- [Fact]
+ [Test]
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("TODO: Remove once the obsolete ExecuteWhileWaiting method is removed from the public API.")]
#endif
@@ -387,8 +387,8 @@ public async Task ExecuteWhileWaiting_ShouldExecuteCallback()
await That(isExecuted).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
#if MarkExecuteWhileWaitingNotificationObsolete
[Obsolete("TODO: Remove once the obsolete ExecuteWhileWaiting method is removed from the public API.")]
#endif
diff --git a/Tests/Testably.Abstractions.Testing.Tests/RandomProvider.GeneratorTests.cs b/Tests/Testably.Abstractions.Testing.Tests/RandomProvider.GeneratorTests.cs
index ac472e519..f8ed1af63 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/RandomProvider.GeneratorTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/RandomProvider.GeneratorTests.cs
@@ -8,7 +8,7 @@ public partial class RandomProviderTests
{
public class GeneratorTests
{
- [Fact]
+ [Test]
public async Task Dispose_ShouldThrowObjectDisposedExceptionOnGetNext()
{
int maxRange = 100;
@@ -26,8 +26,8 @@ public async Task Dispose_ShouldThrowObjectDisposedExceptionOnGetNext()
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromArray_Overflow_ShouldStartAgain(Guid[] values)
{
RandomProvider.Generator sut = RandomProvider.Generator.FromArray(values);
@@ -41,8 +41,8 @@ public async Task FromArray_Overflow_ShouldStartAgain(Guid[] values)
await That(results).IsEqualTo([.. values, .. values]).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromArray_ShouldIterateThroughArrayValue(Guid[] values)
{
RandomProvider.Generator sut = RandomProvider.Generator.FromArray(values);
@@ -56,7 +56,7 @@ public async Task FromArray_ShouldIterateThroughArrayValue(Guid[] values)
await That(results).IsEqualTo(values).InAnyOrder();
}
- [Fact]
+ [Test]
public async Task FromCallback_ShouldExecuteCallback()
{
int iterations = 30;
@@ -75,7 +75,7 @@ public async Task FromCallback_ShouldExecuteCallback()
await That(results).IsEqualTo(Enumerable.Range(startValue, iterations)).InAnyOrder();
}
- [Fact]
+ [Test]
public async Task FromEnumerable_Dispose_ShouldDisposeEnumerator()
{
EnumerableMock enumerable = new();
@@ -87,7 +87,7 @@ public async Task FromEnumerable_Dispose_ShouldDisposeEnumerator()
await That(enumerable.Enumerator.IsDisposed).IsTrue();
}
- [Fact]
+ [Test]
public async Task FromEnumerable_Overflow_List_ShouldResetEnumerator()
{
int maxRange = 100;
@@ -106,7 +106,7 @@ public async Task FromEnumerable_Overflow_List_ShouldResetEnumerator()
await That(results).IsEqualTo([.. values, .. values]).InAnyOrder();
}
- [Fact]
+ [Test]
public async Task FromEnumerable_Overflow_ShouldResetEnumerator()
{
int maxRange = 100;
@@ -128,7 +128,7 @@ public async Task FromEnumerable_Overflow_ShouldResetEnumerator()
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task FromEnumerable_ShouldReturnEnumerableValues()
{
int maxRange = 100;
@@ -145,8 +145,8 @@ public async Task FromEnumerable_ShouldReturnEnumerableValues()
await That(results).IsEqualTo(Enumerable.Range(0, maxRange)).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromValue_ShouldReturnFixedValue(Guid value)
{
int maxRange = 100;
@@ -161,8 +161,8 @@ public async Task FromValue_ShouldReturnFixedValue(Guid value)
await That(results).All().AreEquivalentTo(value);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Operator_FromArray(Guid[] values)
{
RandomProvider.Generator sut = values;
@@ -176,8 +176,8 @@ public async Task Operator_FromArray(Guid[] values)
await That(results).IsEqualTo(values).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Operator_FromCallback(Guid value)
{
int maxRange = 100;
@@ -194,8 +194,8 @@ public async Task Operator_FromCallback(Guid value)
await That(results).All().AreEquivalentTo(value);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Operator_FromValue(Guid value)
{
int maxRange = 100;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/RandomProviderTests.cs b/Tests/Testably.Abstractions.Testing.Tests/RandomProviderTests.cs
index b44f554ba..7649408ac 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/RandomProviderTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/RandomProviderTests.cs
@@ -7,7 +7,7 @@ namespace Testably.Abstractions.Testing.Tests;
public partial class RandomProviderTests
{
- [Fact]
+ [Test]
public async Task Default_ShouldReturnRandomGuid()
{
List results = [];
@@ -22,7 +22,7 @@ public async Task Default_ShouldReturnRandomGuid()
await That(results).AreAllUnique();
}
- [Fact]
+ [Test]
public async Task Default_ShouldReturnRandomNumbers()
{
List results = [];
@@ -37,8 +37,8 @@ public async Task Default_ShouldReturnRandomNumbers()
await That(results).AreAllUnique();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateGuid_ShouldReturnSpecifiedGuid(Guid guid)
{
List results = [];
@@ -53,8 +53,8 @@ public async Task GenerateGuid_ShouldReturnSpecifiedGuid(Guid guid)
await That(results).All().AreEqualTo(guid);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateGuid_ShouldReturnSpecifiedGuids(Guid[] guids)
{
List results = [];
@@ -69,8 +69,8 @@ public async Task GenerateGuid_ShouldReturnSpecifiedGuids(Guid[] guids)
await That(results).Contains(guids).IgnoringInterspersedItems();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_ShouldReturnSpecifiedValue(int seed, int value)
{
List results = [];
@@ -86,8 +86,8 @@ public async Task GenerateRandom_Next_ShouldReturnSpecifiedValue(int seed, int v
await That(results).All().AreEqualTo(value);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_ShouldReturnSpecifiedValues(int seed, int[] values)
{
List results = [];
@@ -103,8 +103,8 @@ public async Task GenerateRandom_Next_ShouldReturnSpecifiedValues(int seed, int[
await That(results).Contains(values).IgnoringInterspersedItems();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_WithMaxValue_ShouldReturnSpecifiedValue(
int seed, int value)
{
@@ -123,8 +123,8 @@ public async Task GenerateRandom_Next_WithMaxValue_ShouldReturnSpecifiedValue(
await That(results).All().AreEqualTo(expectedValue);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_WithMinAndMaxValue_Larger_ShouldReturnSpecifiedValue(
int seed, int value)
{
@@ -144,8 +144,8 @@ public async Task GenerateRandom_Next_WithMinAndMaxValue_Larger_ShouldReturnSpec
await That(results).All().AreEqualTo(expectedValue);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_WithMinAndMaxValue_Smaller_ShouldReturnSpecifiedValue(
int seed, int value)
{
@@ -164,8 +164,8 @@ public async Task GenerateRandom_Next_WithMinAndMaxValue_Smaller_ShouldReturnSpe
await That(results).All().AreEqualTo(minValue);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_Next_WithoutGenerator_ShouldReturnRandomValues(int seed)
{
List results = [];
@@ -181,8 +181,8 @@ public async Task GenerateRandom_Next_WithoutGenerator_ShouldReturnRandomValues(
await That(results).AreAllUnique();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_ShouldReturnSpecifiedValue(
int seed, byte[] value)
{
@@ -202,8 +202,8 @@ public async Task GenerateRandom_NextBytes_ShouldReturnSpecifiedValue(
}
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_Span_ShouldReturnSpecifiedValue(
int seed, byte[] value)
{
@@ -224,8 +224,8 @@ public async Task GenerateRandom_NextBytes_Span_ShouldReturnSpecifiedValue(
#endif
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_Span_WithoutGenerator_ShouldReturnRandomValues(
int seed)
{
@@ -246,8 +246,8 @@ public async Task GenerateRandom_NextBytes_Span_WithoutGenerator_ShouldReturnRan
#endif
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_Span_WithSmallerBuffer_ShouldReturnPartlyInitializedBytes(
int seed, byte[] value)
{
@@ -271,8 +271,8 @@ public async Task GenerateRandom_NextBytes_Span_WithSmallerBuffer_ShouldReturnPa
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_WithoutGenerator_ShouldReturnRandomValues(
int seed)
{
@@ -291,8 +291,8 @@ public async Task GenerateRandom_NextBytes_WithoutGenerator_ShouldReturnRandomVa
await That(results).AreAllUnique();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextBytes_WithSmallerBuffer_ShouldReturnPartlyInitializedBytes(
int seed, byte[] value)
{
@@ -316,8 +316,8 @@ public async Task GenerateRandom_NextBytes_WithSmallerBuffer_ShouldReturnPartlyI
await That(results).All().ComplyWith(v => v.IsEqualTo(expected));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextDouble_ShouldReturnSpecifiedValue(
int seed, double value)
{
@@ -334,8 +334,8 @@ public async Task GenerateRandom_NextDouble_ShouldReturnSpecifiedValue(
await That(results).All().AreEqualTo(value);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextDouble_WithoutGenerator_ShouldReturnRandomValues(
int seed)
{
@@ -353,8 +353,8 @@ public async Task GenerateRandom_NextDouble_WithoutGenerator_ShouldReturnRandomV
}
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextInt64_ShouldReturnSpecifiedValue(int seed, long value)
{
List results = [];
@@ -372,8 +372,8 @@ public async Task GenerateRandom_NextInt64_ShouldReturnSpecifiedValue(int seed,
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextInt64_WithMaxValue_ShouldReturnSpecifiedValue(
int seed, long value)
{
@@ -394,8 +394,8 @@ public async Task GenerateRandom_NextInt64_WithMaxValue_ShouldReturnSpecifiedVal
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextInt64_WithMinAndMaxValue_Larger_ShouldReturnSpecifiedValue(
int seed, long value)
{
@@ -417,8 +417,8 @@ public async Task GenerateRandom_NextInt64_WithMinAndMaxValue_Larger_ShouldRetur
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextInt64_WithMinAndMaxValue_Smaller_ShouldReturnSpecifiedValue(
int seed, long value)
{
@@ -440,8 +440,8 @@ public async Task GenerateRandom_NextInt64_WithMinAndMaxValue_Smaller_ShouldRetu
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextInt64_WithoutGenerator_ShouldReturnRandomValues(
int seed)
{
@@ -460,8 +460,8 @@ public async Task GenerateRandom_NextInt64_WithoutGenerator_ShouldReturnRandomVa
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextSingle_ShouldReturnSpecifiedValue(
int seed, float value)
{
@@ -480,8 +480,8 @@ public async Task GenerateRandom_NextSingle_ShouldReturnSpecifiedValue(
#endif
#if FEATURE_RANDOM_ADVANCED
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GenerateRandom_NextSingle_WithoutGenerator_ShouldReturnRandomValues(
int seed)
{
@@ -499,7 +499,7 @@ public async Task GenerateRandom_NextSingle_WithoutGenerator_ShouldReturnRandomV
}
#endif
- [Fact]
+ [Test]
public async Task GetRandom_DefaultValue_ShouldReturnSharedRandom()
{
RandomProviderMock randomProvider = new();
@@ -516,8 +516,8 @@ public async Task GetRandom_DefaultValue_ShouldReturnSharedRandom()
await That(result1).IsNotEqualTo(result2).InAnyOrder();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task GetRandom_FixedSeed_ShouldReturnSeparateRandomInstances(int seed)
{
RandomProviderMock randomProvider = new();
@@ -535,8 +535,8 @@ public async Task GetRandom_FixedSeed_ShouldReturnSeparateRandomInstances(int se
}
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NextBytes_Span_WithoutByteGenerator_ShouldUseRealRandomValuesFromSeed(
int seed)
{
@@ -552,8 +552,8 @@ public async Task NextBytes_Span_WithoutByteGenerator_ShouldUseRealRandomValuesF
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task NextBytes_WithoutByteGenerator_ShouldUseRealRandomValuesFromSeed(
int seed)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/RandomSystem/RandomSystemExtensibilityTests.cs b/Tests/Testably.Abstractions.Testing.Tests/RandomSystem/RandomSystemExtensibilityTests.cs
index 0dea7dc3d..504dba40f 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/RandomSystem/RandomSystemExtensibilityTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/RandomSystem/RandomSystemExtensibilityTests.cs
@@ -1,22 +1,18 @@
+using System.Collections.Generic;
using Testably.Abstractions.RandomSystem;
namespace Testably.Abstractions.Testing.Tests.RandomSystem;
public class RandomSystemExtensibilityTests
{
- #region Test Setup
-
- public static TheoryData GetRandomSystems
- => new()
- {
- (IRandomSystem)new RealRandomSystem(),
- (IRandomSystem)new MockRandomSystem(),
- };
-
- #endregion
+ public static IEnumerable> GetRandomSystems()
+ {
+ yield return () => new RealRandomSystem();
+ yield return () => new MockRandomSystem();
+ }
- [Theory]
- [MemberData(nameof(GetRandomSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetRandomSystems))]
public async Task Guid_ShouldSetExtensionPoint(IRandomSystem randomSystem)
{
IGuid sut = randomSystem.Guid;
@@ -26,8 +22,8 @@ public async Task Guid_ShouldSetExtensionPoint(IRandomSystem randomSystem)
await That(result).IsEqualTo(randomSystem);
}
- [Theory]
- [MemberData(nameof(GetRandomSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetRandomSystems))]
public async Task RandomFactory_ShouldSetExtensionPoint(IRandomSystem randomSystem)
{
IRandomFactory sut = randomSystem.Random;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoFactoryStatisticsTests.cs
index c9c2805b7..4f5e65938 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoFactoryStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class DirectoryInfoFactoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_New_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -20,7 +20,7 @@ await That(sut.Statistics.DirectoryInfo).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_Wrap_DirectoryInfo_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -34,7 +34,7 @@ await That(sut.Statistics.DirectoryInfo).OnlyContainsMethodCall(
directoryInfo);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeDirectoryInfo()
{
IPathStatistics sut
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoStatisticsTests.cs
index 6bb94e644..8cc1b6f5e 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryInfoStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class DirectoryInfoStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_Create_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -19,7 +19,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_CreateAsSymbolicLink_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -34,7 +34,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_CreateSubdirectory_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -48,7 +48,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
path);
}
- [Fact]
+ [Test]
public async Task Method_Delete_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -63,7 +63,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
recursive);
}
- [Fact]
+ [Test]
public async Task Method_Delete_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -76,7 +76,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsMethodCall(nameof(IDirectoryInfo.Delete));
}
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -90,7 +90,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -107,7 +107,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -123,7 +123,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -138,7 +138,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -152,7 +152,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -169,7 +169,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -185,7 +185,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -200,7 +200,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemInfos_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -214,7 +214,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemInfos_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -231,7 +231,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemInfos_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -247,7 +247,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemInfos_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -262,7 +262,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetDirectories_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -276,7 +276,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -293,7 +293,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -309,7 +309,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -324,7 +324,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetFiles_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -338,7 +338,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -355,7 +355,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -371,7 +371,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -386,7 +386,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetFileSystemInfos_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -400,7 +400,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetFileSystemInfos_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -417,7 +417,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFileSystemInfos_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -433,7 +433,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetFileSystemInfos_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -448,7 +448,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_MoveTo_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -463,7 +463,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
destDirName);
}
- [Fact]
+ [Test]
public async Task Method_Refresh_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -476,7 +476,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_ResolveLinkTarget_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -490,7 +490,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
returnFinalTarget);
}
#endif
- [Fact]
+ [Test]
public async Task Property_Attributes_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -503,7 +503,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.Attributes));
}
- [Fact]
+ [Test]
public async Task Property_Attributes_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -517,7 +517,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.Attributes));
}
- [Fact]
+ [Test]
public async Task Property_CreationTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -530,7 +530,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.CreationTime));
}
- [Fact]
+ [Test]
public async Task Property_CreationTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -544,7 +544,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.CreationTime));
}
- [Fact]
+ [Test]
public async Task Property_CreationTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -557,7 +557,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.CreationTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_CreationTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -571,7 +571,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.CreationTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_Exists_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -584,7 +584,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.Exists));
}
- [Fact]
+ [Test]
public async Task Property_Extension_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -597,7 +597,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.Extension));
}
- [Fact]
+ [Test]
public async Task Property_FullName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -610,7 +610,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.FullName));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -623,7 +623,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.LastAccessTime));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -637,7 +637,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.LastAccessTime));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -650,7 +650,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.LastAccessTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -664,7 +664,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.LastAccessTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -677,7 +677,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.LastWriteTime));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -691,7 +691,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IDirectoryInfo.LastWriteTime));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -704,7 +704,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.LastWriteTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -719,7 +719,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Property_LinkTarget_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -733,7 +733,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Property_Name_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -746,7 +746,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.Name));
}
- [Fact]
+ [Test]
public async Task Property_Parent_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -759,7 +759,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IDirectoryInfo.Parent));
}
- [Fact]
+ [Test]
public async Task Property_Root_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -773,7 +773,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Property_UnixFileMode_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -788,7 +788,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
#endif
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Property_UnixFileMode_Set_ShouldRegisterPropertyAccess()
{
Skip.If(Test.RunsOnWindows);
@@ -807,7 +807,7 @@ await That(sut.Statistics.DirectoryInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task ToString_ShouldBeDirectoryInfoWithPath()
{
IStatistics sut = new MockFileSystem().Statistics.DirectoryInfo[@"\\some\path"];
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryStatisticsTests.cs
index a84f1fc7c..948ee221c 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DirectoryStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class DirectoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_CreateDirectory_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -21,7 +21,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Method_CreateDirectory_String_UnixFileMode_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnLinux);
@@ -39,7 +39,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Cr
#endif
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_CreateSymbolicLink_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -55,7 +55,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Cr
#endif
#if FEATURE_FILESYSTEM_NET_7_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_CreateTempSubdirectory_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -70,7 +70,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#endif
- [Fact]
+ [Test]
public async Task Method_Delete_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -85,7 +85,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.De
path, recursive);
}
- [Fact]
+ [Test]
public async Task Method_Delete_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -99,7 +99,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.De
path);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -115,7 +115,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -133,7 +133,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#endif
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -150,7 +150,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateDirectories_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -166,7 +166,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -182,7 +182,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -199,7 +199,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.En
}
#endif
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -216,7 +216,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFiles_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -232,7 +232,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemEntries_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -248,7 +248,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemEntries_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -266,7 +266,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#endif
- [Fact]
+ [Test]
public async Task
Method_EnumerateFileSystemEntries_String_String_SearchOption_ShouldRegisterCall()
{
@@ -284,7 +284,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_EnumerateFileSystemEntries_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -300,7 +300,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_Exists_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -313,7 +313,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ex
path);
}
- [Fact]
+ [Test]
public async Task Method_GetCreationTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -327,7 +327,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetCreationTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -341,7 +341,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetCurrentDirectory_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -353,7 +353,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
nameof(IDirectory.GetCurrentDirectory));
}
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -369,7 +369,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -386,7 +386,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -403,7 +403,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetDirectories_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -419,7 +419,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetDirectoryRoot_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -433,7 +433,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -448,7 +448,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -465,7 +465,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -481,7 +481,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetFiles_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -496,7 +496,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetFileSystemEntries_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -512,7 +512,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task Method_GetFileSystemEntries_String_String_EnumerationOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -530,7 +530,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFileSystemEntries_String_String_SearchOption_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -547,7 +547,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern, searchOption);
}
- [Fact]
+ [Test]
public async Task Method_GetFileSystemEntries_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -563,7 +563,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, searchPattern);
}
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -577,7 +577,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -591,7 +591,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -605,7 +605,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -619,7 +619,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetLogicalDrives_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -631,7 +631,7 @@ await That(sut.Statistics.Directory)
.OnlyContainsMethodCall(nameof(IDirectory.GetLogicalDrives));
}
- [Fact]
+ [Test]
public async Task Method_GetParent_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -644,7 +644,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Ge
path);
}
- [Fact]
+ [Test]
public async Task Method_Move_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -660,7 +660,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Mo
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_ResolveLinkTarget_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -675,7 +675,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(nameof(IDirectory.Re
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetCreationTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -691,7 +691,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, creationTime);
}
- [Fact]
+ [Test]
public async Task Method_SetCreationTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -707,7 +707,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, creationTimeUtc);
}
- [Fact]
+ [Test]
public async Task Method_SetCurrentDirectory_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -722,7 +722,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -738,7 +738,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, lastAccessTime);
}
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -754,7 +754,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, lastAccessTimeUtc);
}
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -770,7 +770,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, lastWriteTime);
}
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -786,7 +786,7 @@ await That(sut.Statistics.Directory).OnlyContainsMethodCall(
path, lastWriteTimeUtc);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeDirectory()
{
IStatistics sut = new MockFileSystem().Statistics.Directory;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoFactoryStatisticsTests.cs
index 4ad49a678..7fc808204 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoFactoryStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class DriveInfoFactoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_GetDrives_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -18,7 +18,7 @@ await That(sut.Statistics.DriveInfo)
.OnlyContainsMethodCall(nameof(IDriveInfoFactory.GetDrives));
}
- [Fact]
+ [Test]
public async Task Method_New_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -31,7 +31,7 @@ await That(sut.Statistics.DriveInfo).OnlyContainsMethodCall(nameof(IDriveInfoFac
driveName);
}
- [Fact]
+ [Test]
public async Task Method_Wrap_DriveInfo_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -44,7 +44,7 @@ await That(sut.Statistics.DriveInfo).OnlyContainsMethodCall(nameof(IDriveInfoFac
driveInfo);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeDriveInfo()
{
IPathStatistics sut
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoStatisticsTests.cs
index c3f9b56d2..593d1a311 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/DriveInfoStatisticsTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class DriveInfoStatisticsTests
{
- [Fact]
+ [Test]
public async Task Property_AvailableFreeSpace_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -19,7 +19,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.AvailableFreeSpace));
}
- [Fact]
+ [Test]
public async Task Property_DriveFormat_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -33,7 +33,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.DriveFormat));
}
- [Fact]
+ [Test]
public async Task Property_DriveType_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -47,7 +47,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.DriveType));
}
- [Fact]
+ [Test]
public async Task Property_IsReady_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -61,7 +61,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.IsReady));
}
- [Fact]
+ [Test]
public async Task Property_Name_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -75,7 +75,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.Name));
}
- [Fact]
+ [Test]
public async Task Property_RootDirectory_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -89,7 +89,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.RootDirectory));
}
- [Fact]
+ [Test]
public async Task Property_TotalFreeSpace_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -103,7 +103,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.TotalFreeSpace));
}
- [Fact]
+ [Test]
public async Task Property_TotalSize_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -117,7 +117,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.TotalSize));
}
- [Fact]
+ [Test]
public async Task Property_VolumeLabel_Get_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -131,7 +131,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertyGetAccess(nameof(IDriveInfo.VolumeLabel));
}
- [Fact]
+ [Test]
public async Task Property_VolumeLabel_Set_ShouldRegisterPropertyAccess()
{
Skip.IfNot(Test.RunsOnWindows);
@@ -148,7 +148,7 @@ await That(sut.Statistics.DriveInfo["F:"])
.OnlyContainsPropertySetAccess(nameof(IDriveInfo.VolumeLabel));
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeDriveInfoWithPath()
{
IStatistics sut = new MockFileSystem().Statistics.DriveInfo[@"x:"];
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoFactoryStatisticsTests.cs
index 46b7da961..7739018bb 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoFactoryStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileInfoFactoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_New_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -19,7 +19,7 @@ await That(sut.Statistics.FileInfo).OnlyContainsMethodCall(nameof(IFileInfoFacto
fileName);
}
- [Fact]
+ [Test]
public async Task Method_Wrap_FileInfo_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -32,7 +32,7 @@ await That(sut.Statistics.FileInfo).OnlyContainsMethodCall(nameof(IFileInfoFacto
fileInfo);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileInfo()
{
IPathStatistics sut
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoStatisticsTests.cs
index dd4f330ae..61a86d3f7 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileInfoStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileInfoStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_AppendText_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -18,7 +18,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.AppendText));
}
- [Fact]
+ [Test]
public async Task Method_CopyTo_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -34,7 +34,7 @@ await That(sut.Statistics.FileInfo["foo"])
destFileName, overwrite);
}
- [Fact]
+ [Test]
public async Task Method_CopyTo_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -49,7 +49,7 @@ await That(sut.Statistics.FileInfo["foo"])
destFileName);
}
- [Fact]
+ [Test]
public async Task Method_Create_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -62,7 +62,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_CreateAsSymbolicLink_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -77,7 +77,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_CreateText_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -89,7 +89,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.CreateText));
}
- [Fact]
+ [Test]
public async Task Method_Decrypt_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnWindows);
@@ -105,7 +105,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.Decrypt));
}
- [Fact]
+ [Test]
public async Task Method_Delete_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -118,7 +118,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.Delete));
}
- [Fact]
+ [Test]
public async Task Method_Encrypt_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnWindows);
@@ -135,7 +135,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILE_MOVETO_OVERWRITE
- [Fact]
+ [Test]
public async Task Method_MoveTo_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -152,7 +152,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_MoveTo_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -167,7 +167,7 @@ await That(sut.Statistics.FileInfo["foo"])
destFileName);
}
- [Fact]
+ [Test]
public async Task Method_Open_FileMode_FileAccess_FileShare_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -183,7 +183,7 @@ await That(sut.Statistics.FileInfo["foo"])
mode, access, share);
}
- [Fact]
+ [Test]
public async Task Method_Open_FileMode_FileAccess_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -198,7 +198,7 @@ await That(sut.Statistics.FileInfo["foo"])
mode, access);
}
- [Fact]
+ [Test]
public async Task Method_Open_FileMode_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -213,7 +213,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILESYSTEM_STREAM_OPTIONS
- [Fact]
+ [Test]
public async Task Method_Open_FileStreamOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -229,7 +229,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_OpenRead_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -242,7 +242,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.OpenRead));
}
- [Fact]
+ [Test]
public async Task Method_OpenText_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -255,7 +255,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.OpenText));
}
- [Fact]
+ [Test]
public async Task Method_OpenWrite_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -267,7 +267,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.OpenWrite));
}
- [Fact]
+ [Test]
public async Task Method_Refresh_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -279,7 +279,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsMethodCall(nameof(IFileInfo.Refresh));
}
- [Fact]
+ [Test]
public async Task Method_Replace_String_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -297,7 +297,7 @@ await That(sut.Statistics.FileInfo["foo"])
destinationFileName, destinationBackupFileName, ignoreMetadataErrors);
}
- [Fact]
+ [Test]
public async Task Method_Replace_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -314,7 +314,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_ResolveLinkTarget_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -330,7 +330,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Property_Attributes_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -343,7 +343,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.Attributes));
}
- [Fact]
+ [Test]
public async Task Property_Attributes_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -357,7 +357,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.Attributes));
}
- [Fact]
+ [Test]
public async Task Property_CreationTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -370,7 +370,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.CreationTime));
}
- [Fact]
+ [Test]
public async Task Property_CreationTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -384,7 +384,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.CreationTime));
}
- [Fact]
+ [Test]
public async Task Property_CreationTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -397,7 +397,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.CreationTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_CreationTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -411,7 +411,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.CreationTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_Directory_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -424,7 +424,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.Directory));
}
- [Fact]
+ [Test]
public async Task Property_DirectoryName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -437,7 +437,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.DirectoryName));
}
- [Fact]
+ [Test]
public async Task Property_Exists_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -450,7 +450,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.Exists));
}
- [Fact]
+ [Test]
public async Task Property_Extension_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -463,7 +463,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.Extension));
}
- [Fact]
+ [Test]
public async Task Property_FullName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -476,7 +476,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.FullName));
}
- [Fact]
+ [Test]
public async Task Property_IsReadOnly_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -489,7 +489,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.IsReadOnly));
}
- [Fact]
+ [Test]
public async Task Property_IsReadOnly_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -503,7 +503,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.IsReadOnly));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -516,7 +516,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.LastAccessTime));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -530,7 +530,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.LastAccessTime));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -543,7 +543,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.LastAccessTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastAccessTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -557,7 +557,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.LastAccessTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTime_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -570,7 +570,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.LastWriteTime));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTime_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -584,7 +584,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.LastWriteTime));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTimeUtc_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -597,7 +597,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileInfo.LastWriteTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_LastWriteTimeUtc_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -611,7 +611,7 @@ await That(sut.Statistics.FileInfo["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileInfo.LastWriteTimeUtc));
}
- [Fact]
+ [Test]
public async Task Property_Length_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -625,7 +625,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Property_LinkTarget_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -639,7 +639,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Property_Name_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -653,7 +653,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Property_UnixFileMode_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -668,7 +668,7 @@ await That(sut.Statistics.FileInfo["foo"])
#endif
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Property_UnixFileMode_Set_ShouldRegisterPropertyAccess()
{
Skip.If(Test.RunsOnWindows);
@@ -687,7 +687,7 @@ await That(sut.Statistics.FileInfo["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileInfoWithPath()
{
IStatistics sut = new MockFileSystem().Statistics.FileInfo[@"\\some\path"];
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStatisticsTests.cs
index 7b08c5bb2..3bc5812b1 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStatisticsTests.cs
@@ -18,7 +18,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public sealed class FileStatisticsTests
{
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_AppendAllBytes_String_ByteArray_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -33,7 +33,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllByt
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_AppendAllBytes_String_ReadOnlySpanByte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -48,7 +48,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllByt
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_AppendAllBytesAsync_String_ByteArray_CancellationToken_ShouldRegisterCall()
{
@@ -65,7 +65,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllByt
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_AppendAllBytesAsync_String_ReadOnlyMemoryByte_CancellationToken_ShouldRegisterCall()
{
@@ -81,7 +81,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllByt
}
#endif
- [Fact]
+ [Test]
public async Task Method_AppendAllLines_String_IEnumerableString_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -96,7 +96,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllLin
path, contents, encoding);
}
- [Fact]
+ [Test]
public async Task Method_AppendAllLines_String_IEnumerableString_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -111,7 +111,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllLin
}
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_AppendAllLinesAsync_String_IEnumerableString_CancellationToken_ShouldRegisterCall()
{
@@ -129,7 +129,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllLin
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_AppendAllLinesAsync_String_IEnumerableString_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -148,7 +148,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllLin
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_AppendAllText_String_ReadOnlySpanChar_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -164,7 +164,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_AppendAllText_String_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -178,7 +178,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
}
#endif
- [Fact]
+ [Test]
public async Task Method_AppendAllText_String_String_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -193,7 +193,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
path, contents, encoding);
}
- [Fact]
+ [Test]
public async Task Method_AppendAllText_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -208,7 +208,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
}
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_AppendAllTextAsync_String_ReadOnlyMemoryChar_CancellationToken_ShouldRegisterCall()
{
@@ -225,7 +225,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_AppendAllTextAsync_String_ReadOnlyMemoryChar_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -243,7 +243,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_AppendAllTextAsync_String_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -260,7 +260,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_AppendAllTextAsync_String_String_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -278,7 +278,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendAllTex
}
#endif
- [Fact]
+ [Test]
public async Task Method_AppendText_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -291,7 +291,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.AppendText),
path);
}
- [Fact]
+ [Test]
public async Task Method_Copy_String_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -307,7 +307,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Copy),
sourceFileName, destFileName, overwrite);
}
- [Fact]
+ [Test]
public async Task Method_Copy_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -322,7 +322,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Copy),
sourceFileName, destFileName);
}
- [Fact]
+ [Test]
public async Task Method_Create_String_Int_FileOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -337,7 +337,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Create),
path, bufferSize, options);
}
- [Fact]
+ [Test]
public async Task Method_Create_String_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -351,7 +351,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Create),
path, bufferSize);
}
- [Fact]
+ [Test]
public async Task Method_Create_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -365,7 +365,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Create),
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_CreateSymbolicLink_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -380,7 +380,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.CreateSymbol
}
#endif
- [Fact]
+ [Test]
public async Task Method_CreateText_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -393,7 +393,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.CreateText),
path);
}
- [Fact]
+ [Test]
public async Task Method_Decrypt_String_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnWindows);
@@ -411,7 +411,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Decrypt),
path);
}
- [Fact]
+ [Test]
public async Task Method_Delete_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -425,7 +425,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Delete),
path);
}
- [Fact]
+ [Test]
public async Task Method_Encrypt_String_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnWindows);
@@ -443,7 +443,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Encrypt),
path);
}
- [Fact]
+ [Test]
public async Task Method_Exists_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -457,7 +457,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Exists),
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetAttributes_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -474,7 +474,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetAttribute
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetAttributes_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -489,7 +489,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetAttribute
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetCreationTime_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -506,7 +506,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetCreationT
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetCreationTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -521,7 +521,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetCreationT
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetCreationTimeUtc_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -538,7 +538,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetCreationT
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetCreationTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -553,7 +553,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetCreationT
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTime_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -570,7 +570,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastAcces
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -585,7 +585,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastAcces
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTimeUtc_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -602,7 +602,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastAcces
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetLastAccessTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -617,7 +617,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastAcces
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTime_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -634,7 +634,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastWrite
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTime_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -649,7 +649,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastWrite
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTimeUtc_SafeFileHandle_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -666,7 +666,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastWrite
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetLastWriteTimeUtc_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -681,7 +681,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetLastWrite
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_GetUnixFileMode_SafeFileHandle_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnLinux);
@@ -703,7 +703,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetUnixFileM
#endif
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Method_GetUnixFileMode_String_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnLinux);
@@ -723,7 +723,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.GetUnixFileM
#endif
#if FEATURE_FILE_MOVETO_OVERWRITE
- [Fact]
+ [Test]
public async Task Method_Move_String_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -740,7 +740,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Move),
}
#endif
- [Fact]
+ [Test]
public async Task Method_Move_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -755,7 +755,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Move),
sourceFileName, destFileName);
}
- [Fact]
+ [Test]
public async Task Method_Open_String_FileMode_FileAccess_FileShare_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -771,7 +771,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Open),
path, mode, access, share);
}
- [Fact]
+ [Test]
public async Task Method_Open_String_FileMode_FileAccess_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -786,7 +786,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Open),
path, mode, access);
}
- [Fact]
+ [Test]
public async Task Method_Open_String_FileMode_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -801,7 +801,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Open),
}
#if FEATURE_FILESYSTEM_STREAM_OPTIONS
- [Fact]
+ [Test]
public async Task Method_Open_String_FileStreamOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -817,7 +817,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Open),
}
#endif
- [Fact]
+ [Test]
public async Task Method_OpenRead_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -831,7 +831,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.OpenRead),
path);
}
- [Fact]
+ [Test]
public async Task Method_OpenText_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -845,7 +845,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.OpenText),
path);
}
- [Fact]
+ [Test]
public async Task Method_OpenWrite_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -858,7 +858,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.OpenWrite),
path);
}
- [Fact]
+ [Test]
public async Task Method_ReadAllBytes_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -873,7 +873,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllBytes
}
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_ReadAllBytesAsync_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -889,7 +889,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllBytes
}
#endif
- [Fact]
+ [Test]
public async Task Method_ReadAllLines_String_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -904,7 +904,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllLines
path, encoding);
}
- [Fact]
+ [Test]
public async Task Method_ReadAllLines_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -919,7 +919,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllLines
}
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_ReadAllLinesAsync_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -936,7 +936,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllLines
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_ReadAllLinesAsync_String_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -954,7 +954,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllLines
}
#endif
- [Fact]
+ [Test]
public async Task Method_ReadAllText_String_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -969,7 +969,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllText)
path, encoding);
}
- [Fact]
+ [Test]
public async Task Method_ReadAllText_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -984,7 +984,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllText)
}
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_ReadAllTextAsync_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1001,7 +1001,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllTextA
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_ReadAllTextAsync_String_Encoding_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1018,7 +1018,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadAllTextA
}
#endif
- [Fact]
+ [Test]
public async Task Method_ReadLines_String_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1033,7 +1033,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadLines),
path, encoding);
}
- [Fact]
+ [Test]
public async Task Method_ReadLines_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1048,7 +1048,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadLines),
}
#if FEATURE_FILESYSTEM_NET_7_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_ReadLinesAsync_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1065,7 +1065,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadLinesAsy
#endif
#if FEATURE_FILESYSTEM_NET_7_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_ReadLinesAsync_String_Encoding_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1082,7 +1082,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ReadLinesAsy
}
#endif
- [Fact]
+ [Test]
public async Task Method_Replace_String_String_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1100,7 +1100,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Replace),
sourceFileName, destinationFileName, destinationBackupFileName, ignoreMetadataErrors);
}
- [Fact]
+ [Test]
public async Task Method_Replace_String_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1117,7 +1117,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.Replace),
}
#if FEATURE_FILESYSTEM_LINK
- [Fact]
+ [Test]
public async Task Method_ResolveLinkTarget_String_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1134,7 +1134,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.ResolveLinkT
#endif
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetAttributes_SafeFileHandle_FileAttributes_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1152,7 +1152,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetAttribute
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetAttributes_String_FileAttributes_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1168,7 +1168,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetAttribute
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetCreationTime_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1186,7 +1186,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetCreationT
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetCreationTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1202,7 +1202,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetCreationT
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetCreationTimeUtc_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1220,7 +1220,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetCreationT
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetCreationTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1236,7 +1236,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetCreationT
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTime_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1254,7 +1254,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastAcces
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1270,7 +1270,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastAcces
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTimeUtc_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1288,7 +1288,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastAcces
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetLastAccessTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1304,7 +1304,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastAcces
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTime_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1322,7 +1322,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastWrite
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTime_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1338,7 +1338,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastWrite
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTimeUtc_SafeFileHandle_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1356,7 +1356,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastWrite
}
#endif
- [Fact]
+ [Test]
public async Task Method_SetLastWriteTimeUtc_String_DateTime_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1372,7 +1372,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetLastWrite
}
#if FEATURE_FILESYSTEM_SAFEFILEHANDLE
- [Fact]
+ [Test]
public async Task Method_SetUnixFileMode_SafeFileHandle_UnixFileMode_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnLinux);
@@ -1395,7 +1395,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetUnixFileM
#endif
#if FEATURE_FILESYSTEM_UNIXFILEMODE
- [Fact]
+ [Test]
public async Task Method_SetUnixFileMode_String_UnixFileMode_ShouldRegisterCall()
{
Skip.If(!Test.RunsOnLinux);
@@ -1415,7 +1415,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.SetUnixFileM
}
#endif
- [Fact]
+ [Test]
public async Task Method_WriteAllBytes_String_ByteArray_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1430,7 +1430,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllByte
}
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_WriteAllBytes_String_ReadOnlySpanByte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1445,7 +1445,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllByte
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_WriteAllBytesAsync_String_ByteArray_CancellationToken_ShouldRegisterCall()
{
@@ -1463,7 +1463,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllByte
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_WriteAllBytesAsync_String_ReadOnlyMemoryByte_CancellationToken_ShouldRegisterCall()
{
@@ -1479,7 +1479,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllByte
}
#endif
- [Fact]
+ [Test]
public async Task Method_WriteAllLines_String_IEnumerableString_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1494,7 +1494,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
path, contents, encoding);
}
- [Fact]
+ [Test]
public async Task Method_WriteAllLines_String_IEnumerableString_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1508,7 +1508,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
path, contents);
}
- [Fact]
+ [Test]
public async Task Method_WriteAllLines_String_StringArray_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1523,7 +1523,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
path, contents, encoding);
}
- [Fact]
+ [Test]
public async Task Method_WriteAllLines_String_StringArray_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1538,7 +1538,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
}
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_WriteAllLinesAsync_String_IEnumerableString_CancellationToken_ShouldRegisterCall()
{
@@ -1556,7 +1556,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_WriteAllLinesAsync_String_IEnumerableString_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -1575,7 +1575,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllLine
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_WriteAllText_String_ReadOnlySpanChar_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1591,7 +1591,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task Method_WriteAllText_String_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1605,7 +1605,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
}
#endif
- [Fact]
+ [Test]
public async Task Method_WriteAllText_String_String_Encoding_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1620,7 +1620,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
path, contents, encoding);
}
- [Fact]
+ [Test]
public async Task Method_WriteAllText_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1635,7 +1635,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
}
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_WriteAllTextAsync_String_ReadOnlyMemoryChar_CancellationToken_ShouldRegisterCall()
{
@@ -1652,7 +1652,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
#endif
#if FEATURE_FILE_SPAN
- [Fact]
+ [Test]
public async Task
Method_WriteAllTextAsync_String_ReadOnlyMemoryChar_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -1670,7 +1670,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task Method_WriteAllTextAsync_String_String_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -1687,7 +1687,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
#endif
#if FEATURE_FILESYSTEM_ASYNC
- [Fact]
+ [Test]
public async Task
Method_WriteAllTextAsync_String_String_Encoding_CancellationToken_ShouldRegisterCall()
{
@@ -1705,7 +1705,7 @@ await That(sut.Statistics.File).OnlyContainsMethodCall(nameof(IFile.WriteAllText
}
#endif
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFile()
{
IStatistics sut = new MockFileSystem().Statistics.File;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamFactoryStatisticsTests.cs
index 4213ac5c5..c6ce3917b 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamFactoryStatisticsTests.cs
@@ -11,7 +11,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileStreamFactoryStatisticsTests
{
#if NET6_0_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_New_SafeFileHandle_FileAccess_Int_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -32,7 +32,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
#endif
#if NET6_0_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_New_SafeFileHandle_FileAccess_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -51,7 +51,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
}
#endif
#if NET6_0_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_New_SafeFileHandle_FileAccess_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -69,7 +69,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
}
#endif
- [Fact]
+ [Test]
public async Task Method_New_String_FileMode_FileAccess_FileShare_Int_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -88,7 +88,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
path, mode, access, share, bufferSize, useAsync);
}
- [Fact]
+ [Test]
public async Task
Method_New_String_FileMode_FileAccess_FileShare_Int_FileOptions_ShouldRegisterCall()
{
@@ -108,7 +108,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
path, mode, access, share, bufferSize, options);
}
- [Fact]
+ [Test]
public async Task Method_New_String_FileMode_FileAccess_FileShare_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -125,7 +125,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
path, mode, access, share, bufferSize);
}
- [Fact]
+ [Test]
public async Task Method_New_String_FileMode_FileAccess_FileShare_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -141,7 +141,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
path, mode, access, share);
}
- [Fact]
+ [Test]
public async Task Method_New_String_FileMode_FileAccess_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -156,7 +156,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
path, mode, access);
}
- [Fact]
+ [Test]
public async Task Method_New_String_FileMode_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -171,7 +171,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
}
#if FEATURE_FILESYSTEM_STREAM_OPTIONS
- [Fact]
+ [Test]
public async Task Method_New_String_FileStreamOptions_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -187,7 +187,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(nameof(IFileStreamF
}
#endif
- [Fact]
+ [Test]
public async Task Method_Wrap_FileStream_ShouldRegisterCall()
{
string path = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
@@ -216,7 +216,7 @@ await That(sut.Statistics.FileStream).OnlyContainsMethodCall(
}
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileStream()
{
IPathStatistics sut
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamStatisticsTests.cs
index d643d4a52..d32626485 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileStreamStatisticsTests.cs
@@ -8,7 +8,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileStreamStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_BeginRead_ByteArray_Int_Int_AsyncCallback_Object_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -27,7 +27,7 @@ await That(sut.Statistics.FileStream["foo"])
buffer, offset, count, callback, state);
}
- [Fact]
+ [Test]
public async Task Method_BeginWrite_ByteArray_Int_Int_AsyncCallback_Object_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -46,7 +46,7 @@ await That(sut.Statistics.FileStream["foo"])
buffer, offset, count, callback, state);
}
- [Fact]
+ [Test]
public async Task Method_Close_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -58,7 +58,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsMethodCall(nameof(FileSystemStream.Close));
}
- [Fact]
+ [Test]
public async Task Method_CopyTo_Stream_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -74,7 +74,7 @@ await That(sut.Statistics.FileStream["foo"])
destination, bufferSize);
}
- [Fact]
+ [Test]
public async Task Method_CopyToAsync_Stream_Int_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -91,7 +91,7 @@ await That(sut.Statistics.FileStream["foo"])
destination, bufferSize, cancellationToken);
}
- [Fact]
+ [Test]
public async Task Method_EndRead_IAsyncResult_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -109,7 +109,7 @@ await That(sut.Statistics.FileStream["foo"].Methods).HasSingle().Matching(c =>
c.Parameters[0].Is(asyncResult));
}
- [Fact]
+ [Test]
public async Task Method_EndWrite_IAsyncResult_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -127,7 +127,7 @@ await That(sut.Statistics.FileStream["foo"].Methods).HasSingle().Matching(c =>
c.Parameters[0].Is(asyncResult));
}
- [Fact]
+ [Test]
public async Task Method_Flush_Bool_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -142,7 +142,7 @@ await That(sut.Statistics.FileStream["foo"])
flushToDisk);
}
- [Fact]
+ [Test]
public async Task Method_Flush_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -155,7 +155,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsMethodCall(nameof(FileSystemStream.Flush));
}
- [Fact]
+ [Test]
public async Task Method_FlushAsync_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -170,7 +170,7 @@ await That(sut.Statistics.FileStream["foo"])
cancellationToken);
}
- [Fact]
+ [Test]
public async Task Method_Read_ByteArray_Int_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -188,7 +188,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_Read_SpanByte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -204,7 +204,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_ReadAsync_ByteArray_Int_Int_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -225,7 +225,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_ReadAsync_MemoryByte_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -242,7 +242,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_ReadByte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -255,7 +255,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsMethodCall(nameof(FileSystemStream.ReadByte));
}
- [Fact]
+ [Test]
public async Task Method_Seek_Int64_SeekOrigin_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -271,7 +271,7 @@ await That(sut.Statistics.FileStream["foo"])
offset, origin);
}
- [Fact]
+ [Test]
public async Task Method_SetLength_Int64_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -286,7 +286,7 @@ await That(sut.Statistics.FileStream["foo"])
value);
}
- [Fact]
+ [Test]
public async Task Method_ToString_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -299,7 +299,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsMethodCall(nameof(FileSystemStream.ToString));
}
- [Fact]
+ [Test]
public async Task Method_Write_ByteArray_Int_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -317,7 +317,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_Write_ReadOnlySpanByte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -333,7 +333,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_WriteAsync_ByteArray_Int_Int_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -354,7 +354,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_WriteAsync_ReadOnlyMemoryByte_CancellationToken_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -371,7 +371,7 @@ await That(sut.Statistics.FileStream["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Method_WriteByte_Byte_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -386,7 +386,7 @@ await That(sut.Statistics.FileStream["foo"])
value);
}
- [Fact]
+ [Test]
public async Task Property_CanRead_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -399,7 +399,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.CanRead));
}
- [Fact]
+ [Test]
public async Task Property_CanSeek_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -412,7 +412,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.CanSeek));
}
- [Fact]
+ [Test]
public async Task Property_CanTimeout_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -425,7 +425,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.CanTimeout));
}
- [Fact]
+ [Test]
public async Task Property_CanWrite_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -438,7 +438,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.CanWrite));
}
- [Fact]
+ [Test]
public async Task Property_IsAsync_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -451,7 +451,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.IsAsync));
}
- [Fact]
+ [Test]
public async Task Property_Length_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -464,7 +464,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.Length));
}
- [Fact]
+ [Test]
public async Task Property_Name_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -477,7 +477,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.Name));
}
- [Fact]
+ [Test]
public async Task Property_Position_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -490,7 +490,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.Position));
}
- [Fact]
+ [Test]
public async Task Property_Position_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -504,7 +504,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertySetAccess(nameof(FileSystemStream.Position));
}
- [Fact]
+ [Test]
public async Task Property_ReadTimeout_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -524,7 +524,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.ReadTimeout));
}
- [Fact]
+ [Test]
public async Task Property_ReadTimeout_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -545,7 +545,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertySetAccess(nameof(FileSystemStream.ReadTimeout));
}
- [Fact]
+ [Test]
public async Task Property_WriteTimeout_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -565,7 +565,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertyGetAccess(nameof(FileSystemStream.WriteTimeout));
}
- [Fact]
+ [Test]
public async Task Property_WriteTimeout_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -586,7 +586,7 @@ await That(sut.Statistics.FileStream["foo"])
.OnlyContainsPropertySetAccess(nameof(FileSystemStream.WriteTimeout));
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileStreamWithPath()
{
IStatistics sut = new MockFileSystem().Statistics.FileStream[@"\\some\path"];
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherFactoryStatisticsTests.cs
index 9718565de..d31fca6ef 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherFactoryStatisticsTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileSystemWatcherFactoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_New_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -18,7 +18,7 @@ await That(sut.Statistics.FileSystemWatcher).OnlyContainsMethodCall(
nameof(IFileSystemWatcherFactory.New));
}
- [Fact]
+ [Test]
public async Task Method_New_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -33,7 +33,7 @@ await That(sut.Statistics.FileSystemWatcher).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_New_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -49,7 +49,7 @@ await That(sut.Statistics.FileSystemWatcher).OnlyContainsMethodCall(
path, filter);
}
- [Fact]
+ [Test]
public async Task Method_Wrap_FileSystemWatcher_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -64,7 +64,7 @@ await That(sut.Statistics.FileSystemWatcher).OnlyContainsMethodCall(
fileSystemWatcher);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileSystemWatcher()
{
IPathStatistics sut
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherStatisticsTests.cs
index 488be302a..d791f39b8 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileSystemWatcherStatisticsTests.cs
@@ -9,7 +9,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileSystemWatcherStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_BeginInit_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -23,7 +23,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsMethodCall(nameof(IFileSystemWatcher.BeginInit));
}
- [Fact]
+ [Test]
public async Task Method_EndInit_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -37,7 +37,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsMethodCall(nameof(IFileSystemWatcher.EndInit));
}
- [Fact]
+ [Test]
public async Task Method_WaitForChanged_WatcherChangeTypes_Int_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -67,7 +67,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
timeout);
}
- [Fact]
+ [Test]
public async Task Method_WaitForChanged_WatcherChangeTypes_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -96,7 +96,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
}
#if FEATURE_FILESYSTEM_NET_7_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_WaitForChanged_WatcherChangeTypes_TimeSpan_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -127,7 +127,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Property_EnableRaisingEvents_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -140,7 +140,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.EnableRaisingEvents));
}
- [Fact]
+ [Test]
public async Task Property_EnableRaisingEvents_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -154,7 +154,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.EnableRaisingEvents));
}
- [Fact]
+ [Test]
public async Task Property_Filter_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -167,7 +167,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.Filter));
}
- [Fact]
+ [Test]
public async Task Property_Filter_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -182,7 +182,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
}
#if FEATURE_FILESYSTEMWATCHER_ADVANCED
- [Fact]
+ [Test]
public async Task Property_Filters_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -196,7 +196,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
}
#endif
- [Fact]
+ [Test]
public async Task Property_IncludeSubdirectories_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -209,7 +209,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.IncludeSubdirectories));
}
- [Fact]
+ [Test]
public async Task Property_IncludeSubdirectories_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -223,7 +223,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.IncludeSubdirectories));
}
- [Fact]
+ [Test]
public async Task Property_InternalBufferSize_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -236,7 +236,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.InternalBufferSize));
}
- [Fact]
+ [Test]
public async Task Property_InternalBufferSize_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -250,7 +250,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.InternalBufferSize));
}
- [Fact]
+ [Test]
public async Task Property_NotifyFilter_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -263,7 +263,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.NotifyFilter));
}
- [Fact]
+ [Test]
public async Task Property_NotifyFilter_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -277,7 +277,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.NotifyFilter));
}
- [Fact]
+ [Test]
public async Task Property_Path_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -290,7 +290,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.Path));
}
- [Fact]
+ [Test]
public async Task Property_Path_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -304,7 +304,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.Path));
}
- [Fact]
+ [Test]
public async Task Property_Site_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -317,7 +317,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.Site));
}
- [Fact]
+ [Test]
public async Task Property_Site_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -331,7 +331,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.Site));
}
- [Fact]
+ [Test]
public async Task Property_SynchronizingObject_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -344,7 +344,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileSystemWatcher.SynchronizingObject));
}
- [Fact]
+ [Test]
public async Task Property_SynchronizingObject_Set_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -358,7 +358,7 @@ await That(sut.Statistics.FileSystemWatcher["foo"])
.OnlyContainsPropertySetAccess(nameof(IFileSystemWatcher.SynchronizingObject));
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBeFileSystemWatcherWithPath()
{
IStatistics sut = new MockFileSystem().Statistics.FileSystemWatcher[@"\\some\path"];
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoFactoryStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoFactoryStatisticsTests.cs
index d87a332c8..21ff96b5e 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoFactoryStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoFactoryStatisticsTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileVersionInfoFactoryStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_GetVersionInfo_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoStatisticsTests.cs
index 59df8fc14..12f587339 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/FileVersionInfoStatisticsTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class FileVersionInfoStatisticsTests
{
- [Fact]
+ [Test]
public async Task Property_Comments_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -17,7 +17,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.Comments));
}
- [Fact]
+ [Test]
public async Task Property_CompanyName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -29,7 +29,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.CompanyName));
}
- [Fact]
+ [Test]
public async Task Property_FileBuildPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -41,7 +41,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileBuildPart));
}
- [Fact]
+ [Test]
public async Task Property_FileDescription_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -53,7 +53,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileDescription));
}
- [Fact]
+ [Test]
public async Task Property_FileMajorPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -65,7 +65,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileMajorPart));
}
- [Fact]
+ [Test]
public async Task Property_FileMinorPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -77,7 +77,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileMinorPart));
}
- [Fact]
+ [Test]
public async Task Property_FileName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -89,7 +89,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileName));
}
- [Fact]
+ [Test]
public async Task Property_FilePrivatePart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -101,7 +101,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FilePrivatePart));
}
- [Fact]
+ [Test]
public async Task Property_FileVersion_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -113,7 +113,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.FileVersion));
}
- [Fact]
+ [Test]
public async Task Property_InternalName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -125,7 +125,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.InternalName));
}
- [Fact]
+ [Test]
public async Task Property_IsDebug_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -137,7 +137,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.IsDebug));
}
- [Fact]
+ [Test]
public async Task Property_IsPatched_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -149,7 +149,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.IsPatched));
}
- [Fact]
+ [Test]
public async Task Property_IsPreRelease_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -161,7 +161,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.IsPreRelease));
}
- [Fact]
+ [Test]
public async Task Property_IsPrivateBuild_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -173,7 +173,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.IsPrivateBuild));
}
- [Fact]
+ [Test]
public async Task Property_IsSpecialBuild_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -185,7 +185,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.IsSpecialBuild));
}
- [Fact]
+ [Test]
public async Task Property_Language_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -197,7 +197,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.Language));
}
- [Fact]
+ [Test]
public async Task Property_LegalCopyright_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -209,7 +209,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.LegalCopyright));
}
- [Fact]
+ [Test]
public async Task Property_LegalTrademarks_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -221,7 +221,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.LegalTrademarks));
}
- [Fact]
+ [Test]
public async Task Property_OriginalFilename_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -233,7 +233,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.OriginalFilename));
}
- [Fact]
+ [Test]
public async Task Property_PrivateBuild_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -245,7 +245,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.PrivateBuild));
}
- [Fact]
+ [Test]
public async Task Property_ProductBuildPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -257,7 +257,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductBuildPart));
}
- [Fact]
+ [Test]
public async Task Property_ProductMajorPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -269,7 +269,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductMajorPart));
}
- [Fact]
+ [Test]
public async Task Property_ProductMinorPart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -281,7 +281,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductMinorPart));
}
- [Fact]
+ [Test]
public async Task Property_ProductName_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -293,7 +293,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductName));
}
- [Fact]
+ [Test]
public async Task Property_ProductPrivatePart_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -305,7 +305,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductPrivatePart));
}
- [Fact]
+ [Test]
public async Task Property_ProductVersion_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -317,7 +317,7 @@ await That(sut.Statistics.FileVersionInfo["foo"])
.OnlyContainsPropertyGetAccess(nameof(IFileVersionInfo.ProductVersion));
}
- [Fact]
+ [Test]
public async Task Property_SpecialBuild_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/PathStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/PathStatisticsTests.cs
index d4b35eb4d..082ba4ae8 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/PathStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/FileSystem/PathStatisticsTests.cs
@@ -8,7 +8,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics.FileSystem;
public class PathStatisticsTests
{
- [Fact]
+ [Test]
public async Task Method_ChangeExtension_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -22,7 +22,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.ChangeExtens
path, extension);
}
#if FEATURE_PATH_SPAN
- [Fact]
+ [Test]
public async Task Method_Combine_ReadOnlySpanString_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -35,7 +35,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Combine),
}
#endif
- [Fact]
+ [Test]
public async Task Method_Combine_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -49,7 +49,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Combine),
path1, path2);
}
- [Fact]
+ [Test]
public async Task Method_Combine_String_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -64,7 +64,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Combine),
path1, path2, path3);
}
- [Fact]
+ [Test]
public async Task Method_Combine_String_String_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -80,7 +80,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Combine),
path1, path2, path3, path4);
}
- [Fact]
+ [Test]
public async Task Method_Combine_StringArray_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -94,7 +94,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Combine),
}
#if FEATURE_PATH_ADVANCED
- [Fact]
+ [Test]
public async Task Method_EndsInDirectorySeparator_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -109,7 +109,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.EndsInDirect
#endif
#if FEATURE_PATH_ADVANCED
- [Fact]
+ [Test]
public async Task Method_EndsInDirectorySeparator_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -124,7 +124,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.EndsInDirect
#endif
#if FEATURE_FILESYSTEM_NET_7_OR_GREATER
- [Fact]
+ [Test]
public async Task Method_Exists_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -139,7 +139,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Exists),
#endif
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_GetDirectoryName_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -153,7 +153,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetDirectory
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetDirectoryName_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -167,7 +167,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetDirectory
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_GetExtension_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -181,7 +181,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetExtension
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetExtension_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -195,7 +195,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetExtension
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_GetFileName_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -209,7 +209,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetFileName)
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFileName_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -223,7 +223,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetFileName)
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_GetFileNameWithoutExtension_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -237,7 +237,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetFileNameW
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetFileNameWithoutExtension_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -251,7 +251,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(
path);
}
- [Fact]
+ [Test]
public async Task Method_GetFullPath_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -265,7 +265,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetFullPath)
}
#if FEATURE_PATH_RELATIVE
- [Fact]
+ [Test]
public async Task Method_GetFullPath_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -280,7 +280,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetFullPath)
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetInvalidFileNameChars_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -292,7 +292,7 @@ await That(sut.Statistics.Path)
.OnlyContainsMethodCall(nameof(IPath.GetInvalidFileNameChars));
}
- [Fact]
+ [Test]
public async Task Method_GetInvalidPathChars_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -304,7 +304,7 @@ public async Task Method_GetInvalidPathChars_ShouldRegisterCall()
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_GetPathRoot_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -318,7 +318,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetPathRoot)
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetPathRoot_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -331,7 +331,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetPathRoot)
path);
}
- [Fact]
+ [Test]
public async Task Method_GetRandomFileName_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -343,7 +343,7 @@ public async Task Method_GetRandomFileName_ShouldRegisterCall()
}
#if FEATURE_PATH_RELATIVE
- [Fact]
+ [Test]
public async Task Method_GetRelativePath_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -358,7 +358,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetRelativeP
}
#endif
- [Fact]
+ [Test]
public async Task Method_GetTempFileName_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -371,7 +371,7 @@ public async Task Method_GetTempFileName_ShouldRegisterCall()
await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.GetTempFileName));
}
- [Fact]
+ [Test]
public async Task Method_GetTempPath_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -383,7 +383,7 @@ public async Task Method_GetTempPath_ShouldRegisterCall()
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_HasExtension_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -397,7 +397,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.HasExtension
}
#endif
- [Fact]
+ [Test]
public async Task Method_HasExtension_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -411,7 +411,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.HasExtension
}
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_IsPathFullyQualified_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -426,7 +426,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.IsPathFullyQ
#endif
#if FEATURE_PATH_RELATIVE
- [Fact]
+ [Test]
public async Task Method_IsPathFullyQualified_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -441,7 +441,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.IsPathFullyQ
#endif
#if FEATURE_SPAN
- [Fact]
+ [Test]
public async Task Method_IsPathRooted_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -455,7 +455,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.IsPathRooted
}
#endif
- [Fact]
+ [Test]
public async Task Method_IsPathRooted_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -469,7 +469,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.IsPathRooted
}
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_ReadOnlySpanChar_ReadOnlySpanChar_ReadOnlySpanChar_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -487,7 +487,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_ReadOnlySpanChar_ReadOnlySpanChar_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -504,7 +504,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_ReadOnlySpanChar_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -520,7 +520,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_SPAN
- [Fact]
+ [Test]
public async Task Method_Join_ReadOnlySpanString_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -534,7 +534,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -550,7 +550,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_String_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -567,7 +567,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_String_String_String_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -585,7 +585,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_Join_StringArray_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -600,7 +600,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.Join),
#endif
#if FEATURE_PATH_ADVANCED
- [Fact]
+ [Test]
public async Task Method_TrimEndingDirectorySeparator_ReadOnlySpanChar_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -615,7 +615,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.TrimEndingDi
#endif
#if FEATURE_PATH_ADVANCED
- [Fact]
+ [Test]
public async Task Method_TrimEndingDirectorySeparator_String_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -630,7 +630,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.TrimEndingDi
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_TryJoin_ReadOnlySpanChar_ReadOnlySpanChar_ReadOnlySpanChar_SpanChar_OutInt_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -648,7 +648,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.TryJoin),
#endif
#if FEATURE_PATH_JOIN
- [Fact]
+ [Test]
public async Task Method_TryJoin_ReadOnlySpanChar_ReadOnlySpanChar_SpanChar_OutInt_ShouldRegisterCall()
{
MockFileSystem sut = new();
@@ -664,7 +664,7 @@ await That(sut.Statistics.Path).OnlyContainsMethodCall(nameof(IPath.TryJoin),
}
#endif
- [Fact]
+ [Test]
public async Task Property_AltDirectorySeparatorChar_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -676,7 +676,7 @@ await That(sut.Statistics.Path).OnlyContainsPropertyGetAccess(
nameof(IPath.AltDirectorySeparatorChar));
}
- [Fact]
+ [Test]
public async Task Property_DirectorySeparatorChar_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -688,7 +688,7 @@ await That(sut.Statistics.Path).OnlyContainsPropertyGetAccess(
nameof(IPath.DirectorySeparatorChar));
}
- [Fact]
+ [Test]
public async Task Property_PathSeparator_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -699,7 +699,7 @@ public async Task Property_PathSeparator_Get_ShouldRegisterPropertyAccess()
await That(sut.Statistics.Path).OnlyContainsPropertyGetAccess(nameof(IPath.PathSeparator));
}
- [Fact]
+ [Test]
public async Task Property_VolumeSeparatorChar_Get_ShouldRegisterPropertyAccess()
{
MockFileSystem sut = new();
@@ -711,7 +711,7 @@ await That(sut.Statistics.Path)
.OnlyContainsPropertyGetAccess(nameof(IPath.VolumeSeparatorChar));
}
- [Fact]
+ [Test]
public async Task ToString_ShouldBePath()
{
IStatistics sut = new MockFileSystem().Statistics.Path;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/MethodStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/MethodStatisticsTests.cs
index 8f965dde4..4b2147025 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/MethodStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/MethodStatisticsTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics;
public sealed class MethodStatisticsTests
{
- [Fact]
+ [Test]
public async Task Counter_ShouldBeInitializedWithOne()
{
MockFileSystem fileSystem = new();
@@ -14,7 +14,7 @@ public async Task Counter_ShouldBeInitializedWithOne()
await That(sut.Counter).IsEqualTo(1);
}
- [Fact]
+ [Test]
public async Task ToString_ShouldContainName()
{
MockFileSystem fileSystem = new();
@@ -27,7 +27,7 @@ await That(result).Contains(nameof(IDirectory.CreateDirectory)).And.Contains("\"
.DoesNotContain(",");
}
- [Fact]
+ [Test]
public async Task ToString_ShouldContainParameters()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/ParameterDescriptionTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/ParameterDescriptionTests.cs
index f2f8d22ba..0318df3f5 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/ParameterDescriptionTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/ParameterDescriptionTests.cs
@@ -5,8 +5,8 @@ namespace Testably.Abstractions.Testing.Tests.Statistics;
public sealed class ParameterDescriptionTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromOutParameter_ShouldSetIsOutParameterToTrue(int value)
{
ParameterDescription sut = ParameterDescription.FromOutParameter(value);
@@ -14,8 +14,8 @@ public async Task FromOutParameter_ShouldSetIsOutParameterToTrue(int value)
await That(sut.IsOutParameter).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromParameter_ShouldSetIsOutParameterToFalse(int value)
{
ParameterDescription sut = ParameterDescription.FromParameter(value);
@@ -24,8 +24,8 @@ public async Task FromParameter_ShouldSetIsOutParameterToFalse(int value)
}
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromParameter_WithReadOnlySpan_ShouldSetIsOutParameterToFalse(string buffer)
{
ReadOnlySpan value = buffer.AsSpan();
@@ -37,8 +37,8 @@ public async Task FromParameter_WithReadOnlySpan_ShouldSetIsOutParameterToFalse(
#endif
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task FromParameter_WithSpan_ShouldSetIsOutParameterToFalse(int[] buffer)
{
Span value = buffer.AsSpan();
@@ -49,9 +49,9 @@ public async Task FromParameter_WithSpan_ShouldSetIsOutParameterToFalse(int[] bu
}
#endif
- [Theory]
- [InlineAutoData(true)]
- [InlineAutoData(false)]
+ [Test]
+ [AutoArguments(true)]
+ [AutoArguments(false)]
public async Task Is_WithComparer_ShouldUseComparerResult(bool comparerResult, string value)
{
ParameterDescription sut = ParameterDescription.FromParameter(value);
@@ -61,9 +61,9 @@ public async Task Is_WithComparer_ShouldUseComparerResult(bool comparerResult, s
await That(result).IsEqualTo(comparerResult);
}
- [Theory]
- [InlineAutoData(true)]
- [InlineAutoData(false)]
+ [Test]
+ [AutoArguments(true)]
+ [AutoArguments(false)]
public async Task Is_WithComparer_WithIncompatibleType_ShouldReturnFalse(bool comparerResult,
string value)
{
@@ -74,8 +74,8 @@ public async Task Is_WithComparer_WithIncompatibleType_ShouldReturnFalse(bool co
await That(result).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Is_WithFromOutParameter_ShouldCheckForMatchingValue(int value)
{
ParameterDescription sut = ParameterDescription.FromOutParameter(value);
@@ -85,8 +85,8 @@ public async Task Is_WithFromOutParameter_ShouldCheckForMatchingValue(int value)
await That(sut.Is("foo")).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Is_WithFromParameter_ShouldCheckForMatchingValue(string value)
{
ParameterDescription sut = ParameterDescription.FromParameter(value);
@@ -96,8 +96,8 @@ public async Task Is_WithFromParameter_ShouldCheckForMatchingValue(string value)
await That(sut.Is(42)).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldReturnValue(int value)
{
ParameterDescription sut = ParameterDescription.FromParameter(value);
@@ -108,8 +108,8 @@ public async Task ToString_ShouldReturnValue(int value)
}
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_WithReadOnlySpan_ShouldSetIsOutParameterToFalse(string buffer)
{
ReadOnlySpan value = buffer.AsSpan();
@@ -123,8 +123,8 @@ public async Task ToString_WithReadOnlySpan_ShouldSetIsOutParameterToFalse(strin
#endif
#if FEATURE_SPAN
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_WithSpan_ShouldSetIsOutParameterToFalse(int[] buffer)
{
Span value = buffer.AsSpan();
@@ -137,8 +137,8 @@ public async Task ToString_WithSpan_ShouldSetIsOutParameterToFalse(int[] buffer)
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_WithStringValue_ShouldReturnValueEnclosedInQuotationMarks(
string value)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/PathStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/PathStatisticsTests.cs
index 983cefabe..172a63edf 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/PathStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/PathStatisticsTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics;
public sealed class PathStatisticsTests
{
- [Fact]
+ [Test]
public async Task Key_AbsoluteAndRelativePathsShouldMatch()
{
MockFileSystem fileSystem = new();
@@ -17,7 +17,7 @@ public async Task Key_AbsoluteAndRelativePathsShouldMatch()
await That(absolutPath).IsEqualTo(relativePath);
}
- [Fact]
+ [Test]
public async Task Key_DifferentDrives_ShouldBeConsideredDifferent()
{
MockFileSystem fileSystem = new();
@@ -29,7 +29,7 @@ public async Task Key_DifferentDrives_ShouldBeConsideredDifferent()
await That(result1).IsNotEqualTo(result2);
}
- [Fact]
+ [Test]
public async Task Key_DifferentUncRootPaths_ShouldBeConsideredDifferent()
{
MockFileSystem fileSystem = new();
@@ -41,7 +41,7 @@ public async Task Key_DifferentUncRootPaths_ShouldBeConsideredDifferent()
await That(result1).IsNotEqualTo(result2);
}
- [Fact]
+ [Test]
public async Task Key_NullShouldBeSameAsEmptyKey()
{
MockFileSystem fileSystem = new();
@@ -53,7 +53,7 @@ public async Task Key_NullShouldBeSameAsEmptyKey()
await That(nullKey).IsEqualTo(emptyKey);
}
- [Fact]
+ [Test]
public async Task Key_ShouldSimplifyRelativePaths()
{
MockFileSystem fileSystem = new(o => o.UseCurrentDirectory());
@@ -66,9 +66,9 @@ public async Task Key_ShouldSimplifyRelativePaths()
await That(absolutPath).IsEqualTo(relativePath);
}
- [Theory]
- [InlineData("/")]
- [InlineData("\\")]
+ [Test]
+ [Arguments("/")]
+ [Arguments("\\")]
public async Task Key_WithDrives_ShouldIgnoreTrailingSeparator(string separator)
{
const string key = @"C:";
@@ -81,9 +81,9 @@ public async Task Key_WithDrives_ShouldIgnoreTrailingSeparator(string separator)
await That(result1).IsEqualTo(result2);
}
- [Theory]
- [InlineData("/")]
- [InlineData("\\")]
+ [Test]
+ [Arguments("/")]
+ [Arguments("\\")]
public async Task Key_WithFolderInDrives_ShouldIgnoreTrailingSeparator(string separator)
{
const string key = @"C:\foo";
@@ -96,9 +96,9 @@ public async Task Key_WithFolderInDrives_ShouldIgnoreTrailingSeparator(string se
await That(result1).IsEqualTo(result2);
}
- [Theory]
- [InlineData("/")]
- [InlineData("\\")]
+ [Test]
+ [Arguments("/")]
+ [Arguments("\\")]
public async Task Key_WithFolderInUncRootPaths_ShouldIgnoreTrailingSeparator(string separator)
{
const string key = @"\\server1\foo";
@@ -111,7 +111,7 @@ public async Task Key_WithFolderInUncRootPaths_ShouldIgnoreTrailingSeparator(str
await That(result1).IsEqualTo(result2);
}
- [Fact]
+ [Test]
public async Task Key_WithNull_ShouldNotThrow()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/PropertyStatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/PropertyStatisticsTests.cs
index 3b6c640e9..00623c9d5 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/PropertyStatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/PropertyStatisticsTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics;
public sealed class PropertyStatisticsTests
{
- [Fact]
+ [Test]
public async Task Counter_ShouldBeInitializedWithOne()
{
MockFileSystem fileSystem = new();
@@ -14,7 +14,7 @@ public async Task Counter_ShouldBeInitializedWithOne()
await That(sut.Counter).IsEqualTo(1);
}
- [Fact]
+ [Test]
public async Task ToString_Get_ShouldContainNameAndGet()
{
MockFileSystem fileSystem = new();
@@ -28,7 +28,7 @@ public async Task ToString_Get_ShouldContainNameAndGet()
await That(result).Contains(nameof(IFileInfo.IsReadOnly)).And.Contains("{get;}");
}
- [Fact]
+ [Test]
public async Task ToString_Set_ShouldContainNameAndSet()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.Helpers.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.Helpers.cs
index 814e7e539..b136387ab 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.Helpers.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.Helpers.cs
@@ -35,14 +35,16 @@ private static void CheckMethodCall(StringBuilder builder,
Type testType)
{
#pragma warning disable MA0089 // Use an overload with char instead of string
+ #pragma warning disable MA0001 //Use an overload of 'Replace' that has a StringComparison parameter
string expectedName = $"Method_{methodInfo.Name}_{string.Join("_", methodInfo
.GetParameters()
.Select(x => FirstCharToUpperAsSpan(GetName(x.ParameterType, true)
- .Replace("<", "", StringComparison.Ordinal)
- .Replace(">", "", StringComparison.Ordinal)
+ .Replace("<", "")
+ .Replace(">", "")
// ReSharper disable once StringLiteralTypo
- .Replace("IEnumerablestring", "IEnumerableString", StringComparison.Ordinal)
- .Replace("[]", "Array", StringComparison.Ordinal))))}{(parameters.Length > 0 ? "_" : "")}ShouldRegisterCall";
+ .Replace("IEnumerablestring", "IEnumerableString")
+ .Replace("[]", "Array"))))}{(parameters.Length > 0 ? "_" : "")}ShouldRegisterCall";
+ #pragma warning restore MA0001
#pragma warning restore MA0089
if (testType.GetMethod(expectedName) != null)
{
@@ -51,7 +53,7 @@ private static void CheckMethodCall(StringBuilder builder,
bool isAsync = typeof(Task).IsAssignableFrom(methodInfo.ReturnType);
#pragma warning disable MA0011 // IFormatProvider is missing
- builder.AppendLine("\t[Fact]");
+ builder.AppendLine("\t[Test]");
builder.Append(isAsync ? "\tpublic async Task " : "\tpublic void ");
builder.Append(expectedName);
builder.AppendLine("()");
@@ -166,7 +168,7 @@ private static void CheckPropertyGetAccess(StringBuilder builder,
}
#pragma warning disable MA0011 // IFormatProvider is missing
- builder.AppendLine("\t[Fact]");
+ builder.AppendLine("\t[Test]");
builder.Append("\tpublic void ");
builder.Append(expectedName);
builder.AppendLine("()");
@@ -200,7 +202,7 @@ private static void CheckPropertySetAccess(StringBuilder builder,
}
#pragma warning disable MA0011 // IFormatProvider is missing
- builder.AppendLine("\t[Fact]");
+ builder.AppendLine("\t[Test]");
builder.Append("\tpublic void ");
builder.Append(expectedName);
builder.AppendLine("()");
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.cs
index 1dddf156e..85e924453 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Statistics/StatisticsTests.cs
@@ -7,7 +7,7 @@ namespace Testably.Abstractions.Testing.Tests.Statistics;
public sealed partial class StatisticsTests
{
- [Fact]
+ [Test]
public async Task FileSystem_Initialize_ShouldNotRegisterStatistics()
{
MockFileSystem sut = new();
@@ -23,36 +23,36 @@ public async Task FileSystem_Initialize_ShouldNotRegisterStatistics()
await That(sut.Statistics.File.Methods).IsEmpty();
}
- [Theory]
- [InlineData(nameof(MockFileSystem.Directory), false,
+ [Test]
+ [Arguments(nameof(MockFileSystem.Directory), false,
typeof(IDirectory), typeof(DirectoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.DirectoryInfo), false,
+ [Arguments(nameof(MockFileSystem.DirectoryInfo), false,
typeof(IDirectoryInfoFactory), typeof(DirectoryInfoFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.DirectoryInfo), true,
+ [Arguments(nameof(MockFileSystem.DirectoryInfo), true,
typeof(IDirectoryInfo), typeof(DirectoryInfoStatisticsTests))]
- [InlineData(nameof(MockFileSystem.DriveInfo), false,
+ [Arguments(nameof(MockFileSystem.DriveInfo), false,
typeof(IDriveInfoFactory), typeof(DriveInfoFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.DriveInfo), true,
+ [Arguments(nameof(MockFileSystem.DriveInfo), true,
typeof(IDriveInfo), typeof(DriveInfoStatisticsTests))]
- [InlineData(nameof(MockFileSystem.File), false,
+ [Arguments(nameof(MockFileSystem.File), false,
typeof(IFile), typeof(FileStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileInfo), false,
+ [Arguments(nameof(MockFileSystem.FileInfo), false,
typeof(IFileInfoFactory), typeof(FileInfoFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileInfo), true,
+ [Arguments(nameof(MockFileSystem.FileInfo), true,
typeof(IFileInfo), typeof(FileInfoStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileStream), false,
+ [Arguments(nameof(MockFileSystem.FileStream), false,
typeof(IFileStreamFactory), typeof(FileStreamFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileStream), true,
+ [Arguments(nameof(MockFileSystem.FileStream), true,
typeof(FileSystemStream), typeof(FileStreamStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileSystemWatcher), false,
+ [Arguments(nameof(MockFileSystem.FileSystemWatcher), false,
typeof(IFileSystemWatcherFactory), typeof(FileSystemWatcherFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileSystemWatcher), true,
+ [Arguments(nameof(MockFileSystem.FileSystemWatcher), true,
typeof(IFileSystemWatcher), typeof(FileSystemWatcherStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileVersionInfo), false,
+ [Arguments(nameof(MockFileSystem.FileVersionInfo), false,
typeof(IFileVersionInfoFactory), typeof(FileVersionInfoFactoryStatisticsTests))]
- [InlineData(nameof(MockFileSystem.FileVersionInfo), true,
+ [Arguments(nameof(MockFileSystem.FileVersionInfo), true,
typeof(IFileVersionInfo), typeof(FileVersionInfoStatisticsTests))]
- [InlineData(nameof(MockFileSystem.Path), false,
+ [Arguments(nameof(MockFileSystem.Path), false,
typeof(IPath), typeof(FileSystem.PathStatisticsTests))]
public async Task ShouldHaveTestedAllFileSystemMethods(string className, bool requireInstance,
Type mockType, Type testType)
@@ -63,7 +63,7 @@ public async Task ShouldHaveTestedAllFileSystemMethods(string className, bool re
await That(result).IsEmpty();
}
- [Fact]
+ [Test]
public async Task Statistics_ShouldIncrementCallOrder()
{
MockFileSystem sut = new();
@@ -83,7 +83,7 @@ await That(sut.Statistics.Directory.Methods[i]
}
}
- [Fact]
+ [Test]
public async Task Statistics_ShouldKeepCallOrder()
{
MockFileSystem sut = new();
@@ -106,7 +106,7 @@ await That(sut.Statistics.Directory.Methods
}
}
- [Fact]
+ [Test]
public async Task Statistics_ShouldSupportParallelCalls()
{
int parallelTasks = 100;
@@ -122,7 +122,7 @@ public async Task Statistics_ShouldSupportParallelCalls()
tasks[taskId] = Task.Run(() =>
{
sut.Directory.CreateDirectory(directories[taskId]);
- }, TestContext.Current.CancellationToken);
+ }, TestContext.Current!.Execution.CancellationToken);
}
await Task.WhenAll(tasks);
@@ -140,7 +140,7 @@ await That(sut.Statistics.Directory.Methods.Select(x => x.Counter))
.IsEqualTo(Enumerable.Range(1, directories.Length)).InAnyOrder();
}
- [Fact]
+ [Test]
public async Task Statistics_ShouldUseGlobalIncrement()
{
MockFileSystem sut = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryContainerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryContainerTests.cs
index cc6c55591..f7efdf297 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryContainerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryContainerTests.cs
@@ -8,8 +8,8 @@ namespace Testably.Abstractions.Testing.Tests.Storage;
public class InMemoryContainerTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AdjustAttributes_Decrypt_ShouldNotHaveEncryptedAttribute(string path)
{
MockFileSystem fileSystem = new();
@@ -27,8 +27,8 @@ public async Task AdjustAttributes_Decrypt_ShouldNotHaveEncryptedAttribute(strin
await That(result).DoesNotHaveFlag(FileAttributes.Encrypted);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AdjustAttributes_Encrypt_ShouldHaveEncryptedAttribute(string path)
{
MockFileSystem fileSystem = new();
@@ -45,8 +45,8 @@ public async Task AdjustAttributes_Encrypt_ShouldHaveEncryptedAttribute(string p
await That(result).HasFlag(FileAttributes.Encrypted);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AdjustAttributes_LeadingDot_ShouldBeHiddenOnUnix(string path)
{
path = "." + path;
@@ -71,9 +71,9 @@ public async Task AdjustAttributes_LeadingDot_ShouldBeHiddenOnUnix(string path)
}
#if FEATURE_FILESYSTEM_LINK
- [Theory]
- [InlineAutoData(null, false)]
- [InlineAutoData("foo", true)]
+ [Test]
+ [AutoArguments(null, false)]
+ [AutoArguments("foo", true)]
public async Task AdjustAttributes_ShouldHaveReparsePointAttributeWhenLinkTargetIsNotNull(
string? linkTarget, bool shouldHaveReparsePoint, string path)
{
@@ -101,8 +101,8 @@ public async Task AdjustAttributes_ShouldHaveReparsePointAttributeWhenLinkTarget
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Container_ShouldProvideCorrectTimeAndFileSystem(string path)
{
MockFileSystem fileSystem = new();
@@ -113,8 +113,8 @@ public async Task Container_ShouldProvideCorrectTimeAndFileSystem(string path)
await That(sut.TimeSystem).IsSameAs(fileSystem.TimeSystem);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Decrypt_Encrypted_ShouldDecryptBytes(
string path, byte[] bytes)
{
@@ -133,8 +133,8 @@ public async Task Decrypt_Encrypted_ShouldDecryptBytes(
await That(fileContainer.GetBytes()).IsEqualTo(bytes);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Decrypt_Unencrypted_ShouldDoNothing(
string path, byte[] bytes)
{
@@ -151,8 +151,8 @@ public async Task Decrypt_Unencrypted_ShouldDoNothing(
await That(fileContainer.GetBytes()).IsEqualTo(bytes);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Encrypt_Encrypted_ShouldDoNothing(
string path, byte[] bytes)
{
@@ -171,8 +171,8 @@ public async Task Encrypt_Encrypted_ShouldDoNothing(
await That(fileContainer.GetBytes()).IsEqualTo(bytes);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Encrypt_ShouldEncryptBytes(
string path, byte[] bytes)
{
@@ -190,8 +190,8 @@ public async Task Encrypt_ShouldEncryptBytes(
await That(fileContainer.GetBytes()).IsNotEqualTo(bytes);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task RequestAccess_ToString_DeleteAccess_ShouldContainAccessAndShare(string path,
FileAccess access, FileShare share)
{
@@ -208,8 +208,8 @@ public async Task RequestAccess_ToString_DeleteAccess_ShouldContainAccessAndShar
await That(result.ToString()).Contains(share.ToString());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task RequestAccess_ToString_ShouldContainAccessAndShare(string path,
FileAccess access,
FileShare share)
@@ -226,8 +226,8 @@ public async Task RequestAccess_ToString_ShouldContainAccessAndShare(string path
await That(result.ToString()).Contains(share.ToString());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task RequestAccess_WithoutDrive_ShouldThrowDirectoryNotFoundException(
string path)
{
@@ -243,9 +243,9 @@ public async Task RequestAccess_WithoutDrive_ShouldThrowDirectoryNotFoundExcepti
await That(exception).IsExactly();
}
- [Theory]
- [InlineAutoData(DateTimeKind.Local)]
- [InlineAutoData(DateTimeKind.Utc)]
+ [Test]
+ [AutoArguments(DateTimeKind.Local)]
+ [AutoArguments(DateTimeKind.Utc)]
public async Task TimeContainer_Time_Set_WithUnspecifiedKind_ShouldSetToProvidedKind(
DateTimeKind kind, string path, DateTime time)
{
@@ -262,8 +262,8 @@ public async Task TimeContainer_Time_Set_WithUnspecifiedKind_ShouldSetToProvided
await That(result.Kind).IsEqualTo(kind);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task TimeContainer_ToString_ShouldReturnUtcTime(
string path, DateTime time)
{
@@ -281,7 +281,7 @@ public async Task TimeContainer_ToString_ShouldReturnUtcTime(
await That(result).IsEqualTo(expectedString);
}
- [Fact]
+ [Test]
public async Task ToString_Directory_ShouldIncludePath()
{
MockFileSystem fileSystem = new();
@@ -296,8 +296,8 @@ public async Task ToString_Directory_ShouldIncludePath()
await That(result).IsEqualTo($"{expectedPath}: Directory");
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_File_ShouldIncludePathAndFileSize(byte[] bytes)
{
MockFileSystem fileSystem = new();
@@ -311,7 +311,7 @@ public async Task ToString_File_ShouldIncludePathAndFileSize(byte[] bytes)
await That(result).IsEqualTo($"{expectedPath}: File ({bytes.Length} bytes)");
}
- [Fact]
+ [Test]
public async Task ToString_UnknownContainer_ShouldIncludePath()
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryLocationTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryLocationTests.cs
index c14429332..2e45cd6a7 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryLocationTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryLocationTests.cs
@@ -6,8 +6,8 @@ namespace Testably.Abstractions.Testing.Tests.Storage;
public class InMemoryLocationTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_AsObject_ForInMemoryLocation_ShouldIgnoreTrailingDirectorySeparator(
string path1, string path2)
{
@@ -20,8 +20,8 @@ public async Task Equals_AsObject_ForInMemoryLocation_ShouldIgnoreTrailingDirect
await That(result).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_ForDummyLocation_ShouldCompareFullPath(
string path)
{
@@ -34,8 +34,8 @@ public async Task Equals_ForDummyLocation_ShouldCompareFullPath(
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_ForInMemoryLocation_ShouldIgnoreTrailingDirectorySeparator(
string path)
{
@@ -51,8 +51,8 @@ public async Task Equals_ForInMemoryLocation_ShouldIgnoreTrailingDirectorySepara
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_Null_ShouldReturnFalse(string path)
{
IStorageLocation location = InMemoryLocation.New(new MockFileSystem(), null, path);
@@ -62,8 +62,8 @@ public async Task Equals_Null_ShouldReturnFalse(string path)
await That(result).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_Object_ForInMemoryLocation_ShouldIgnoreTrailingDirectorySeparator(
string path)
{
@@ -79,8 +79,8 @@ public async Task Equals_Object_ForInMemoryLocation_ShouldIgnoreTrailingDirector
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_Object_Null_ShouldReturnFalse(string path)
{
object location = InMemoryLocation.New(new MockFileSystem(), null, path);
@@ -90,8 +90,8 @@ public async Task Equals_Object_Null_ShouldReturnFalse(string path)
await That(result).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_Object_SameInstance_ShouldReturnTrue(string path)
{
object location = InMemoryLocation.New(new MockFileSystem(), null, path);
@@ -102,8 +102,8 @@ public async Task Equals_Object_SameInstance_ShouldReturnTrue(string path)
await That(result).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Equals_SameInstance_ShouldReturnTrue(string path)
{
IStorageLocation location = InMemoryLocation.New(new MockFileSystem(), null, path);
@@ -113,7 +113,7 @@ public async Task Equals_SameInstance_ShouldReturnTrue(string path)
await That(result).IsTrue();
}
- [Fact]
+ [Test]
public async Task GetParent_Root_ShouldReturnNull()
{
MockFileSystem fileSystem = new();
@@ -125,7 +125,7 @@ public async Task GetParent_Root_ShouldReturnNull()
await That(result).IsNull();
}
- [Fact]
+ [Test]
public async Task New_EmptyPath_ShouldThrowArgumentException()
{
void Act()
@@ -136,8 +136,8 @@ void Act()
await That(Act).ThrowsExactly().WithHResult(-2147024809);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ToString_ShouldReturnPath(string path)
{
IStorageLocation location = InMemoryLocation.New(new MockFileSystem(), null, path);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryStorageTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryStorageTests.cs
index fdd950165..7edc28929 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryStorageTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Storage/InMemoryStorageTests.cs
@@ -21,8 +21,8 @@ public InMemoryStorageTests()
#endregion
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Copy_Overwrite_ShouldAdjustAvailableFreeSpace(
int file1Size, int file2Size)
{
@@ -45,14 +45,14 @@ await That(availableFreeSpaceAfter)
.IsEqualTo(availableFreeSpaceBefore + file2Size - file1Size);
}
- [Fact]
+ [Test]
public async Task CurrentDirectory_ShouldBeInitializedToDefaultRoot()
{
string expectedRoot = string.Empty.PrefixRoot(new MockFileSystem());
await That(Storage.CurrentDirectory).IsEqualTo(expectedRoot);
}
- [Fact]
+ [Test]
public async Task Delete_RaceCondition_ShouldReturnFalse()
{
MockFileSystem fileSystem = new();
@@ -75,11 +75,11 @@ public async Task Delete_RaceCondition_ShouldReturnFalse()
await That(exception).IsExactly();
}
- [Theory]
- [InlineData((string?)null)]
- [InlineData("")]
- [InlineData(" ")]
- [InlineData("\t")]
+ [Test]
+ [Arguments((string?)null)]
+ [Arguments("")]
+ [Arguments(" ")]
+ [Arguments("\t")]
public async Task GetDrive_NullOrWhitespace_ShouldReturnNull(string? driveName)
{
IStorageDrive? result = Storage.GetDrive(driveName);
@@ -87,7 +87,7 @@ public async Task GetDrive_NullOrWhitespace_ShouldReturnNull(string? driveName)
await That(result).IsNull();
}
- [Fact]
+ [Test]
public async Task GetOrAddDrive_Null_ShouldReturnNull()
{
IStorageDrive? result = Storage.GetOrAddDrive(driveName: null);
@@ -95,7 +95,7 @@ public async Task GetOrAddDrive_Null_ShouldReturnNull()
await That(result).IsNull();
}
- [Fact]
+ [Test]
public async Task GetOrCreateContainer_WithMetadata_ShouldBeKept()
{
FileSystemExtensibility extensibility = new();
@@ -114,8 +114,8 @@ public async Task GetOrCreateContainer_WithMetadata_ShouldBeKept()
await That(result2).IsEqualTo(42);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Move_RequestDeniedForChild_ShouldRollback(
string locationPath, string destinationPath)
{
@@ -152,8 +152,8 @@ public async Task Move_RequestDeniedForChild_ShouldRollback(
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Replace_WithBackup_ShouldChangeAvailableFreeSpace(
int file1Size, int file2Size, int file3Size)
{
@@ -178,8 +178,8 @@ public async Task Replace_WithBackup_ShouldChangeAvailableFreeSpace(
await That(availableFreeSpaceAfter).IsEqualTo(availableFreeSpaceBefore + file2Size);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Replace_WithoutBackup_ShouldNotChangeAvailableFreeSpace(
int file1Size, int file2Size)
{
@@ -201,8 +201,8 @@ public async Task Replace_WithoutBackup_ShouldNotChangeAvailableFreeSpace(
await That(availableFreeSpaceAfter).IsEqualTo(availableFreeSpaceBefore);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task TryAddContainer_ShouldNotifyWhenAdded(string path)
{
bool receivedNotification = false;
@@ -218,8 +218,8 @@ public async Task TryAddContainer_ShouldNotifyWhenAdded(string path)
await That(container!.Type).IsEqualTo(FileSystemTypes.Directory);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task TryAddContainer_ShouldNotNotifyWhenExistsPreviously(string path)
{
IStorageLocation location = Storage.GetLocation(path);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Storage/LocationExtensionsTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Storage/LocationExtensionsTests.cs
index eebc09555..9e4cd1749 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Storage/LocationExtensionsTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Storage/LocationExtensionsTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.Storage;
public sealed class LocationExtensionsTests
{
- [Fact]
+ [Test]
public async Task
ThrowExceptionIfNotFound_MissingDirectory_ShouldThrowDirectoryNotFoundException()
{
@@ -20,8 +20,8 @@ public async Task
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ThrowExceptionIfNotFound_MissingDirectory_WithCustomCallback_ShouldThrowExceptionFromCallback(
Exception expectedException)
@@ -38,7 +38,7 @@ public async Task
await That(exception).IsSameAs(expectedException);
}
- [Fact]
+ [Test]
public async Task ThrowExceptionIfNotFound_MissingFile_ShouldThrowFileNotFoundException()
{
MockFileSystem fileSystem = new();
@@ -52,8 +52,8 @@ public async Task ThrowExceptionIfNotFound_MissingFile_ShouldThrowFileNotFoundEx
await That(exception).IsExactly();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
ThrowExceptionIfNotFound_MissingFile_WithCustomCallback_ShouldThrowExceptionFromCallback(
Exception expectedException)
@@ -69,8 +69,8 @@ public async Task
await That(exception).IsSameAs(expectedException);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ThrowIfNotFound_MissingDirectory_ShouldExecuteFileNotFoundAction(
Exception expectedException)
{
@@ -86,8 +86,8 @@ public async Task ThrowIfNotFound_MissingDirectory_ShouldExecuteFileNotFoundActi
await That(exception).IsSameAs(expectedException);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ThrowIfNotFound_MissingFile_ShouldExecuteFileNotFoundAction(
Exception expectedException)
{
@@ -102,8 +102,8 @@ public async Task ThrowIfNotFound_MissingFile_ShouldExecuteFileNotFoundAction(
await That(exception).IsSameAs(expectedException);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task ThrowIfNotFound_Null_ShouldExecuteFileNotFoundAction(
Exception expectedException)
{
diff --git a/Tests/Testably.Abstractions.Testing.Tests/Storage/NullContainerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/Storage/NullContainerTests.cs
index a6eb0e89d..f3a452a1c 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/Storage/NullContainerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/Storage/NullContainerTests.cs
@@ -5,8 +5,8 @@ namespace Testably.Abstractions.Testing.Tests.Storage;
public class NullContainerTests
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task AppendBytes_ShouldReturnEmptyArray(byte[] bytes)
{
MockFileSystem fileSystem = new();
@@ -17,7 +17,7 @@ public async Task AppendBytes_ShouldReturnEmptyArray(byte[] bytes)
await That(sut.GetBytes()).IsEmpty();
}
- [Fact]
+ [Test]
public async Task ClearBytes_ShouldReturnEmptyArray()
{
MockFileSystem fileSystem = new();
@@ -28,7 +28,7 @@ public async Task ClearBytes_ShouldReturnEmptyArray()
await That(sut.GetBytes()).IsEmpty();
}
- [Fact]
+ [Test]
public async Task Constructor_ShouldSetFileAndTimeSystem()
{
MockFileSystem fileSystem = new();
@@ -39,7 +39,7 @@ public async Task Constructor_ShouldSetFileAndTimeSystem()
await That(sut.TimeSystem).IsSameAs(fileSystem.TimeSystem);
}
- [Fact]
+ [Test]
public async Task CreationTime_WithUnspecifiedKind_ShouldReturnNullTime()
{
MockFileSystem fileSystem = new();
@@ -50,7 +50,7 @@ public async Task CreationTime_WithUnspecifiedKind_ShouldReturnNullTime()
await That(result).IsEqualTo(new DateTime(1601, 1, 1, 0, 0, 0, DateTimeKind.Utc));
}
- [Fact]
+ [Test]
public async Task Decrypt_ShouldReturnEmptyArray()
{
MockFileSystem fileSystem = new();
@@ -61,7 +61,7 @@ public async Task Decrypt_ShouldReturnEmptyArray()
await That(sut.GetBytes()).IsEmpty();
}
- [Fact]
+ [Test]
public async Task Encrypt_ShouldReturnEmptyArray()
{
MockFileSystem fileSystem = new();
@@ -72,7 +72,7 @@ public async Task Encrypt_ShouldReturnEmptyArray()
await That(sut.GetBytes()).IsEmpty();
}
- [Fact]
+ [Test]
public async Task GetBytes_ShouldReturnEmptyArray()
{
MockFileSystem fileSystem = new();
@@ -81,8 +81,8 @@ public async Task GetBytes_ShouldReturnEmptyArray()
await That(sut.GetBytes()).IsEmpty();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task LinkTarget_ShouldAlwaysReturnNull(string linkTarget)
{
MockFileSystem fileSystem = new();
@@ -94,8 +94,8 @@ public async Task LinkTarget_ShouldAlwaysReturnNull(string linkTarget)
await That(sut.LinkTarget).IsNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task RequestAccess_Dispose_Twice_ShouldDoNothing(FileAccess access,
FileShare share)
{
@@ -113,8 +113,8 @@ public async Task RequestAccess_Dispose_Twice_ShouldDoNothing(FileAccess access,
await That(exception).IsNull();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task RequestAccess_ShouldReturnNullObject(FileAccess access, FileShare share,
bool deleteAccess)
{
@@ -128,7 +128,7 @@ public async Task RequestAccess_ShouldReturnNullObject(FileAccess access, FileSh
await That(result.DeleteAccess).IsEqualTo(deleteAccess);
}
- [Fact]
+ [Test]
public async Task Type_ShouldBeDirectoryOrFile()
{
MockFileSystem fileSystem = new();
@@ -137,8 +137,8 @@ public async Task Type_ShouldBeDirectoryOrFile()
await That(sut.Type).IsEqualTo(FileSystemTypes.DirectoryOrFile);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task WriteBytes_ShouldReturnEmptyArray(byte[] bytes)
{
MockFileSystem fileSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/FileSystemTestSettingsFixture.cs b/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/FileSystemTestSettingsFixture.cs
deleted file mode 100644
index 21e1e2e1e..000000000
--- a/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/FileSystemTestSettingsFixture.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Testably.Abstractions.TestHelpers.Settings;
-
-namespace Testably.Abstractions.Testing.Tests.TestHelpers;
-
-[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.
-}
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/Usings.cs b/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/Usings.cs
index d9bb8eb36..a14f370a0 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/Usings.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TestHelpers/Usings.cs
@@ -1,13 +1,9 @@
-#if NET48
-global using Testably.Abstractions.Polyfills;
-# endif
-global using AutoFixture.Xunit3;
-global using System;
+global using System;
global using System.IO.Abstractions;
global using System.Threading.Tasks;
global using Testably.Abstractions.TestHelpers;
global using Test = Testably.Abstractions.Testing.Tests.TestHelpers.Test;
-global using Xunit;
+global using TUnit;
global using aweXpect;
global using static aweXpect.Expect;
global using Skip = Testably.Abstractions.TestHelpers.Skip;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeProviderTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeProviderTests.cs
index e3837748a..e9a861c9d 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeProviderTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeProviderTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests;
public class TimeProviderTests
{
- [Fact]
+ [Test]
public async Task Now_ShouldReturnCurrentDateTime()
{
DateTime begin = DateTime.UtcNow;
@@ -20,7 +20,7 @@ public async Task Now_ShouldReturnCurrentDateTime()
await That(result2).IsOnOrAfter(begin).And.IsOnOrBefore(end);
}
- [Fact]
+ [Test]
public async Task Random_ShouldReturnRandomDateTime()
{
ConcurrentBag results = [];
@@ -33,8 +33,8 @@ public async Task Random_ShouldReturnRandomDateTime()
await That(results).AreAllUnique();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task SetTo_ShouldChangeTimeForRead(DateTime time1, DateTime time2)
{
ITimeProvider timeProvider = TimeProvider.Use(time1);
@@ -47,7 +47,7 @@ public async Task SetTo_ShouldChangeTimeForRead(DateTime time1, DateTime time2)
await That(result2).IsEqualTo(time2);
}
- [Fact]
+ [Test]
public async Task Use_ShouldReturnFixedDateTime()
{
DateTime now = TimeTestHelper.GetRandomTime();
@@ -60,7 +60,7 @@ public async Task Use_ShouldReturnFixedDateTime()
await That(result2).IsEqualTo(now);
}
- [Fact]
+ [Test]
public async Task Use_UnspecifiedKind_ShouldConvertToUtcDateTime()
{
DateTime unspecifiedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Unspecified);
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/NotificationHandlerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/NotificationHandlerTests.cs
index f3d64ea2c..ffbb23112 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/NotificationHandlerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/NotificationHandlerTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.TimeSystem;
public class NotificationHandlerTests
{
- [Fact]
+ [Test]
public async Task OnDateTimeRead_DisposedCallback_ShouldNotBeCalled()
{
DateTime expectedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Local);
@@ -19,7 +19,7 @@ public async Task OnDateTimeRead_DisposedCallback_ShouldNotBeCalled()
await That(receivedTime).IsNull();
}
- [Fact]
+ [Test]
public async Task OnDateTimeRead_MultipleCallbacks_DisposeOne_ShouldCallOtherCallbacks()
{
DateTime expectedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Local);
@@ -37,7 +37,7 @@ public async Task OnDateTimeRead_MultipleCallbacks_DisposeOne_ShouldCallOtherCal
await That(receivedTime2).IsNull();
}
- [Fact]
+ [Test]
public async Task OnDateTimeRead_MultipleCallbacks_ShouldAllBeCalled()
{
DateTime expectedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Local);
@@ -57,7 +57,7 @@ public async Task OnDateTimeRead_MultipleCallbacks_ShouldAllBeCalled()
await That(receivedTime2).IsEqualTo(expectedTime);
}
- [Fact]
+ [Test]
public async Task OnDateTimeRead_Today_ShouldExecuteCallbackWithCorrectParameter()
{
DateTime expectedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Local).Date;
@@ -72,7 +72,7 @@ public async Task OnDateTimeRead_Today_ShouldExecuteCallbackWithCorrectParameter
await That(receivedTime).IsEqualTo(expectedTime);
}
- [Fact]
+ [Test]
public async Task OnDateTimeRead_UtcNow_ShouldExecuteCallbackWithCorrectParameter()
{
DateTime expectedTime = TimeTestHelper.GetRandomTime(DateTimeKind.Utc);
@@ -87,7 +87,7 @@ public async Task OnDateTimeRead_UtcNow_ShouldExecuteCallbackWithCorrectParamete
await That(receivedTime).IsEqualTo(expectedTime);
}
- [Fact]
+ [Test]
public async Task OnTaskDelay_DisposedCallback_ShouldNotBeCalled()
{
int millisecondsDelay = new Random().Next();
@@ -96,12 +96,12 @@ public async Task OnTaskDelay_DisposedCallback_ShouldNotBeCalled()
IDisposable disposable = timeSystem.On.TaskDelay(d => receivedDelay = d);
disposable.Dispose();
- _ = timeSystem.Task.Delay(millisecondsDelay, TestContext.Current.CancellationToken);
+ _ = timeSystem.Task.Delay(millisecondsDelay, TestContext.Current!.Execution.CancellationToken);
await That(receivedDelay).IsNull();
}
- [Fact]
+ [Test]
public async Task OnTaskDelay_MultipleCallbacks_DisposeOne_ShouldCallOtherCallbacks()
{
TimeSpan expectedDelay = TimeTestHelper.GetRandomInterval();
@@ -112,14 +112,14 @@ public async Task OnTaskDelay_MultipleCallbacks_DisposeOne_ShouldCallOtherCallba
using (timeSystem.On.TaskDelay(d => receivedDelay1 = d))
{
timeSystem.On.TaskDelay(d => receivedDelay2 = d).Dispose();
- _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current.CancellationToken);
+ _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current!.Execution.CancellationToken);
}
await That(receivedDelay1).IsEqualTo(expectedDelay);
await That(receivedDelay2).IsNull();
}
- [Fact]
+ [Test]
public async Task OnTaskDelay_MultipleCallbacks_ShouldAllBeCalled()
{
TimeSpan expectedDelay = TimeTestHelper.GetRandomInterval();
@@ -131,7 +131,7 @@ public async Task OnTaskDelay_MultipleCallbacks_ShouldAllBeCalled()
{
using (timeSystem.On.TaskDelay(d => receivedDelay2 = d))
{
- _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current.CancellationToken);
+ _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current!.Execution.CancellationToken);
}
}
@@ -139,7 +139,7 @@ public async Task OnTaskDelay_MultipleCallbacks_ShouldAllBeCalled()
await That(receivedDelay2).IsEqualTo(expectedDelay);
}
- [Fact]
+ [Test]
public async Task
OnTaskDelay_WithMillisecondsAndWithCancellationToken_ShouldExecuteCallbackWithCorrectParameter()
{
@@ -155,7 +155,7 @@ public async Task
await That(receivedDelay.TotalMilliseconds).IsEqualTo(millisecondsDelay);
}
- [Fact]
+ [Test]
public async Task
OnTaskDelay_WithMillisecondsAndWithoutCancellationToken_ShouldExecuteCallbackWithCorrectParameter()
{
@@ -165,13 +165,13 @@ public async Task
using (timeSystem.On.TaskDelay(d => receivedDelay = d))
{
- _ = timeSystem.Task.Delay(millisecondsDelay, TestContext.Current.CancellationToken);
+ _ = timeSystem.Task.Delay(millisecondsDelay, TestContext.Current!.Execution.CancellationToken);
}
await That(receivedDelay.TotalMilliseconds).IsEqualTo(millisecondsDelay);
}
- [Fact]
+ [Test]
public async Task
OnTaskDelay_WithTimeSpanAndWithCancellationToken_ShouldExecuteCallbackWithCorrectParameter()
{
@@ -187,7 +187,7 @@ public async Task
await That(receivedDelay).IsEqualTo(expectedDelay);
}
- [Fact]
+ [Test]
public async Task
OnTaskDelay_WithTimeSpanAndWithoutCancellationToken_ShouldExecuteCallbackWithCorrectParameter()
{
@@ -197,13 +197,13 @@ public async Task
using (timeSystem.On.TaskDelay(d => receivedDelay = d))
{
- _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current.CancellationToken);
+ _ = timeSystem.Task.Delay(expectedDelay, TestContext.Current!.Execution.CancellationToken);
}
await That(receivedDelay).IsEqualTo(expectedDelay);
}
- [Fact]
+ [Test]
public async Task OnThreadSleep_DisposedCallback_ShouldNotBeCalled()
{
int millisecondsTimeout = new Random().Next();
@@ -217,7 +217,7 @@ public async Task OnThreadSleep_DisposedCallback_ShouldNotBeCalled()
await That(receivedTimeout).IsNull();
}
- [Fact]
+ [Test]
public async Task OnThreadSleep_MultipleCallbacks_DisposeOne_ShouldCallOtherCallbacks()
{
TimeSpan expectedTimeout = TimeTestHelper.GetRandomInterval();
@@ -235,7 +235,7 @@ public async Task OnThreadSleep_MultipleCallbacks_DisposeOne_ShouldCallOtherCall
await That(receivedTimeout2).IsNull();
}
- [Fact]
+ [Test]
public async Task OnThreadSleep_MultipleCallbacks_ShouldAllBeCalled()
{
TimeSpan expectedTimeout = TimeTestHelper.GetRandomInterval();
@@ -255,7 +255,7 @@ public async Task OnThreadSleep_MultipleCallbacks_ShouldAllBeCalled()
await That(receivedTimeout2).IsEqualTo(expectedTimeout);
}
- [Fact]
+ [Test]
public async Task OnThreadSleep_WithMilliseconds_ShouldExecuteCallbackWithCorrectParameter()
{
int millisecondsTimeout = new Random().Next();
@@ -270,7 +270,7 @@ public async Task OnThreadSleep_WithMilliseconds_ShouldExecuteCallbackWithCorrec
await That(receivedTimeout.TotalMilliseconds).IsEqualTo(millisecondsTimeout);
}
- [Fact]
+ [Test]
public async Task OnThreadSleep_WithTimeSpan_ShouldExecuteCallbackWithCorrectParameter()
{
TimeSpan expectedTimeout = TimeTestHelper.GetRandomInterval();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchFactoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchFactoryMockTests.cs
index c7f73a04c..b976a1f78 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchFactoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchFactoryMockTests.cs
@@ -4,7 +4,7 @@ namespace Testably.Abstractions.Testing.Tests.TimeSystem;
public class StopwatchFactoryMockTests
{
- [Fact]
+ [Test]
public async Task Wrap_ShouldThrowNotSupportedException()
{
MockTimeSystem timeSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchMockTests.cs
index df76f68fc..e2176c914 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/StopwatchMockTests.cs
@@ -4,17 +4,17 @@ namespace Testably.Abstractions.Testing.Tests.TimeSystem;
public class StopwatchMockTests
{
- [Theory]
- [InlineData(0)]
- [InlineData(1)]
- [InlineData(15)]
- [InlineData(1234567890)]
+ [Test]
+ [Arguments(0)]
+ [Arguments(1)]
+ [Arguments(15)]
+ [Arguments(1234567890)]
public async Task ShouldSupportTicksPrecision(long delayTicks)
{
MockTimeSystem timeSystem = new();
IStopwatch stopwatch = timeSystem.Stopwatch.StartNew();
await timeSystem.Task.Delay(TimeSpan.FromTicks(delayTicks),
- TestContext.Current.CancellationToken);
+ TestContext.Current!.Execution.CancellationToken);
long elapsedTicks = stopwatch.ElapsedTicks;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimeSystemExtensibilityTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimeSystemExtensibilityTests.cs
index 32fbe830a..a3a9c8766 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimeSystemExtensibilityTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimeSystemExtensibilityTests.cs
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
using Testably.Abstractions.TimeSystem;
namespace Testably.Abstractions.Testing.Tests.TimeSystem;
@@ -6,17 +7,16 @@ public class TimeSystemExtensibilityTests
{
#region Test Setup
- public static TheoryData GetTimeSystems
- => new()
- {
- (ITimeSystem)new RealTimeSystem(),
- (ITimeSystem)new MockTimeSystem(),
- };
+ public static IEnumerable> GetTimeSystems()
+ {
+ yield return () => new RealTimeSystem();
+ yield return () => new MockTimeSystem();
+ }
#endregion
- [Theory]
- [MemberData(nameof(GetTimeSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetTimeSystems))]
public async Task DateTime_ShouldSetExtensionPoint(ITimeSystem timeSystem)
{
IDateTime sut = timeSystem.DateTime;
@@ -26,8 +26,8 @@ public async Task DateTime_ShouldSetExtensionPoint(ITimeSystem timeSystem)
await That(result).IsEqualTo(timeSystem);
}
- [Theory]
- [MemberData(nameof(GetTimeSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetTimeSystems))]
public async Task Task_ShouldSetExtensionPoint(ITimeSystem timeSystem)
{
ITask sut = timeSystem.Task;
@@ -37,8 +37,8 @@ public async Task Task_ShouldSetExtensionPoint(ITimeSystem timeSystem)
await That(result).IsEqualTo(timeSystem);
}
- [Theory]
- [MemberData(nameof(GetTimeSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetTimeSystems))]
public async Task Thread_ShouldSetExtensionPoint(ITimeSystem timeSystem)
{
IThread sut = timeSystem.Thread;
@@ -48,8 +48,8 @@ public async Task Thread_ShouldSetExtensionPoint(ITimeSystem timeSystem)
await That(result).IsEqualTo(timeSystem);
}
- [Theory]
- [MemberData(nameof(GetTimeSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetTimeSystems))]
public async Task Timer_ShouldSetExtensionPoint(ITimeSystem timeSystem)
{
using ITimer sut = timeSystem.Timer.New(_ => { });
@@ -59,8 +59,8 @@ public async Task Timer_ShouldSetExtensionPoint(ITimeSystem timeSystem)
await That(result).IsEqualTo(timeSystem);
}
- [Theory]
- [MemberData(nameof(GetTimeSystems))]
+ [Test]
+ [MethodDataSource(nameof(GetTimeSystems))]
public async Task TimerFactory_ShouldSetExtensionPoint(ITimeSystem timeSystem)
{
ITimerFactory sut = timeSystem.Timer;
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerFactoryMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerFactoryMockTests.cs
index caae83d4b..6dbcb855f 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerFactoryMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerFactoryMockTests.cs
@@ -5,7 +5,7 @@ namespace Testably.Abstractions.Testing.Tests.TimeSystem;
public class TimerFactoryMockTests
{
- [Fact]
+ [Test]
public async Task New_WithoutPeriod_ShouldStillBeRegistered()
{
MockTimeSystem timeSystem = new();
@@ -24,11 +24,11 @@ public async Task New_WithoutPeriod_ShouldStillBeRegistered()
}
});
- await That(ms.Wait(300, TestContext.Current.CancellationToken)).IsFalse();
+ await That(ms.Wait(300, TestContext.Current!.Execution.CancellationToken)).IsFalse();
await That(timeSystem.TimerHandler[0]).IsEqualTo(timer);
}
- [Fact]
+ [Test]
public async Task Wrap_ShouldThrowNotSupportedException()
{
MockTimeSystem timeSystem = new();
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerHandlerTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerHandlerTests.cs
index 02769fc38..e44d5b6c8 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerHandlerTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerHandlerTests.cs
@@ -6,7 +6,7 @@ namespace Testably.Abstractions.Testing.Tests.TimeSystem;
public class TimerHandlerTests
{
- [Fact]
+ [Test]
public async Task Index_AccessDisposedIndex_ShouldThrowException()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -26,7 +26,7 @@ public async Task Index_AccessDisposedIndex_ShouldThrowException()
await That(exception).IsExactly();
}
- [Fact]
+ [Test]
public async Task Index_MultipleTimers_ShouldIncrement()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -40,7 +40,7 @@ public async Task Index_MultipleTimers_ShouldIncrement()
await That(sut[1]).IsEqualTo(timer1);
}
- [Fact]
+ [Test]
public async Task Index_ShouldNotReuseDisposedIndexes()
{
MockTimeSystem timeSystem = new MockTimeSystem()
diff --git a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerMockTests.cs b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerMockTests.cs
index 5b98340cb..e015802e3 100644
--- a/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerMockTests.cs
+++ b/Tests/Testably.Abstractions.Testing.Tests/TimeSystem/TimerMockTests.cs
@@ -5,12 +5,12 @@
namespace Testably.Abstractions.Testing.Tests.TimeSystem;
// ReSharper disable UseAwaitUsing
-public class TimerMockTests(ITestOutputHelper testOutputHelper)
+public class TimerMockTests
{
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(2000)]
+ [Test]
+ [Arguments(-1)]
+ [Arguments(0)]
+ [Arguments(2000)]
public async Task Change_ValidDueTimeValue_ShouldNotThrowException(int dueTime)
{
MockTimeSystem timeSystem = new();
@@ -27,10 +27,10 @@ public async Task Change_ValidDueTimeValue_ShouldNotThrowException(int dueTime)
await That(exception).IsNull();
}
- [Theory]
- [InlineData(-1)]
- [InlineData(0)]
- [InlineData(2000)]
+ [Test]
+ [Arguments(-1)]
+ [Arguments(0)]
+ [Arguments(2000)]
public async Task Change_ValidPeriodValue_ShouldNotThrowException(int period)
{
MockTimeSystem timeSystem = new();
@@ -47,7 +47,7 @@ public async Task Change_ValidPeriodValue_ShouldNotThrowException(int period)
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Dispose_ShouldDisposeTimer()
{
MockTimeSystem timeSystem = new();
@@ -74,7 +74,7 @@ await That(Act).Throws()
#endif
}
- [Fact]
+ [Test]
public async Task Dispose_WithUnknownWaitHandle_ShouldThrowNotSupportedException()
{
MockTimeSystem timeSystem = new();
@@ -96,7 +96,7 @@ await That(Act).ThrowsExactly()
}
#if FEATURE_ASYNC_DISPOSABLE
- [Fact]
+ [Test]
public async Task DisposeAsync_ShouldDisposeTimer()
{
MockTimeSystem timeSystem = new();
@@ -120,7 +120,7 @@ void Act()
}
#endif
- [Fact]
+ [Test]
public async Task Exception_WhenSwallowExceptionsIsNotSet_ShouldStopTimer()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -143,12 +143,12 @@ public async Task Exception_WhenSwallowExceptionsIsNotSet_ShouldStopTimer()
timeSystem.TimerHandler[0].Wait();
});
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
await That(exception).IsEqualTo(expectedException);
await That(count).IsEqualTo(1);
}
- [Fact]
+ [Test]
public async Task Exception_WhenSwallowExceptionsIsNotSet_ShouldThrowExceptionOnWait()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -167,7 +167,7 @@ public async Task Exception_WhenSwallowExceptionsIsNotSet_ShouldThrowExceptionOn
await That(exception).IsEqualTo(expectedException);
}
- [Fact]
+ [Test]
public async Task Exception_WhenSwallowExceptionsIsSet_ShouldContinueTimerExecution()
{
MockTimeSystem timeSystem = new();
@@ -197,12 +197,12 @@ public async Task Exception_WhenSwallowExceptionsIsSet_ShouldContinueTimerExecut
}
}, null, 0, 20);
- await That(ms.Wait(10000, TestContext.Current.CancellationToken)).IsTrue();
+ await That(ms.Wait(10000, TestContext.Current!.Execution.CancellationToken)).IsTrue();
await That(count).IsGreaterThanOrEqualTo(3);
}
- [Fact]
+ [Test]
public async Task New_WithStartOnMockWaitMode_ShouldOnlyStartWhenCallingWait()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -212,13 +212,13 @@ public async Task New_WithStartOnMockWaitMode_ShouldOnlyStartWhenCallingWait()
int count = 0;
using ITimer timer = timeSystem.Timer.New(_ => count++, null, 0, 100);
- await Task.Delay(10, TestContext.Current.CancellationToken);
+ await Task.Delay(10, TestContext.Current!.Execution.CancellationToken);
await That(count).IsEqualTo(0);
timerHandler[0].Wait();
await That(count).IsGreaterThan(0);
}
- [Fact]
+ [Test]
public async Task Wait_Infinite_ShouldBeValidTimeout()
{
MockTimeSystem timeSystem = new MockTimeSystem()
@@ -237,7 +237,7 @@ public async Task Wait_Infinite_ShouldBeValidTimeout()
await That(exception).IsNull();
}
- [Fact]
+ [Test]
public async Task Wait_InvalidExecutionCount_ShouldThrowArgumentOutOfRangeException()
{
MockTimeSystem timeSystem = new();
@@ -255,7 +255,7 @@ await That(Act).ThrowsExactly().WithParamName("exec
.WithMessage("Execution count must be greater than zero.").AsPrefix();
}
- [Fact]
+ [Test]
public async Task Wait_InvalidTimeout_ShouldThrowArgumentOutOfRangeException()
{
MockTimeSystem timeSystem = new();
@@ -271,7 +271,7 @@ void Act()
await That(Act).ThrowsExactly().WithParamName("timeout");
}
- [Fact]
+ [Test]
public async Task Wait_TimeoutExpired_ShouldThrowTimeoutException()
{
MockTimeSystem timeSystem = new();
@@ -285,7 +285,7 @@ public async Task Wait_TimeoutExpired_ShouldThrowTimeoutException()
try
{
count++;
- ms.Wait(TestContext.Current.CancellationToken);
+ ms.Wait(TestContext.Current!.Execution.CancellationToken);
}
catch (ObjectDisposedException)
{
@@ -303,7 +303,7 @@ public async Task Wait_TimeoutExpired_ShouldThrowTimeoutException()
await That(count).IsGreaterThan(0);
}
- [Fact]
+ [Test]
public async Task Wait_Twice_ShouldContinueExecutionsAfterFirstWait()
{
int executionCount = 10;
@@ -315,24 +315,24 @@ public async Task Wait_Twice_ShouldContinueExecutionsAfterFirstWait()
using ITimer timer = timeSystem.Timer.New(_ =>
{
count++;
- testOutputHelper.WriteLine($"Execute: {count}");
+ Console.WriteLine($"Execute: {count}");
}, null, 0, 100);
- testOutputHelper.WriteLine($"Waiting {executionCount} times...");
+ Console.WriteLine($"Waiting {executionCount} times...");
timerHandler[0].Wait(executionCount, callback: _ =>
- testOutputHelper.WriteLine("Waiting completed."));
- testOutputHelper.WriteLine($"Waiting {executionCount} times...");
+ Console.WriteLine("Waiting completed."));
+ Console.WriteLine($"Waiting {executionCount} times...");
timerHandler[0].Wait(executionCount, callback: t =>
{
- testOutputHelper.WriteLine("Waiting completed.");
- testOutputHelper.WriteLine("Disposing...");
+ Console.WriteLine("Waiting completed.");
+ Console.WriteLine("Disposing...");
t.Dispose();
- testOutputHelper.WriteLine("Disposed.");
+ Console.WriteLine("Disposed.");
}, timeout: 10000);
await That(count).IsGreaterThanOrEqualTo(2 * executionCount);
}
- [Fact]
+ [Test]
public async Task Wait_WithExecutionCount_ShouldWaitForSpecifiedNumberOfExecutions()
{
int executionCount = 10;
@@ -344,19 +344,19 @@ public async Task Wait_WithExecutionCount_ShouldWaitForSpecifiedNumberOfExecutio
using ITimer timer = timeSystem.Timer.New(_ =>
{
count++;
- testOutputHelper.WriteLine($"Execute: {count}");
+ Console.WriteLine($"Execute: {count}");
}, null, 0, 100);
await That(count).IsEqualTo(0);
timerHandler[0].Wait(executionCount, callback: t =>
{
- testOutputHelper.WriteLine("Disposing...");
+ Console.WriteLine("Disposing...");
t.Dispose();
- testOutputHelper.WriteLine("Disposed.");
+ Console.WriteLine("Disposed.");
}, timeout: 10000);
- testOutputHelper.WriteLine("Waiting 100ms...");
- await Task.Delay(1000, TestContext.Current.CancellationToken);
- testOutputHelper.WriteLine("Waiting completed.");
+ Console.WriteLine("Waiting 100ms...");
+ await Task.Delay(1000, TestContext.Current!.Execution.CancellationToken);
+ Console.WriteLine("Waiting completed.");
await That(count).IsEqualTo(executionCount);
}
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
index d80679d3e..a65001ab6 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateDirectoryTests.cs
@@ -4,10 +4,10 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
[FileSystemTests]
-public partial class CreateDirectoryTests
+public class CreateDirectoryTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_AlreadyExisting_ShouldDoNothing(string path)
{
FileSystem.Directory.CreateDirectory(path);
@@ -21,8 +21,8 @@ void Act()
await That(FileSystem.Directory.Exists(path)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ReadOnlyParent_ShouldStillCreateDirectoryUnderWindows(
string parent,
string subdirectory)
@@ -50,7 +50,7 @@ await That(FileSystem.DirectoryInfo.New(parent).Attributes)
}
}
- [Fact]
+ [Test]
public async Task CreateDirectory_ShouldSupportExtendedLengthPaths()
{
Skip.If(!Test.RunsOnWindows);
@@ -60,8 +60,8 @@ public async Task CreateDirectory_ShouldSupportExtendedLengthPaths()
await That(FileSystem.Directory.Exists(@"\\?\c:\bar")).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_FileWithSameNameAlreadyExists_ShouldThrowIOException(
string name)
{
@@ -77,7 +77,7 @@ await That(Act).Throws()
await That(FileSystem.Directory.Exists(name)).IsFalse();
}
- [Fact]
+ [Test]
public async Task CreateDirectory_Root_ShouldNotThrowException()
{
string path = FileTestHelper.RootDrive(Test);
@@ -92,8 +92,8 @@ void Act()
await That(FileSystem.Directory.Exists(path)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ShouldTrimTrailingSpaces_OnWindows(string path)
{
string pathWithSpaces = path + " ";
@@ -110,8 +110,8 @@ public async Task CreateDirectory_ShouldTrimTrailingSpaces_OnWindows(string path
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ShouldAdjustTimes(string path, string subdirectoryName)
{
SkipIfLongRunningTestsShouldBeSkipped();
@@ -144,8 +144,8 @@ await That(lastAccessTime).IsBetween(creationTimeStart).And(creationTimeEnd)
await That(lastWriteTime).IsOnOrAfter(updateTime.ApplySystemClockTolerance());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ShouldAdjustTimesOnlyForDirectParentDirectory(
string rootPath)
{
@@ -181,8 +181,8 @@ await That(lastWriteTime).IsBetween(creationTimeStart).And(creationTimeEnd)
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ShouldSetCreationTime(string path)
{
DateTime start = TimeSystem.DateTime.Now;
@@ -195,8 +195,8 @@ public async Task CreateDirectory_ShouldSetCreationTime(string path)
await That(result.Kind).IsEqualTo(DateTimeKind.Local);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateDirectory_ShouldSetCreationTimeUtc(string path)
{
DateTime start = TimeSystem.DateTime.UtcNow;
@@ -209,7 +209,7 @@ public async Task CreateDirectory_ShouldSetCreationTimeUtc(string path)
await That(result.Kind).IsEqualTo(DateTimeKind.Utc);
}
- [Fact]
+ [Test]
public async Task CreateDirectory_NullCharacter_ShouldThrowArgumentException()
{
string path = "foo\0bar";
@@ -219,7 +219,7 @@ public async Task CreateDirectory_NullCharacter_ShouldThrowArgumentException()
await That(Act).Throws().WithHResult(-2147024809);
}
- [Fact]
+ [Test]
public async Task CreateDirectory_ShouldCreateDirectoryInBasePath()
{
IDirectoryInfo result = FileSystem.Directory.CreateDirectory("foo");
@@ -228,7 +228,7 @@ public async Task CreateDirectory_ShouldCreateDirectoryInBasePath()
await That(result.FullName).StartsWith(BasePath);
}
- [Fact]
+ [Test]
public async Task CreateDirectory_ShouldCreateParentDirectories()
{
string directoryLevel1 = "lvl1";
@@ -248,9 +248,9 @@ public async Task CreateDirectory_ShouldCreateParentDirectories()
}
#if NETFRAMEWORK
- [Theory]
- [InlineData("/")]
- [InlineData("\\")]
+ [Test]
+ [Arguments("/")]
+ [Arguments("\\")]
public async Task CreateDirectory_TrailingDirectorySeparator_ShouldNotBeTrimmed(
string suffix)
{
@@ -271,7 +271,7 @@ await That(result.FullName).IsEqualTo(System.IO.Path.Combine(BasePath, expectedN
}
#endif
- [Fact]
+ [Test]
public async Task
CreateDirectory_WithoutAccessRightsToParent_ShouldThrowUnauthorizedAccessException()
{
@@ -300,9 +300,9 @@ await That(Act).Throws()
}
#if NETFRAMEWORK
- [Theory]
- [InlineData("")]
- [InlineData(" ")]
+ [Test]
+ [Arguments("")]
+ [Arguments(" ")]
public async Task CreateDirectory_EmptyOrWhitespace_ShouldReturnEmptyString(
string suffix)
{
@@ -322,11 +322,11 @@ await That(result.FullName).IsEqualTo(System.IO.Path.Combine(BasePath, expectedN
await That(FileSystem.Directory.Exists(nameWithSuffix)).IsTrue();
}
#else
- [Theory]
- [InlineData("")]
- [InlineData(" ")]
- [InlineData("/")]
- [InlineData("\\")]
+ [Test]
+ [Arguments("")]
+ [Arguments(" ")]
+ [Arguments("/")]
+ [Arguments("\\")]
public async Task CreateDirectory_TrailingDirectorySeparator_ShouldNotBeTrimmed(
string suffix)
{
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
index 227d3024c..b0ff775d7 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/CreateSymbolicLinkTests.cs
@@ -4,10 +4,10 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
[FileSystemTests]
-public partial class CreateSymbolicLinkTests
+public class CreateSymbolicLinkTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_ShouldCreateSymbolicLink(
string path, string pathToTarget)
{
@@ -19,8 +19,8 @@ await That(FileSystem.DirectoryInfo.New(path).Attributes)
.HasFlag(FileAttributes.ReparsePoint);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_SourceDirectoryAlreadyExists_ShouldThrowIOException(
string path, string pathToTarget)
{
@@ -46,8 +46,8 @@ await That(Act).Throws()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_TargetDirectoryMissing_ShouldNotThrowException(
string path, string pathToTarget)
{
@@ -59,8 +59,8 @@ void Act()
await That(Act).DoesNotThrow();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_WithIllegalCharactersInTarget_ShouldThrowIOException(
string path)
{
@@ -76,8 +76,8 @@ void Act()
await That(Act).Throws().WithHResult(-2147024713);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_WithIllegalPath_ShouldThrowArgumentException_OnWindows(
string pathToTarget)
{
@@ -98,8 +98,8 @@ void Act()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task CreateSymbolicLink_WithIllegalTarget_ShouldNotThrowException(string path)
{
void Act()
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
index 064194dd2..0c720ad5b 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
@@ -3,10 +3,10 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
[FileSystemTests]
-public partial class DeleteTests
+public class DeleteTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_CaseDifferentPath_ShouldThrowDirectoryNotFoundException_OnLinux(
string directoryName)
{
@@ -32,8 +32,8 @@ await That(Act).Throws()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_FullPath_ShouldDeleteDirectory(string directoryName)
{
IDirectoryInfo result =
@@ -45,8 +45,8 @@ public async Task Delete_FullPath_ShouldDeleteDirectory(string directoryName)
await That(result.Exists).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_MissingDirectory_ShouldThrowDirectoryNotFoundException(
string directoryName)
{
@@ -62,8 +62,8 @@ await That(Act).Throws()
.WithHResult(-2147024893);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_ReadonlyDirectory_ShouldThrowIOExceptionOnWindows(string path)
{
IDirectoryInfo sut = FileSystem.Directory.CreateDirectory(path);
@@ -83,8 +83,8 @@ await That(Act).Throws()
.WithHResult(-2146232800);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_Recursive_MissingDirectory_ShouldThrowDirectoryNotFoundException(
string directoryName)
{
@@ -100,8 +100,8 @@ await That(Act).Throws()
.WithHResult(-2147024893);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_Recursive_WithFileInSubdirectory_ShouldDeleteDirectoryWithContent(
string path, string subdirectory, string fileName, string fileContent)
{
@@ -124,8 +124,8 @@ public async Task Delete_Recursive_WithFileInSubdirectory_ShouldDeleteDirectoryW
await That(FileSystem.File.Exists(subdirectoryFilePath)).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_Recursive_WithOpenFile_ShouldThrowIOException_OnWindows(
string path, string filename)
{
@@ -157,8 +157,8 @@ await That(Act).Throws()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
Delete_Recursive_WithSimilarNamedFile_ShouldOnlyDeleteDirectoryAndItsContents(
string subdirectory)
@@ -176,8 +176,8 @@ public async Task
await That(FileSystem.File.Exists(fileName)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_Recursive_WithSubdirectory_ShouldDeleteDirectoryWithContent(
string path, string subdirectory)
{
@@ -191,8 +191,8 @@ public async Task Delete_Recursive_WithSubdirectory_ShouldDeleteDirectoryWithCon
await That(FileSystem.Directory.Exists(subdirectoryPath)).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_ShouldAdjustTimes(string path, string subdirectoryName)
{
SkipIfLongRunningTestsShouldBeSkipped();
@@ -225,8 +225,8 @@ await That(lastAccessTime).IsBetween(creationTimeStart).And(creationTimeEnd)
await That(lastWriteTime).IsOnOrAfter(updateTime.ApplySystemClockTolerance());
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_ShouldDeleteDirectory(string directoryName)
{
IDirectoryInfo result =
@@ -238,8 +238,8 @@ public async Task Delete_ShouldDeleteDirectory(string directoryName)
await That(result.Exists).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_WhenFile_ShouldThrowIOException(
string directoryName)
{
@@ -270,8 +270,8 @@ await That(Act).Throws()
}
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_WithSimilarNamedFile_ShouldOnlyDeleteDirectory(
string subdirectory)
{
@@ -286,8 +286,8 @@ public async Task Delete_WithSimilarNamedFile_ShouldOnlyDeleteDirectory(
await That(FileSystem.File.Exists(fileName)).IsTrue();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task Delete_WithSubdirectory_ShouldThrowIOException_AndNotDeleteDirectory(
string path, string subdirectory)
{
@@ -307,9 +307,9 @@ await That(Act).Throws()
await That(FileSystem.Directory.Exists(path)).IsTrue();
}
- [Theory]
- [AutoData]
- [InlineData(null)]
+ [Test]
+ [AutoArguments]
+ [Arguments(null)]
public async Task Delete_CurrentDirectory_ShouldThrowIOException_OnWindows(string? nested)
{
// Arrange
@@ -348,9 +348,9 @@ await That(Act).ThrowsExactly().OnlyIf(Test.RunsOnWindows).Which
}
}
- [Theory]
- [InlineData("next")]
- [InlineData("next", "sub")]
+ [Test]
+ [Arguments("next")]
+ [Arguments("next", "sub")]
public async Task Delete_DirNextToCurrentDirectory_ShouldNotThrow(params string[] paths)
{
// Arrange
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
index b6735390a..6570abf14 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateDirectoriesTests.cs
@@ -8,9 +8,9 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
[FileSystemTests]
-public partial class EnumerateDirectoriesTests
+public class EnumerateDirectoriesTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Fact]
+ [Test]
public async Task EnumerateDirectories_AbsolutePath_ShouldNotIncludeTrailingSlash()
{
FileSystem.Directory.CreateDirectory("foo");
@@ -24,8 +24,8 @@ public async Task EnumerateDirectories_AbsolutePath_ShouldNotIncludeTrailingSlas
await That(result).Contains(FileSystem.Path.Combine(BasePath, "bar"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateDirectories_MissingDirectory_ShouldThrowDirectoryNotFoundException(
string path)
@@ -41,8 +41,8 @@ await That(Act).Throws()
await That(FileSystem.Directory.Exists(path)).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateDirectories_MissingDirectory_ShouldThrowDirectoryNotFoundExceptionImmediately(
string path)
@@ -58,7 +58,7 @@ await That(Act).Throws()
await That(FileSystem.Directory.Exists(path)).IsFalse();
}
- [Fact]
+ [Test]
public async Task EnumerateDirectories_RelativePath_ShouldNotIncludeTrailingSlash()
{
string path = ".";
@@ -73,7 +73,7 @@ public async Task EnumerateDirectories_RelativePath_ShouldNotIncludeTrailingSlas
await That(result).Contains(FileSystem.Path.Combine(path, "bar"));
}
- [Fact]
+ [Test]
public async Task
EnumerateDirectories_RelativePathToParentDirectory_ShouldNotIncludeTrailingSlash()
{
@@ -89,8 +89,8 @@ public async Task
await That(result).Contains(FileSystem.Path.Combine(path, "bar"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateDirectories_SearchOptionAllDirectories_FullPath_ShouldReturnAllSubdirectoriesWithFullPath(
string path)
@@ -110,8 +110,8 @@ public async Task
await That(result).Contains(FileSystem.Path.Combine(baseDirectory.FullName, "bar"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task EnumerateDirectories_SearchOptionAllDirectories_ShouldReturnAllSubdirectories(
string path)
{
@@ -129,20 +129,20 @@ public async Task EnumerateDirectories_SearchOptionAllDirectories_ShouldReturnAl
await That(result).Contains(FileSystem.Path.Combine(path, "bar"));
}
- [Theory]
+ [Test]
#if NETFRAMEWORK
- [InlineAutoData(false, "")]
+ [AutoArguments(false, "")]
#else
- [InlineAutoData(true, "")]
+ [AutoArguments(true, "")]
#endif
- [InlineAutoData(true, "*")]
- [InlineAutoData(true, ".")]
- [InlineAutoData(true, "*.*")]
- [InlineData(true, "a*c", "abc")]
- [InlineData(true, "ab*c", "abc")]
- [InlineData(true, "abc?", "abc")]
- [InlineData(false, "ab?c", "abc")]
- [InlineData(false, "ac", "abc")]
+ [AutoArguments(true, "*")]
+ [AutoArguments(true, ".")]
+ [AutoArguments(true, "*.*")]
+ [Arguments(true, "a*c", "abc")]
+ [Arguments(true, "ab*c", "abc")]
+ [Arguments(true, "abc?", "abc")]
+ [Arguments(false, "ab?c", "abc")]
+ [Arguments(false, "ac", "abc")]
public async Task EnumerateDirectories_SearchPattern_ShouldReturnExpectedValue(
bool expectToBeFound, string searchPattern, string subdirectoryName)
{
@@ -166,16 +166,16 @@ await That(result).IsEmpty()
}
}
- [Theory]
- [InlineAutoData(true, "*.xls", ".xls")]
- [InlineAutoData(false, "*.x", ".xls")]
+ [Test]
+ [AutoArguments(true, "*.xls", ".xls")]
+ [AutoArguments(false, "*.x", ".xls")]
#if NETFRAMEWORK
- [InlineAutoData(true, "*.xls", ".xlsx")]
+ [AutoArguments(true, "*.xls", ".xlsx")]
#else
- [InlineAutoData(false, "*.xls", ".xlsx")]
+ [AutoArguments(false, "*.xls", ".xlsx")]
#endif
- [InlineAutoData(false, "foo.x", ".xls", "foo")]
- [InlineAutoData(false, "?.xls", ".xlsx", "a")]
+ [AutoArguments(false, "foo.x", ".xls", "foo")]
+ [AutoArguments(false, "?.xls", ".xlsx", "a")]
public async Task
EnumerateDirectories_SearchPattern_WithFileExtension_ShouldReturnExpectedValue(
bool expectToBeFound, string searchPattern, string extension,
@@ -198,7 +198,7 @@ await That(result).HasSingle().Which.EndsWith(extension)
}
}
- [Fact]
+ [Test]
public async Task EnumerateDirectories_ShouldIncludeEmptyDirectoriesWithTrailingSlash()
{
string rootDirectory = "RootDir";
@@ -211,7 +211,7 @@ public async Task EnumerateDirectories_ShouldIncludeEmptyDirectoriesWithTrailing
await That(FileSystem.Directory.EnumerateDirectories(rootDirectory)).HasCount(1);
}
- [Fact]
+ [Test]
public async Task EnumerateDirectories_ShouldSupportExtendedLengthPaths1()
{
Skip.If(!Test.RunsOnWindows);
@@ -227,7 +227,7 @@ await That(result)
.InAnyOrder();
}
- [Fact]
+ [Test]
public async Task EnumerateDirectories_ShouldSupportExtendedLengthPaths2()
{
Skip.If(!Test.RunsOnWindows);
@@ -243,9 +243,9 @@ await That(result)
.InAnyOrder();
}
- [Theory]
- [InlineData('/')]
- [InlineData('\\')]
+ [Test]
+ [Arguments('/')]
+ [Arguments('\\')]
public async Task EnumerateDirectories_TrailingDirectorySeparator_ShouldBeTrimmed(char suffix)
{
Skip.IfNot(Test.RunsOnWindows ||
@@ -262,8 +262,8 @@ await That(result).HasSingle()
}
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderAttributesToSkip(
string path)
{
@@ -286,9 +286,9 @@ public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderAttr
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineData(true)]
- [InlineData(false)]
+ [Test]
+ [Arguments(true)]
+ [Arguments(false)]
public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderIgnoreInaccessible(
bool ignoreInaccessible)
{
@@ -331,9 +331,9 @@ await That(Act).Throws()
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineAutoData(MatchCasing.CaseInsensitive)]
- [InlineAutoData(MatchCasing.CaseSensitive)]
+ [Test]
+ [AutoArguments(MatchCasing.CaseInsensitive)]
+ [AutoArguments(MatchCasing.CaseSensitive)]
public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderMatchCasing(
MatchCasing matchCasing,
string path)
@@ -361,9 +361,9 @@ public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderMatc
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineAutoData(MatchType.Simple)]
- [InlineAutoData(MatchType.Win32)]
+ [Test]
+ [AutoArguments(MatchType.Simple)]
+ [AutoArguments(MatchType.Win32)]
public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderMatchType(
MatchType matchType,
string path)
@@ -390,12 +390,12 @@ public async Task EnumerateDirectories_WithEnumerationOptions_ShouldConsiderMatc
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineAutoData(true, 0)]
- [InlineAutoData(true, 1)]
- [InlineAutoData(true, 2)]
- [InlineAutoData(true, 3)]
- [InlineAutoData(false, 2)]
+ [Test]
+ [AutoArguments(true, 0)]
+ [AutoArguments(true, 1)]
+ [AutoArguments(true, 2)]
+ [AutoArguments(true, 3)]
+ [AutoArguments(false, 2)]
public async Task
EnumerateDirectories_WithEnumerationOptions_ShouldConsiderMaxRecursionDepthWhenRecurseSubdirectoriesIsSet(
bool recurseSubdirectories,
@@ -443,9 +443,9 @@ public async Task
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineAutoData(true)]
- [InlineAutoData(false)]
+ [Test]
+ [AutoArguments(true)]
+ [AutoArguments(false)]
public async Task
EnumerateDirectories_WithEnumerationOptions_ShouldConsiderRecurseSubdirectories(
bool recurseSubdirectories,
@@ -475,9 +475,9 @@ public async Task
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Theory]
- [InlineAutoData(true)]
- [InlineAutoData(false)]
+ [Test]
+ [AutoArguments(true)]
+ [AutoArguments(false)]
public async Task
EnumerateDirectories_WithEnumerationOptions_ShouldConsiderReturnSpecialDirectories(
bool returnSpecialDirectories,
@@ -507,7 +507,7 @@ public async Task
#endif
#if FEATURE_FILESYSTEM_ENUMERATION_OPTIONS
- [Fact]
+ [Test]
public async Task
EnumerateDirectories_WithEnumerationOptions_ShouldConsiderReturnSpecialDirectoriesCorrectlyForPathRoots()
{
@@ -533,8 +533,8 @@ public async Task
}
#endif
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task EnumerateDirectories_WithNewline_ShouldThrowArgumentException(
string path)
{
@@ -549,8 +549,8 @@ void Act()
await That(Act).Throws().WithHResult(-2147024809);
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task EnumerateDirectories_WithoutSearchString_ShouldReturnAllDirectSubdirectories(
string path)
{
@@ -567,8 +567,8 @@ public async Task EnumerateDirectories_WithoutSearchString_ShouldReturnAllDirect
await That(result).Contains(FileSystem.Path.Combine(path, "bar"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task EnumerateDirectories_WithSearchPattern_ShouldReturnMatchingSubdirectory(
string path)
{
@@ -583,8 +583,8 @@ public async Task EnumerateDirectories_WithSearchPattern_ShouldReturnMatchingSub
await That(result).Contains(FileSystem.Path.Combine(path, "foo"));
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateDirectories_WithSearchPatternInSubdirectory_ShouldReturnMatchingSubdirectory(
string path)
@@ -600,7 +600,7 @@ public async Task
await That(result).HasCount(2);
}
- [Fact]
+ [Test]
public async Task EnumerateDirectories_WithTrailingSlash_ShouldEnumerateSubdirectories()
{
string queryPath = "foo" + FileSystem.Path.DirectorySeparatorChar;
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
index 6ebf8fe77..63243c45f 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/Directory/EnumerateFileSystemInfosTests.cs
@@ -9,10 +9,10 @@
namespace Testably.Abstractions.Tests.FileSystem.Directory;
[FileSystemTests]
-public partial class EnumerateFileSystemInfosTests
+public class EnumerateFileSystemInfosTests(FileSystemTestData testData) : FileSystemTestBase(testData)
{
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateFileSystemEntries_MissingDirectory_ShouldThrowDirectoryNotFoundException(
string path)
@@ -28,8 +28,8 @@ await That(Act).Throws()
await That(FileSystem.Directory.Exists(path)).IsFalse();
}
- [Theory]
- [AutoData]
+ [Test]
+ [AutoArguments]
public async Task
EnumerateFileSystemEntries_MissingDirectory_ShouldThrowDirectoryNotFoundExceptionImmediately(
string path)
@@ -45,8 +45,8 @@ await That(Act).Throws