diff options
11 files changed, 63 insertions, 19 deletions
diff --git a/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs b/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs index b2216b202e..021a05b949 100644 --- a/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs +++ b/src/System.IO.FileSystem/tests/Directory/CreateDirectory.cs @@ -40,7 +40,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create(invalidPath)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(PathsWithInvalidCharacters))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void PathWithInvalidCharactersAsPath_Core(string invalidPath) @@ -224,7 +223,6 @@ namespace System.IO.Tests } } - [ActiveIssue(27269)] [Theory, MemberData(nameof(PathsWithInvalidColons))] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] @@ -349,7 +347,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create(path)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(ControlWhiteSpace))] [PlatformSpecific(TestPlatforms.Windows)] @@ -450,7 +447,6 @@ namespace System.IO.Tests Assert.Throws<NotSupportedException>(() => Create(path)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(PathsWithColons))] [PlatformSpecific(TestPlatforms.Windows)] // alternate data streams @@ -487,7 +483,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create(path)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(UncPathsWithoutShareName))] [PlatformSpecific(TestPlatforms.Windows)] @@ -505,7 +500,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create("//")); } - [ActiveIssue(27269)] [Fact] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] diff --git a/src/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs b/src/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs index 9d19bf84d3..01402a222b 100644 --- a/src/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs +++ b/src/System.IO.FileSystem/tests/Directory/GetFileSystemEntries_str.cs @@ -230,7 +230,6 @@ namespace System.IO.Tests } } - [ActiveIssue(27269)] [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void InvalidPath_Core() @@ -276,7 +275,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => GetEntries(invalid)); } - [ActiveIssue(27269)] [Theory, InlineData("\n"), InlineData(">"), diff --git a/src/System.IO.FileSystem/tests/Directory/Move.cs b/src/System.IO.FileSystem/tests/Directory/Move.cs index 33d4f45c40..1da296c1c3 100644 --- a/src/System.IO.FileSystem/tests/Directory/Move.cs +++ b/src/System.IO.FileSystem/tests/Directory/Move.cs @@ -252,7 +252,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Move(TestDirectory, "*Test")); } - [ActiveIssue(27269)] [Fact] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] diff --git a/src/System.IO.FileSystem/tests/DirectoryInfo/CreateSubdirectory.cs b/src/System.IO.FileSystem/tests/DirectoryInfo/CreateSubdirectory.cs index 2e29f1ec6e..75af106c41 100644 --- a/src/System.IO.FileSystem/tests/DirectoryInfo/CreateSubdirectory.cs +++ b/src/System.IO.FileSystem/tests/DirectoryInfo/CreateSubdirectory.cs @@ -147,7 +147,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => new DirectoryInfo(TestDirectory).CreateSubdirectory(component)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(ControlWhiteSpace))] [PlatformSpecific(TestPlatforms.Windows)] diff --git a/src/System.IO.FileSystem/tests/Enumeration/ExampleTests.netcoreapp.cs b/src/System.IO.FileSystem/tests/Enumeration/ExampleTests.netcoreapp.cs new file mode 100644 index 0000000000..4bd6c99de7 --- /dev/null +++ b/src/System.IO.FileSystem/tests/Enumeration/ExampleTests.netcoreapp.cs @@ -0,0 +1,33 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.IO.Enumeration; +using Xunit; + +namespace System.IO.Tests.Enumeration +{ + // For tests that cover examples from documentation, blog posts, etc. + public class ExampleTests : FileSystemTest + { + [Fact] + public void GetFileNamesEnumerable() + { + DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath()); + File.Create(Path.Join(testDirectory.FullName, "one")).Dispose(); + File.Create(Path.Join(testDirectory.FullName, "two")).Dispose(); + Directory.CreateDirectory(Path.Join(testDirectory.FullName, "three")); + + IEnumerable<string> fileNames = + new FileSystemEnumerable<string>( + testDirectory.FullName, + (ref FileSystemEntry entry) => entry.FileName.ToString()) + { + ShouldIncludePredicate = (ref FileSystemEntry entry) => !entry.IsDirectory + }; + + FSAssert.EqualWhenOrdered(new string[] { "one", "two" }, fileNames); + } + } +} diff --git a/src/System.IO.FileSystem/tests/Enumeration/SkipAttributeTests.netcoreapp.cs b/src/System.IO.FileSystem/tests/Enumeration/SkipAttributeTests.netcoreapp.cs index d81766ef2d..39e4d84324 100644 --- a/src/System.IO.FileSystem/tests/Enumeration/SkipAttributeTests.netcoreapp.cs +++ b/src/System.IO.FileSystem/tests/Enumeration/SkipAttributeTests.netcoreapp.cs @@ -65,6 +65,28 @@ namespace System.IO.Tests.Enumeration paths = GetPaths(testDirectory.FullName, new EnumerationOptions { RecurseSubdirectories = true }); Assert.Equal(new string[] { fileOne.FullName }, paths); } + + [Fact] + public void SkipComesFirst() + { + // If skip comes first we shouldn't find ourselves recursing. + DirectoryInfo testDirectory = Directory.CreateDirectory(GetTestFilePath()); + DirectoryInfo testSubdirectory = Directory.CreateDirectory(Path.Combine(testDirectory.FullName, GetTestFileName())); + + FileInfo fileOne = new FileInfo(Path.Combine(testDirectory.FullName, GetTestFileName())); + FileInfo fileTwo = new FileInfo(Path.Combine(testDirectory.FullName, GetTestFileName())); + + FileInfo fileThree = new FileInfo(Path.Combine(testSubdirectory.FullName, GetTestFileName())); + FileInfo fileFour = new FileInfo(Path.Combine(testSubdirectory.FullName, GetTestFileName())); + + fileOne.Create().Dispose(); + fileTwo.Create().Dispose(); + fileThree.Create().Dispose(); + fileFour.Create().Dispose(); + + string[] paths = GetPaths(testDirectory.FullName, new EnumerationOptions { AttributesToSkip = FileAttributes.Directory, RecurseSubdirectories = true }); + FSAssert.EqualWhenOrdered(new string[] { fileOne.FullName, fileTwo.FullName }, paths); + } } public class SkipAttributeTests_Directory_GetFiles : SkipAttributeTests diff --git a/src/System.IO.FileSystem/tests/File/Copy.cs b/src/System.IO.FileSystem/tests/File/Copy.cs index 5ef7351929..85f5009054 100644 --- a/src/System.IO.FileSystem/tests/File/Copy.cs +++ b/src/System.IO.FileSystem/tests/File/Copy.cs @@ -189,7 +189,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Copy(invalid, testFile)); } - [ActiveIssue(27269)] [Theory, InlineData("\n"), InlineData(">"), diff --git a/src/System.IO.FileSystem/tests/File/Create.cs b/src/System.IO.FileSystem/tests/File/Create.cs index 91ff00e6fe..604cc57cd4 100644 --- a/src/System.IO.FileSystem/tests/File/Create.cs +++ b/src/System.IO.FileSystem/tests/File/Create.cs @@ -212,7 +212,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create(Path.Combine(testDir.FullName, "*Tes*t"))); } - [ActiveIssue(27269)] [Fact] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] @@ -248,7 +247,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Create(path)); } - [ActiveIssue(27269)] [Theory, InlineData("\n"), InlineData(">"), diff --git a/src/System.IO.FileSystem/tests/File/Move.cs b/src/System.IO.FileSystem/tests/File/Move.cs index d9b64b0fd6..217e97168f 100644 --- a/src/System.IO.FileSystem/tests/File/Move.cs +++ b/src/System.IO.FileSystem/tests/File/Move.cs @@ -53,7 +53,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Move(testFile.FullName, invalidPath)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(PathsWithInvalidCharacters))] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void PathWithIllegalCharacters_Core(string invalidPath) @@ -250,7 +249,6 @@ namespace System.IO.Tests } } - [ActiveIssue(27269)] [Theory, MemberData(nameof(PathsWithInvalidColons))] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] @@ -258,7 +256,7 @@ namespace System.IO.Tests { FileInfo testFile = new FileInfo(GetTestFilePath()); testFile.Create().Dispose(); - Assert.ThrowsAny<IOException>(() => Move(testFile.FullName, invalidPath)); + Assert.ThrowsAny<IOException>(() => Move(testFile.FullName, testFile.DirectoryName + Path.DirectorySeparatorChar + invalidPath)); } [Fact] @@ -272,7 +270,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Move(GetTestFilePath(), "*Test")); } - [ActiveIssue(27269)] [Fact] [PlatformSpecific(TestPlatforms.Windows)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] @@ -319,7 +316,6 @@ namespace System.IO.Tests Assert.Throws<ArgumentException>(() => Move(testFile.FullName, whitespace)); } - [ActiveIssue(27269)] [Theory, MemberData(nameof(ControlWhiteSpace))] [PlatformSpecific(TestPlatforms.Windows)] diff --git a/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj b/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj index afcd6a3da8..4d758dda6f 100644 --- a/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj +++ b/src/System.IO.FileSystem/tests/Performance/System.IO.FileSystem.Performance.Tests.csproj @@ -37,5 +37,8 @@ <Name>PerfRunner</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> </Project>
\ No newline at end of file diff --git a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj index ef777424cb..4bc153ab4a 100644 --- a/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj +++ b/src/System.IO.FileSystem/tests/System.IO.FileSystem.Tests.csproj @@ -65,6 +65,7 @@ <Compile Include="Enumeration\RootTests.netcoreapp.cs" /> <Compile Include="Enumeration\AttributeTests.netcoreapp.cs" /> <Compile Include="Enumeration\MatchTypesTests.netcoreapp.cs" /> + <Compile Include="Enumeration\ExampleTests.netcoreapp.cs" /> </ItemGroup> <ItemGroup> <!-- Rewritten --> @@ -196,6 +197,8 @@ <ItemGroup> <EmbeddedResource Include="Resources\$(AssemblyName).rd.xml" /> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> </Project>
\ No newline at end of file |