diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/Microsoft.Extensions.FileSystemGlobbing.Tests.csproj b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/Microsoft.Extensions.FileSystemGlobbing.Tests.csproj index fdc4fd683db0ae..73712b52c7fc1c 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/Microsoft.Extensions.FileSystemGlobbing.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/Microsoft.Extensions.FileSystemGlobbing.Tests.csproj @@ -3,8 +3,6 @@ $(NetCoreAppCurrent);$(NetFrameworkCurrent) true - - false diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemGlobbingTestContext.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemGlobbingTestContext.cs index 9907bf8a2a083c..a201eb78086a90 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemGlobbingTestContext.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemGlobbingTestContext.cs @@ -9,7 +9,6 @@ namespace Microsoft.Extensions.FileSystemGlobbing.Tests.TestUtility internal class FileSystemGlobbingTestContext { private readonly string _basePath; - private readonly FileSystemOperationRecorder _recorder; private readonly Matcher _patternMatching; private MockDirectoryInfo _directoryInfo; @@ -19,11 +18,9 @@ internal class FileSystemGlobbingTestContext public FileSystemGlobbingTestContext(string basePath, bool preserveFilterOrder) { _basePath = basePath; - _recorder = new FileSystemOperationRecorder(); _patternMatching = new Matcher(preserveFilterOrder: preserveFilterOrder); _directoryInfo = new MockDirectoryInfo( - recorder: _recorder, parentDirectory: null, fullName: _basePath, name: ".", @@ -53,7 +50,6 @@ public FileSystemGlobbingTestContext Exclude(params string[] patterns) public FileSystemGlobbingTestContext Files(params string[] files) { _directoryInfo = new MockDirectoryInfo( - _directoryInfo.Recorder, _directoryInfo.ParentDirectory, _directoryInfo.FullName, _directoryInfo.Name, diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemOperationRecorder.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemOperationRecorder.cs deleted file mode 100644 index cef2ebba1c6c5a..00000000000000 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/FileSystemOperationRecorder.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Collections.Generic; -using System.Reflection; - -namespace Microsoft.Extensions.FileSystemGlobbing.Tests.TestUtility -{ - internal class FileSystemOperationRecorder - { - private const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly; - - public IList> Records = new List>(); - - public void Add(string action, object values) - { - var record = new Dictionary - { - {"action", action } - }; - - foreach (var p in values.GetType().GetProperties(DeclaredOnlyLookup)) - { - record[p.Name] = p.GetValue(values); - } - - Records.Add(record); - } - } -} diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockDirectoryInfo.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockDirectoryInfo.cs index 039e236bf89e29..98279de058cd1d 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockDirectoryInfo.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockDirectoryInfo.cs @@ -11,21 +11,17 @@ namespace Microsoft.Extensions.FileSystemGlobbing.Tests.TestUtility internal class MockDirectoryInfo : DirectoryInfoBase { public MockDirectoryInfo( - FileSystemOperationRecorder recorder, DirectoryInfoBase parentDirectory, string fullName, string name, string[] paths) { ParentDirectory = parentDirectory; - Recorder = recorder; FullName = fullName; Name = name; Paths = paths; } - public FileSystemOperationRecorder Recorder { get; } - public override string FullName { get; } public override string Name { get; } @@ -36,8 +32,6 @@ public MockDirectoryInfo( public override IEnumerable EnumerateFileSystemInfos() { - Recorder.Add("EnumerateFileSystemInfos", new { FullName, Name }); - var names = new HashSet(); foreach (var path in Paths) @@ -55,7 +49,6 @@ public override IEnumerable EnumerateFileSystemInfos() if (endPath == endSegment) { yield return new MockFileInfo( - recorder: Recorder, parentDirectory: this, fullName: path, name: path.Substring(beginSegment, endSegment - beginSegment)); @@ -67,7 +60,6 @@ public override IEnumerable EnumerateFileSystemInfos() { names.Add(name); yield return new MockDirectoryInfo( - recorder: Recorder, parentDirectory: this, fullName: path.Substring(0, endSegment + 1), name: name, @@ -90,14 +82,12 @@ public override DirectoryInfoBase GetDirectory(string name) var indexOfPenultimateSlash = FullName.LastIndexOf('\\', FullName.Length - 2); var fullName = FullName.Substring(0, indexOfPenultimateSlash + 1); return new MockDirectoryInfo( - recorder: Recorder, parentDirectory: this, fullName: FullName.Substring(0, indexOfPenultimateSlash + 1), name: name, paths: Paths); } return new MockDirectoryInfo( - recorder: Recorder, parentDirectory: this, fullName: FullName + name + "\\", name: name, @@ -107,7 +97,6 @@ public override DirectoryInfoBase GetDirectory(string name) public override FileInfoBase GetFile(string name) { return new MockFileInfo( - recorder: Recorder, parentDirectory: this, fullName: FullName + name, name: name); diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockFileInfoStub.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockFileInfoStub.cs index 5e4e3e12b89af4..f2f8bea3d863b9 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockFileInfoStub.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/MockFileInfoStub.cs @@ -8,18 +8,14 @@ namespace Microsoft.Extensions.FileSystemGlobbing.Tests.TestUtility internal class MockFileInfo : FileInfoBase { public MockFileInfo( - FileSystemOperationRecorder recorder, DirectoryInfoBase parentDirectory, string fullName, string name) { - Recorder = recorder; FullName = fullName; Name = name; } - public FileSystemOperationRecorder Recorder { get; } - public override DirectoryInfoBase ParentDirectory { get; } public override string FullName { get; } diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/PatternContextHelper.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/PatternContextHelper.cs index 8aadcbbae93be2..3d2e8aa5897c6a 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/PatternContextHelper.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/TestUtility/PatternContextHelper.cs @@ -11,7 +11,7 @@ public static void PushDirectory(IPatternContext context, params string[] direct { foreach (var each in directoryNames) { - var directory = new MockDirectoryInfo(null, null, string.Empty, each, null); + var directory = new MockDirectoryInfo(null, string.Empty, each, null); context.PushDirectory(directory); } }