Skip to content

Commit 573e392

Browse files
committed
Merge branch 'main' into topic/add-nuke-build
2 parents bc9cb3e + 5e332ec commit 573e392

File tree

38 files changed

+61
-25
lines changed

38 files changed

+61
-25
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
7+
<PackageVersion Include="System.Text.Json" Version="9.0.2"/>
78
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
89
<PackageVersion Include="Nullable" Version="1.3.1" />
910
<PackageVersion Include="Testably.Abstractions.FileSystem.Interface" Version="9.0.0" />
@@ -17,7 +18,6 @@
1718
<PackageVersion Include="NUnit" Version="4.3.2" />
1819
<PackageVersion Include="NUnit.Analyzers" Version="4.6.0" />
1920
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
20-
<PackageVersion Include="Snapshooter.NUnit" Version="1.0.1" />
2121
<PackageVersion Include="PublicApiGenerator" Version="11.4.2"/>
2222
<PackageVersion Include="aweXpect" Version="1.0.1"/>
2323
</ItemGroup>

Pipeline/Build.UnitTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ partial class Build
2222
[
2323
Solution.Tests.TestableIO_System_IO_Abstractions_Wrappers_Tests,
2424
Solution.Tests.TestableIO_System_IO_Abstractions_TestingHelpers_Tests,
25+
Solution.Tests.TestableIO_System_IO_Abstractions_Parity_Tests,
2526
];
2627

2728
Target DotNetFrameworkUnitTests => _ => _

System.IO.Abstractions.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ EndProject
5959
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "Pipeline\Build.csproj", "{DC39543E-0A17-4869-96C9-B876EB1BB117}"
6060
EndProject
6161
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Pipeline", "Pipeline", "{8091BCA3-70F8-4506-9701-C3074E79A66D}"
62+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestableIO.System.IO.Abstractions.Parity.Tests", "tests\TestableIO.System.IO.Abstractions.Parity.Tests\TestableIO.System.IO.Abstractions.Parity.Tests.csproj", "{93B79631-E220-414B-8F0D-3885825DE1AC}"
6263
EndProject
6364
Global
6465
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -104,6 +105,10 @@ Global
104105
{7DE6AD74-E2B3-498E-90C5-DDF3188F333A}.Release|Any CPU.Build.0 = Release|Any CPU
105106
{DC39543E-0A17-4869-96C9-B876EB1BB117}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
106107
{DC39543E-0A17-4869-96C9-B876EB1BB117}.Release|Any CPU.ActiveCfg = Release|Any CPU
108+
{93B79631-E220-414B-8F0D-3885825DE1AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
109+
{93B79631-E220-414B-8F0D-3885825DE1AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
110+
{93B79631-E220-414B-8F0D-3885825DE1AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
111+
{93B79631-E220-414B-8F0D-3885825DE1AC}.Release|Any CPU.Build.0 = Release|Any CPU
107112
EndGlobalSection
108113
GlobalSection(SolutionProperties) = preSolution
109114
HideSolutionNode = FALSE
@@ -121,6 +126,7 @@ Global
121126
{7DE6AD74-E2B3-498E-90C5-DDF3188F333A} = {BCEC61BD-4941-41EC-975A-ACEFC7AC1780}
122127
{5971F640-8BBA-4264-BCD6-60A97DD54B4A} = {BBF7AD8D-5522-48C0-A906-00CBB72308A0}
123128
{DC39543E-0A17-4869-96C9-B876EB1BB117} = {8091BCA3-70F8-4506-9701-C3074E79A66D}
129+
{93B79631-E220-414B-8F0D-3885825DE1AC} = {BCEC61BD-4941-41EC-975A-ACEFC7AC1780}
124130
EndGlobalSection
125131
GlobalSection(ExtensibilityGlobals) = postSolution
126132
SolutionGuid = {8885C59C-F6A0-4C2F-A3BC-B720E9BD161F}

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/ApiParityTests.cs renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/ApiParityTests.cs

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
using System.Collections.Generic;
22
using System.Linq;
3+
using System.Text.Json;
4+
using System.Threading.Tasks;
5+
using aweXpect;
36
using NUnit.Framework;
4-
using Snapshooter;
5-
using Snapshooter.NUnit;
67
using static System.Reflection.BindingFlags;
78

89
namespace System.IO.Abstractions.Tests
@@ -11,62 +12,62 @@ namespace System.IO.Abstractions.Tests
1112
public class ApiParityTests
1213
{
1314
[Test]
14-
public void File() =>
15-
AssertParity(
15+
public async Task File() =>
16+
await AssertParity(
1617
typeof(System.IO.File),
1718
typeof(System.IO.Abstractions.FileBase)
1819
);
1920

2021
[Test]
21-
public void FileInfo() =>
22-
AssertParity(
22+
public async Task FileInfo() =>
23+
await AssertParity(
2324
typeof(System.IO.FileInfo),
2425
typeof(System.IO.Abstractions.FileInfoBase)
2526
);
2627

2728
[Test]
28-
public void FileVersionInfo() =>
29-
AssertParity(
29+
public async Task FileVersionInfo() =>
30+
await AssertParity(
3031
typeof(System.Diagnostics.FileVersionInfo),
3132
typeof(System.IO.Abstractions.FileVersionInfoBase)
3233
);
3334

3435
[Test]
35-
public void Directory() =>
36-
AssertParity(
36+
public async Task Directory() =>
37+
await AssertParity(
3738
typeof(System.IO.Directory),
3839
typeof(System.IO.Abstractions.DirectoryBase)
3940
);
4041

4142
[Test]
42-
public void DirectoryInfo() =>
43-
AssertParity(
43+
public async Task DirectoryInfo() =>
44+
await AssertParity(
4445
typeof(System.IO.DirectoryInfo),
4546
typeof(System.IO.Abstractions.DirectoryInfoBase)
4647
);
4748

4849
[Test]
49-
public void DriveInfo() =>
50-
AssertParity(
50+
public async Task DriveInfo() =>
51+
await AssertParity(
5152
typeof(System.IO.DriveInfo),
5253
typeof(System.IO.Abstractions.DriveInfoBase)
5354
);
5455

5556
[Test]
56-
public void Path() =>
57-
AssertParity(
57+
public async Task Path() =>
58+
await AssertParity(
5859
typeof(System.IO.Path),
5960
typeof(System.IO.Abstractions.PathBase)
6061
);
6162

6263
[Test]
63-
public void FileSystemWatcher() =>
64-
AssertParity(
64+
public async Task FileSystemWatcher() =>
65+
await AssertParity(
6566
typeof(System.IO.FileSystemWatcher),
6667
typeof(System.IO.Abstractions.FileSystemWatcherBase)
6768
);
6869

69-
private void AssertParity(Type referenceType, Type abstractionType)
70+
private async Task AssertParity(Type referenceType, Type abstractionType)
7071
{
7172
static IEnumerable<string> GetMembers(Type type) => type
7273
.GetMembers(bindingAttr: Instance | Static | Public | FlattenHierarchy)
@@ -89,9 +90,23 @@ static IEnumerable<string> GetMembers(Type type) => type
8990
extraMembers: abstractionMembers.Except(referenceMembers),
9091
missingMembers: referenceMembers.Except(abstractionMembers)
9192
);
92-
Snapshot.Match(diff, SnapshotNameExtension.Create(snapshotSuffix));
93+
94+
var serializedDiff = JsonSerializer.Serialize(diff, SerializerOptions);
95+
96+
var snapshotPath = IO.Path.GetFullPath("../../../__snapshots__/");
97+
var fileName = $"ApiParityTests.{referenceType.Name}_{snapshotSuffix}.snap";
98+
var fileContent = IO.File.ReadAllText(IO.Path.Combine(snapshotPath, fileName));
99+
100+
await Expect.That(fileContent).IsEqualTo(serializedDiff)
101+
.IgnoringNewlineStyle()
102+
.IgnoringTrailingWhiteSpace();
93103
}
94104

105+
private static JsonSerializerOptions SerializerOptions = new()
106+
{
107+
WriteIndented = true
108+
};
109+
95110
private readonly struct ApiDiff
96111
{
97112
public ApiDiff(IEnumerable<string> extraMembers, IEnumerable<string> missingMembers)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Description>The unit tests for our the parity checks</Description>
5+
<AssemblyName>System.IO.Abstractions.Parity.Tests</AssemblyName>
6+
<RootNamespace>System.IO.Abstractions.Parity.Tests</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\src\TestableIO.System.IO.Abstractions.Wrappers\TestableIO.System.IO.Abstractions.Wrappers.csproj" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Include="aweXpect"/>
15+
<PackageReference Include="System.Text.Json"/>
16+
</ItemGroup>
17+
18+
</Project>

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 6.0.snap

File renamed without changes.

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 8.0.snap

File renamed without changes.

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 9.0.snap renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET 9.0.snap

File renamed without changes.

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET Framework 4.7.2.snap renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET Framework 4.7.2.snap

File renamed without changes.

tests/TestableIO.System.IO.Abstractions.Wrappers.Tests/__snapshots__/ApiParityTests.Directory_.NET 6.0.snap renamed to tests/TestableIO.System.IO.Abstractions.Parity.Tests/__snapshots__/ApiParityTests.Directory_.NET 6.0.snap

File renamed without changes.

0 commit comments

Comments
 (0)