Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageVersion Include="PublicApiGenerator" Version="11.4.2"/>
<PackageVersion Include="aweXpect" Version="1.6.0"/>
<PackageVersion Include="aweXpect.Testably" Version="0.7.0"/>
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Nuke.Common" Version="9.0.4"/>
Expand Down
2 changes: 2 additions & 0 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="aweXpect"/>
<PackageReference Include="aweXpect.Testably"/>
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using aweXpect;

namespace TestableIO.System.IO.Abstractions.Api.Tests;
namespace TestableIO.System.IO.Abstractions.Api.Tests;

public sealed class ApiAcceptance
{
Expand All @@ -27,6 +25,6 @@ public async Task AcceptApiChanges()
}
}

await Expect.That(assemblyNames).IsNotEmpty();
await That(assemblyNames).IsNotEmpty();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using aweXpect;

namespace TestableIO.System.IO.Abstractions.Api.Tests;

Expand All @@ -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))]
Expand All @@ -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<string> TargetFrameworksTheoryData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<ItemGroup>
<PackageReference Include="PublicApiGenerator"/>
<PackageReference Include="aweXpect"/>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions tests/TestableIO.System.IO.Abstractions.Api.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
global using System;
global using System.Threading.Tasks;
global using NUnit.Framework;
global using aweXpect;
global using static aweXpect.Expect;
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down Expand Up @@ -97,7 +98,7 @@ static IEnumerable<string> 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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="aweXpect"/>
<PackageReference Include="System.Text.Json"/>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace System.IO.Abstractions.Tests
{
using NUnit.Framework;

/// <summary>
/// Unit tests for the conversion operators of the <see cref="FileInfoBase"/> class.
/// </summary>
Expand All @@ -11,7 +9,7 @@ public class FileInfoBaseConversionTests
/// Tests that a <c>null</c> <see cref="FileInfo"/> is correctly converted to a <c>null</c> <see cref="FileInfoBase"/> without exception.
/// </summary>
[Test]
public void FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
public async Task FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
{
// Arrange
FileInfo fileInfo = null;
Expand All @@ -20,7 +18,7 @@ public void FileInfoBase_FromFileInfo_ShouldReturnNullIfFileInfoIsNull()
FileInfoBase actual = fileInfo;

// Assert
Assert.That(actual, Is.Null);
await That(actual).IsNull();
}
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
Loading
Loading