diff --git a/Directory.Packages.props b/Directory.Packages.props
index 2744ba88b..5e4e33a69 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -20,6 +20,7 @@
+
diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props
index 2e00e9bb1..e78c4f799 100644
--- a/tests/Directory.Build.props
+++ b/tests/Directory.Build.props
@@ -24,6 +24,8 @@
all
+
+
diff --git a/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiAcceptance.cs b/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiAcceptance.cs
index c19474d80..30c6002d4 100644
--- a/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiAcceptance.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiAcceptance.cs
@@ -1,6 +1,4 @@
-using aweXpect;
-
-namespace TestableIO.System.IO.Abstractions.Api.Tests;
+namespace TestableIO.System.IO.Abstractions.Api.Tests;
public sealed class ApiAcceptance
{
@@ -27,6 +25,6 @@ public async Task AcceptApiChanges()
}
}
- await Expect.That(assemblyNames).IsNotEmpty();
+ await That(assemblyNames).IsNotEmpty();
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiApprovalTests.cs b/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiApprovalTests.cs
index 26de6cc2e..3d9d12b21 100644
--- a/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiApprovalTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Api.Tests/ApiApprovalTests.cs
@@ -1,5 +1,4 @@
using System.Collections.Generic;
-using aweXpect;
namespace TestableIO.System.IO.Abstractions.Api.Tests;
@@ -18,7 +17,7 @@ public async Task VerifyPublicApiForWrappers(string framework)
var publicApi = Helper.CreatePublicApi(framework, assemblyName);
var expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- await Expect.That(publicApi).IsEqualTo(expectedApi);
+ await That(publicApi).IsEqualTo(expectedApi);
}
[TestCaseSource(nameof(TargetFrameworksTheoryData))]
@@ -29,7 +28,7 @@ public async Task VerifyPublicApiForTestingHelpers(string framework)
var publicApi = Helper.CreatePublicApi(framework, assemblyName);
var expectedApi = Helper.GetExpectedApi(framework, assemblyName);
- await Expect.That(publicApi).IsEqualTo(expectedApi);
+ await That(publicApi).IsEqualTo(expectedApi);
}
private static IEnumerable TargetFrameworksTheoryData()
diff --git a/tests/TestableIO.System.IO.Abstractions.Api.Tests/TestableIO.System.IO.Abstractions.Api.Tests.csproj b/tests/TestableIO.System.IO.Abstractions.Api.Tests/TestableIO.System.IO.Abstractions.Api.Tests.csproj
index dc026d8bc..4fb826fe6 100644
--- a/tests/TestableIO.System.IO.Abstractions.Api.Tests/TestableIO.System.IO.Abstractions.Api.Tests.csproj
+++ b/tests/TestableIO.System.IO.Abstractions.Api.Tests/TestableIO.System.IO.Abstractions.Api.Tests.csproj
@@ -11,7 +11,6 @@
-
diff --git a/tests/TestableIO.System.IO.Abstractions.Api.Tests/Usings.cs b/tests/TestableIO.System.IO.Abstractions.Api.Tests/Usings.cs
index 749afb230..5876408d3 100644
--- a/tests/TestableIO.System.IO.Abstractions.Api.Tests/Usings.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Api.Tests/Usings.cs
@@ -1,3 +1,5 @@
global using System;
global using System.Threading.Tasks;
global using NUnit.Framework;
+global using aweXpect;
+global using static aweXpect.Expect;
diff --git a/tests/TestableIO.System.IO.Abstractions.Parity.Tests/ApiParityTests.cs b/tests/TestableIO.System.IO.Abstractions.Parity.Tests/ApiParityTests.cs
index c5cc29a3c..4daceb63f 100644
--- a/tests/TestableIO.System.IO.Abstractions.Parity.Tests/ApiParityTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Parity.Tests/ApiParityTests.cs
@@ -3,6 +3,7 @@
using System.Text.Json;
using System.Threading.Tasks;
using aweXpect;
+using static aweXpect.Expect;
using NUnit.Framework;
using static System.Reflection.BindingFlags;
@@ -14,57 +15,57 @@ public class ApiParityTests
[Test]
public async Task File() =>
await AssertParity(
- typeof(System.IO.File),
- typeof(System.IO.Abstractions.FileBase)
+ typeof(File),
+ typeof(FileBase)
);
[Test]
public async Task FileInfo() =>
await AssertParity(
- typeof(System.IO.FileInfo),
- typeof(System.IO.Abstractions.FileInfoBase)
+ typeof(FileInfo),
+ typeof(FileInfoBase)
);
[Test]
public async Task FileVersionInfo() =>
await AssertParity(
- typeof(System.Diagnostics.FileVersionInfo),
- typeof(System.IO.Abstractions.FileVersionInfoBase)
+ typeof(Diagnostics.FileVersionInfo),
+ typeof(FileVersionInfoBase)
);
[Test]
public async Task Directory() =>
await AssertParity(
- typeof(System.IO.Directory),
- typeof(System.IO.Abstractions.DirectoryBase)
+ typeof(Directory),
+ typeof(DirectoryBase)
);
[Test]
public async Task DirectoryInfo() =>
await AssertParity(
- typeof(System.IO.DirectoryInfo),
- typeof(System.IO.Abstractions.DirectoryInfoBase)
+ typeof(DirectoryInfo),
+ typeof(DirectoryInfoBase)
);
[Test]
public async Task DriveInfo() =>
await AssertParity(
- typeof(System.IO.DriveInfo),
- typeof(System.IO.Abstractions.DriveInfoBase)
+ typeof(DriveInfo),
+ typeof(DriveInfoBase)
);
[Test]
public async Task Path() =>
await AssertParity(
- typeof(System.IO.Path),
- typeof(System.IO.Abstractions.PathBase)
+ typeof(Path),
+ typeof(PathBase)
);
[Test]
public async Task FileSystemWatcher() =>
await AssertParity(
- typeof(System.IO.FileSystemWatcher),
- typeof(System.IO.Abstractions.FileSystemWatcherBase)
+ typeof(FileSystemWatcher),
+ typeof(FileSystemWatcherBase)
);
private async Task AssertParity(Type referenceType, Type abstractionType)
@@ -97,7 +98,7 @@ static IEnumerable GetMembers(Type type) => type
var fileName = $"ApiParityTests.{referenceType.Name}_{snapshotSuffix}.snap";
var fileContent = IO.File.ReadAllText(IO.Path.Combine(snapshotPath, fileName));
- await Expect.That(fileContent).IsEqualTo(serializedDiff)
+ await That(fileContent).IsEqualTo(serializedDiff)
.IgnoringNewlineStyle()
.IgnoringTrailingWhiteSpace();
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Parity.Tests/TestableIO.System.IO.Abstractions.Parity.Tests.csproj b/tests/TestableIO.System.IO.Abstractions.Parity.Tests/TestableIO.System.IO.Abstractions.Parity.Tests.csproj
index 455a3a0e5..83a9487e6 100644
--- a/tests/TestableIO.System.IO.Abstractions.Parity.Tests/TestableIO.System.IO.Abstractions.Parity.Tests.csproj
+++ b/tests/TestableIO.System.IO.Abstractions.Parity.Tests/TestableIO.System.IO.Abstractions.Parity.Tests.csproj
@@ -11,7 +11,6 @@
-
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoFactoryTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoFactoryTests.cs
index f0c91d54f..6b1b9a7b1 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoFactoryTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoFactoryTests.cs
@@ -1,18 +1,16 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class DirectoryInfoFactoryTests
{
[Test]
- public void Wrap_WithNull_ShouldReturnNull()
+ public async Task Wrap_WithNull_ShouldReturnNull()
{
var fileSystem = new FileSystem();
var result = fileSystem.DirectoryInfo.Wrap(null);
-
- Assert.That(result, Is.Null);
+
+ await That(result).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoTests.cs
index ca0a4c962..ddb90f547 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryInfoTests.cs
@@ -1,19 +1,18 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class DirectoryInfoTests
{
[Test]
- public void Parent_ForRootDirectory_ShouldReturnNull()
+ public async Task Parent_ForRootDirectory_ShouldReturnNull()
{
var wrapperFilesystem = new FileSystem();
var current = wrapperFilesystem.Directory.GetCurrentDirectory();
var root = wrapperFilesystem.DirectoryInfo.New(current).Root;
var rootsParent = root.Parent;
- Assert.That(rootsParent, Is.Null);
+
+ await That(rootsParent).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryWrapperTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryWrapperTests.cs
index 80c758149..2cff9e386 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryWrapperTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DirectoryWrapperTests.cs
@@ -1,12 +1,10 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class DirectoryWrapperTests
{
[Test]
- public void GetParent_ForRootDirectory_ShouldReturnNull()
+ public async Task GetParent_ForRootDirectory_ShouldReturnNull()
{
// Arrange
var wrapperFilesystem = new FileSystem();
@@ -16,11 +14,11 @@ public void GetParent_ForRootDirectory_ShouldReturnNull()
var result = wrapperFilesystem.Directory.GetParent(root);
// Assert
- Assert.That(result, Is.Null);
+ await That(result).IsNull();
}
[Test]
- public void GetParent_ForSimpleSubfolderPath_ShouldReturnRoot()
+ public async Task GetParent_ForSimpleSubfolderPath_ShouldReturnRoot()
{
// Arrange
var wrapperFilesystem = new FileSystem();
@@ -31,11 +29,11 @@ public void GetParent_ForSimpleSubfolderPath_ShouldReturnRoot()
var result = wrapperFilesystem.Directory.GetParent(subfolder);
// Assert
- Assert.That(result.FullName, Is.EqualTo(root));
+ await That(result.FullName).IsEqualTo(root);
}
[Test]
- public void GetParent_ForSimpleFilePath_ShouldReturnSubfolder()
+ public async Task GetParent_ForSimpleFilePath_ShouldReturnSubfolder()
{
// Arrange
var wrapperFilesystem = new FileSystem();
@@ -47,7 +45,7 @@ public void GetParent_ForSimpleFilePath_ShouldReturnSubfolder()
var result = wrapperFilesystem.Directory.GetParent(file);
// Assert
- Assert.That(result.FullName, Is.EqualTo(subfolder));
+ await That(result.FullName).IsEqualTo(subfolder);
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DriveInfoFactoryTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DriveInfoFactoryTests.cs
index e752ac1ff..f96f183ab 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DriveInfoFactoryTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/DriveInfoFactoryTests.cs
@@ -1,18 +1,16 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class DriveInfoFactoryTests
{
[Test]
- public void Wrap_WithNull_ShouldReturnNull()
+ public async Task Wrap_WithNull_ShouldReturnNull()
{
var fileSystem = new FileSystem();
var result = fileSystem.DriveInfo.Wrap(null);
- Assert.That(result, Is.Null);
+ await That(result).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoBaseConversionTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoBaseConversionTests.cs
index d09f21f09..6a9da572a 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoBaseConversionTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoBaseConversionTests.cs
@@ -1,7 +1,5 @@
namespace System.IO.Abstractions.Tests
{
- using NUnit.Framework;
-
///
/// Unit tests for the conversion operators of the class.
///
@@ -11,7 +9,7 @@ public class FileInfoBaseConversionTests
/// Tests that a null is correctly converted to a null without exception.
///
[Test]
- public void FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
+ public async Task FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
{
// Arrange
FileInfo fileInfo = null;
@@ -20,7 +18,7 @@ public void FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
FileInfoBase actual = fileInfo;
// Assert
- Assert.That(actual, Is.Null);
+ await That(actual).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoFactoryTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoFactoryTests.cs
index e0644f6b0..a6d41e4a2 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoFactoryTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileInfoFactoryTests.cs
@@ -1,18 +1,16 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class FileInfoFactoryTests
{
[Test]
- public void Wrap_WithNull_ShouldReturnNull()
+ public async Task Wrap_WithNull_ShouldReturnNull()
{
var fileSystem = new FileSystem();
var result = fileSystem.FileInfo.Wrap(null);
- Assert.That(result, Is.Null);
+ await That(result).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs
index 7a188166f..88fe586fc 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemTests.cs
@@ -1,14 +1,11 @@
-
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class FileSystemTests
{
#if !NET9_0_OR_GREATER
[Test]
- public void Is_Serializable()
+ public async Task Is_Serializable()
{
var fileSystem = new FileSystem();
var memoryStream = new MemoryStream();
@@ -19,88 +16,89 @@ public void Is_Serializable()
serializer.Serialize(memoryStream, fileSystem);
#pragma warning restore SYSLIB0011
- Assert.That(memoryStream.Length > 0, "Length didn't increase after serialization task.");
+ await That(memoryStream).HasLength().GreaterThan(0)
+ .Because("Length didn't increase after serialization task.");
}
#endif
[Test]
- public void Mock_File_Succeeds()
+ public async Task Mock_File_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.File.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_Directory_Succeeds()
+ public async Task Mock_Directory_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.Directory.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_FileInfo_Succeeds()
+ public async Task Mock_FileInfo_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.FileInfo.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_FileStream_Succeeds()
+ public async Task Mock_FileStream_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.FileStream.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_Path_Succeeds()
+ public async Task Mock_Path_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.Path.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_DirectoryInfo_Succeeds()
+ public async Task Mock_DirectoryInfo_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.DirectoryInfo.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_DriveInfo_Succeeds()
+ public async Task Mock_DriveInfo_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.DirectoryInfo.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
[Test]
- public void Mock_FileSystemWatcher_Succeeds()
+ public async Task Mock_FileSystemWatcher_Succeeds()
{
var fileSystemMock = new Moq.Mock();
- Assert.DoesNotThrow(() =>
+ await That(() =>
fileSystemMock.Setup(x => x.FileSystemWatcher.ToString()).Returns("")
- );
+ ).DoesNotThrow();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemWatcherFactoryTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemWatcherFactoryTests.cs
index 61585d664..bf697dd85 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemWatcherFactoryTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileSystemWatcherFactoryTests.cs
@@ -1,18 +1,16 @@
-using NUnit.Framework;
-
-namespace System.IO.Abstractions.Tests
+namespace System.IO.Abstractions.Tests
{
[TestFixture]
public class FileSystemWatcherFactoryTests
{
[Test]
- public void Wrap_WithNull_ShouldReturnNull()
+ public async Task Wrap_WithNull_ShouldReturnNull()
{
var fileSystem = new FileSystem();
var result = fileSystem.FileSystemWatcher.Wrap(null);
- Assert.That(result, Is.Null);
+ await That(result).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileVersionInfoBaseConversionTests.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileVersionInfoBaseConversionTests.cs
index b53a64e9e..77f6429ea 100644
--- a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileVersionInfoBaseConversionTests.cs
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/FileVersionInfoBaseConversionTests.cs
@@ -1,5 +1,4 @@
-using NUnit.Framework;
-using System.Diagnostics;
+using System.Diagnostics;
namespace System.IO.Abstractions.Tests
{
@@ -12,7 +11,7 @@ public class FileVersionInfoBaseConversionTests
/// Tests that a null is correctly converted to a null without exception.
///
[Test]
- public void FileVersionInfoBase_FromFileVersionInfo_ShouldReturnNullIfFileVersionInfoIsNull()
+ public async Task FileVersionInfoBase_FromFileVersionInfo_ShouldReturnNullIfFileVersionInfoIsNull()
{
// Arrange
FileVersionInfo fileVersionInfo = null;
@@ -21,7 +20,7 @@ public void FileVersionInfoBase_FromFileVersionInfo_ShouldReturnNullIfFileVersio
FileVersionInfoBase actual = fileVersionInfo;
// Assert
- Assert.That(actual, Is.Null);
+ await That(actual).IsNull();
}
}
}
diff --git a/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/Usings.cs b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/Usings.cs
new file mode 100644
index 000000000..2f2279eb4
--- /dev/null
+++ b/tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/Usings.cs
@@ -0,0 +1,4 @@
+global using System.Threading.Tasks;
+global using NUnit.Framework;
+global using aweXpect;
+global using static aweXpect.Expect;