mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-23 03:39:35 -10:00
-Updated over a dozen test files to use the modern Xunit syntax. -Solved file-in-use concurrency issues in the altered tests. Resolves dotnet/corefx#1313, dotnet/corefx#2227 -Tests will no longer intermittently fail. -Slightly improved code coverage for the FileSystem files whose tests I altered (Directory, DirectoryInfo, File, FileInfo) -Most tests altered now inherit from similar tests to consolidate the testing robustness into as few locations as possible. For example, Directory_GetFiles_str now inherits from Directory_GetFileSystemEntries_str since the tests for Directory_GetFiles_str were the exact same ones as in Directory_GetFileSystemEntries_str anyways. -All altered tests now use the System.IO.FileSystem.Tests namespace -Renamed the File_WriteAll_all class name/file name to File_WriteAllText. -I tested my changes on Windows overnight to verify that there is no more intermittent test failures. I didn't have to modify all of the files listed in dotnet/corefx#2227 to get them to pass; this concerns me but I found no way to replicate the errors I was receiving before. My guess would be that the tests in the files I didn't alter (e.g. File_WriteAll and File_ReadAll) used the same names as the tests I did alter but now that the tests I altered are changed they no longer share test file names and no longer fail as a result. Commit migrated from https://github.com/dotnet/corefx/commit/d21ce06332afe7aba0a52491187983744c10b4a4
137 lines
4.4 KiB
C#
137 lines
4.4 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System.Linq;
|
|
using Xunit;
|
|
|
|
namespace System.IO.FileSystem.Tests
|
|
{
|
|
#region EnumerateFiles
|
|
|
|
public class Directory_EnumFiles_Str : Directory_GetFiles_str
|
|
{
|
|
public override string[] GetEntries(string path)
|
|
{
|
|
return Directory.EnumerateFiles(path).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumFiles_str_str : Directory_GetFiles_str_str
|
|
{
|
|
public override string[] GetEntries(string path)
|
|
{
|
|
return Directory.EnumerateFiles(path, "*").ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string path, string searchPattern)
|
|
{
|
|
return Directory.EnumerateFiles(path, searchPattern).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumFiles_str_str_so : Directory_GetFiles_str_str_so
|
|
{
|
|
public override string[] GetEntries(string path)
|
|
{
|
|
return Directory.EnumerateFiles(path, "*", SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string path, string searchPattern)
|
|
{
|
|
return Directory.EnumerateFiles(path, searchPattern, SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string path, string searchPattern, SearchOption option)
|
|
{
|
|
return Directory.EnumerateFiles(path, searchPattern, option).ToArray();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region EnumerateFileSystemEntries
|
|
|
|
public class Directory_EnumFSE_str : Directory_GetFileSystemEntries_str
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumFSE_str_str : Directory_GetFileSystemEntries_str_str
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName, "*").ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName, searchPattern).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumFSE_str_str_so : Directory_GetFileSystemEntries_str_str_so
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName, "*", SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName, searchPattern, SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern, SearchOption option)
|
|
{
|
|
return Directory.EnumerateFileSystemEntries(dirName, searchPattern, option).ToArray();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EnumerateDirectories
|
|
|
|
public class Directory_EnumDir_str : Directory_GetDirectories_str
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumDir_str_str : Directory_GetDirectories_str_str
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName, "*").ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName, searchPattern).ToArray();
|
|
}
|
|
}
|
|
|
|
public class Directory_EnumDir_str_str_so : Directory_GetDirectories_str_str_so
|
|
{
|
|
public override string[] GetEntries(string dirName)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName, "*", SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName, searchPattern, SearchOption.TopDirectoryOnly).ToArray();
|
|
}
|
|
|
|
public override string[] GetEntries(string dirName, string searchPattern, SearchOption option)
|
|
{
|
|
return Directory.EnumerateDirectories(dirName, searchPattern, option).ToArray();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|