mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-22 19:10:41 -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
37 lines
981 B
C#
37 lines
981 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using Xunit;
|
|
|
|
namespace System.IO.FileSystem.Tests
|
|
{
|
|
public class FileInfo_Create : File_Create_str
|
|
{
|
|
#region Utilities
|
|
|
|
public override FileStream Create(string path)
|
|
{
|
|
return new FileInfo(path).Create();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region UniversalTests
|
|
|
|
[Fact]
|
|
public void FullNameUpdatesOnCreate()
|
|
{
|
|
DirectoryInfo testDir = Directory.CreateDirectory(GetTestFilePath());
|
|
string testFile = Path.Combine(testDir.FullName, GetTestFileName());
|
|
FileInfo info = new FileInfo(testFile);
|
|
using (FileStream stream = info.Create())
|
|
{
|
|
Assert.True(File.Exists(testFile));
|
|
Assert.Equal(testFile, info.FullName);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|