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
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<EnableDefaultItems>true</EnableDefaultItems>
<!-- https://github.com/dotnet/runtime/issues/126862 -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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: ".",
Expand Down Expand Up @@ -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,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -36,8 +32,6 @@ public MockDirectoryInfo(

public override IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos()
{
Recorder.Add("EnumerateFileSystemInfos", new { FullName, Name });

var names = new HashSet<string>();

foreach (var path in Paths)
Expand All @@ -55,7 +49,6 @@ public override IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos()
if (endPath == endSegment)
{
yield return new MockFileInfo(
recorder: Recorder,
parentDirectory: this,
fullName: path,
name: path.Substring(beginSegment, endSegment - beginSegment));
Expand All @@ -67,7 +60,6 @@ public override IEnumerable<FileSystemInfoBase> EnumerateFileSystemInfos()
{
names.Add(name);
yield return new MockDirectoryInfo(
recorder: Recorder,
parentDirectory: this,
fullName: path.Substring(0, endSegment + 1),
name: name,
Expand All @@ -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),
Comment thread
MichalStrehovsky marked this conversation as resolved.
name: name,
paths: Paths);
}
return new MockDirectoryInfo(
recorder: Recorder,
parentDirectory: this,
fullName: FullName + name + "\\",
name: name,
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Comment thread
MichalStrehovsky marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
MichalStrehovsky marked this conversation as resolved.
context.PushDirectory(directory);
}
}
Expand Down
Loading