Skip to content

Commit c74750f

Browse files
committed
improve naming
1 parent 6727ca1 commit c74750f

20 files changed

Lines changed: 16 additions & 19 deletions

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)StrongName.snk</AssemblyOriginatorKeyFile>
88
<IncludeSymbols>true</IncludeSymbols>
99
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
10+
<LangVersion>8.0</LangVersion>
1011
<DefineConstants Condition="'$(TargetFramework)' == 'netcoreapp3.0' OR '$(TargetFramework)' == 'netstandard2.1'">$(DefineConstants);FEATURE_ASYNC_FILE;FEATURE_ENUMERATION_OPTIONS;FEATURE_ADVANCED_PATH_OPERATIONS</DefineConstants>
1112
</PropertyGroup>
1213
<ItemGroup>

tests/System.IO.Abstractions.Tests/ApiCompletenessTests.cs renamed to tests/System.IO.Abstractions.Tests/ApiParityTests.cs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,73 +9,69 @@
99
namespace System.IO.Abstractions.Tests
1010
{
1111
[TestFixture]
12-
public class ApiCompletenessTests
12+
public class ApiParityTests
1313
{
1414
[Test]
1515
public void File() =>
16-
AssertTypeParity(
16+
AssertParity(
1717
typeof(System.IO.File),
1818
typeof(System.IO.Abstractions.FileBase)
1919
);
2020

2121
[Test]
2222
public void FileInfo() =>
23-
AssertTypeParity(
23+
AssertParity(
2424
typeof(System.IO.FileInfo),
2525
typeof(System.IO.Abstractions.FileInfoBase)
2626
);
2727

2828
[Test]
2929
public void Directory() =>
30-
AssertTypeParity(
30+
AssertParity(
3131
typeof(System.IO.Directory),
3232
typeof(System.IO.Abstractions.DirectoryBase)
3333
);
3434

3535
[Test]
3636
public void DirectoryInfo() =>
37-
AssertTypeParity(
37+
AssertParity(
3838
typeof(System.IO.DirectoryInfo),
3939
typeof(System.IO.Abstractions.DirectoryInfoBase)
4040
);
4141

4242
[Test]
4343
public void DriveInfo() =>
44-
AssertTypeParity(
44+
AssertParity(
4545
typeof(System.IO.DriveInfo),
4646
typeof(System.IO.Abstractions.DriveInfoBase)
4747
);
4848

4949
[Test]
5050
public void Path() =>
51-
AssertTypeParity(
51+
AssertParity(
5252
typeof(System.IO.Path),
5353
typeof(System.IO.Abstractions.PathBase)
5454
);
5555

56-
private void AssertTypeParity(Type referenceType, Type abstractionType)
56+
private void AssertParity(Type referenceType, Type abstractionType)
5757
{
58-
const BindingFlags bindingFlags = Instance | Static | Public | FlattenHierarchy;
59-
var expectedMembers = referenceType
60-
.GetMembers(bindingFlags)
58+
static IEnumerable<string> GetMembers(Type type) => type
59+
.GetMembers(bindingAttr: Instance | Static | Public | FlattenHierarchy)
6160
.Select(x => x.ToString())
62-
.OrderBy(x => x, StringComparer.Ordinal)
61+
.OrderBy(x => x, StringComparer.Ordinal);
62+
var referenceMembers = GetMembers(referenceType)
6363
.Select(x => x.Replace("System.IO.FileStream", "System.IO.Stream"))
6464
.Select(x => x.Replace("System.IO.FileSystemInfo", "System.IO.Abstractions.IFileSystemInfo"))
6565
.Select(x => x.Replace("System.IO.FileInfo", "System.IO.Abstractions.IFileInfo"))
6666
.Select(x => x.Replace("System.IO.DirectoryInfo", "System.IO.Abstractions.IDirectoryInfo"))
6767
.Select(x => x.Replace("System.IO.DriveInfo", "System.IO.Abstractions.IDriveInfo"));
68-
var implementedMembers = abstractionType
69-
.GetMembers(bindingFlags)
70-
.Select(x => x.ToString())
71-
.OrderBy(x => x, StringComparer.Ordinal)
68+
var abstractionMembers = GetMembers(abstractionType)
7269
.Where(x => !x.Contains("op_Implicit"))
7370
.Where(x => x != "System.IO.Abstractions.IFileSystem get_FileSystem()")
7471
.Where(x => x != "System.IO.Abstractions.IFileSystem FileSystem");
75-
7672
var diff = new ApiDiff(
77-
implementedMembers.Except(expectedMembers),
78-
expectedMembers.Except(implementedMembers)
73+
extraMembers: abstractionMembers.Except(referenceMembers),
74+
missingMembers: referenceMembers.Except(abstractionMembers)
7975
);
8076
Snapshot.Match(diff, SnapshotNameExtension.Create(snapshotSuffix));
8177
}

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.DirectoryInfo_.NET Core 2.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET Core 2.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.DirectoryInfo_.NET Core 3.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET Core 3.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.DirectoryInfo_.NET Framework 4.6.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DirectoryInfo_.NET Framework 4.6.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.Directory_.NET Core 2.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.Directory_.NET Core 2.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.Directory_.NET Core 3.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.Directory_.NET Core 3.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.Directory_.NET Framework 4.6.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.Directory_.NET Framework 4.6.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.DriveInfo_.NET Core 2.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET Core 2.1.snap

File renamed without changes.

tests/System.IO.Abstractions.Tests/__snapshots__/ApiCompletenessTests.DriveInfo_.NET Core 3.1.snap renamed to tests/System.IO.Abstractions.Tests/__snapshots__/ApiParityTests.DriveInfo_.NET Core 3.1.snap

File renamed without changes.

0 commit comments

Comments
 (0)