diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/MissingPropertySerializationConfiguration/ControlPropertySerializationDiagnosticAnalyzerTest.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/MissingPropertySerializationConfiguration/ControlPropertySerializationDiagnosticAnalyzerTest.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/MissingPropertySerializationConfiguration/ControlPropertySerializationDiagnosticAnalyzerTest.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/MissingPropertySerializationConfiguration/ControlPropertySerializationDiagnosticAnalyzerTest.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpIncrementalSourceGeneratorVerifier.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpIncrementalSourceGeneratorVerifier.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpIncrementalSourceGeneratorVerifier.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpIncrementalSourceGeneratorVerifier.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpSourceGeneratorTest`1.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpSourceGeneratorTest`1.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpSourceGeneratorTest`1.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpSourceGeneratorTest`1.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpVerifierHelper.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpVerifierHelper.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Analyzers/Verifiers/CSharpVerifierHelper.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Analyzers/Verifiers/CSharpVerifierHelper.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationGeneratorTests.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationGeneratorTests.cs similarity index 98% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationGeneratorTests.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationGeneratorTests.cs index 064935b03e2..2a10b26f3cc 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationGeneratorTests.cs +++ b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationGeneratorTests.cs @@ -220,6 +220,6 @@ public async Task CS_ApplicationConfigurationGenerator_GenerateInitialize_user_s private SourceText LoadFileContent(string testName) => SourceText.From( - File.ReadAllText($@"System\Windows\Forms\Generators\MockData\{GetType().Name}.{testName}.cs"), + File.ReadAllText($@"Generators\MockData\{GetType().Name}.{testName}.cs"), Encoding.UTF8); } diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=SansSerif.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=SansSerif.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=SansSerif.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=SansSerif.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=Tahoma.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=Tahoma.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=Tahoma.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=Tahoma.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=default.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=default.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=default.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=default.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=null.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=null.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=null.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_DefaultFont=null.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=false.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=false.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=false.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=false.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=true.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=true.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=true.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_EnableVisualStyles=true.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=false.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=false.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=false.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=false.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=true.verified.txt b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=true.verified.txt similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=true.verified.txt rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.GenerateInitialize_UseCompTextRendering=true.verified.txt diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.cs similarity index 97% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.cs index ff3595863ee..3f7d373eef6 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ApplicationConfigurationInitializeBuilderTests.cs +++ b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ApplicationConfigurationInitializeBuilderTests.cs @@ -30,7 +30,7 @@ public partial class ApplicationConfigurationInitializeBuilderTests [InlineData("MyProject", "default_boilerplate")] public void ApplicationConfigurationInitializeBuilder_GenerateInitialize_can_handle_namespace(string? ns, string expectedFileName) { - string expected = File.ReadAllText($@"System\Windows\Forms\Generators\MockData\{GetType().Name}.{expectedFileName}.cs"); + string expected = File.ReadAllText($@"Generators\MockData\{GetType().Name}.{expectedFileName}.cs"); string output = ApplicationConfigurationInitializeBuilder.GenerateInitialize(ns, new ApplicationConfig( diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_boilerplate.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_boilerplate.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_boilerplate.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_boilerplate.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_top_level.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_top_level.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_top_level.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_default_top_level.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_settings_boilerplate.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_settings_boilerplate.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_settings_boilerplate.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_settings_boilerplate.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_top_level.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_top_level.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_top_level.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationGeneratorTests.GenerateInitialize_user_top_level.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_boilerplate.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_boilerplate.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_boilerplate.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_boilerplate.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_top_level.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_top_level.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_top_level.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/MockData/ApplicationConfigurationInitializeBuilderTests.default_top_level.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ProjectFileReaderTests.FontConverter.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ProjectFileReaderTests.FontConverter.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ProjectFileReaderTests.FontConverter.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ProjectFileReaderTests.FontConverter.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ProjectFileReaderTests.cs b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ProjectFileReaderTests.cs similarity index 100% rename from src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System/Windows/Forms/Generators/ProjectFileReaderTests.cs rename to src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/Generators/ProjectFileReaderTests.cs diff --git a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System.Windows.Forms.Analyzers.CSharp.Tests.csproj b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System.Windows.Forms.Analyzers.CSharp.Tests.csproj index 103ea05e9d6..f694dc32083 100644 --- a/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System.Windows.Forms.Analyzers.CSharp.Tests.csproj +++ b/src/System.Windows.Forms.Analyzers.CSharp/tests/UnitTests/System.Windows.Forms.Analyzers.CSharp.Tests.csproj @@ -28,8 +28,8 @@ - - + + PreserveNewest diff --git a/src/System.Windows.Forms.Analyzers.CodeFixes.VisualBasic/System/Windows/Forms/VisualBasic/CodeFixes/AddDesignerSerializationVisibility/AddDesignerSerializationVisibilityCodeFixProvider.vb b/src/System.Windows.Forms.Analyzers.CodeFixes.VisualBasic/AddDesignerSerializationVisibility/AddDesignerSerializationVisibilityCodeFixProvider.vb similarity index 100% rename from src/System.Windows.Forms.Analyzers.CodeFixes.VisualBasic/System/Windows/Forms/VisualBasic/CodeFixes/AddDesignerSerializationVisibility/AddDesignerSerializationVisibilityCodeFixProvider.vb rename to src/System.Windows.Forms.Analyzers.CodeFixes.VisualBasic/AddDesignerSerializationVisibility/AddDesignerSerializationVisibilityCodeFixProvider.vb diff --git a/src/System.Windows.Forms.Analyzers.VisualBasic/src/System/Windows/Forms/VisualBasic/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb b/src/System.Windows.Forms.Analyzers.VisualBasic/src/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb similarity index 100% rename from src/System.Windows.Forms.Analyzers.VisualBasic/src/System/Windows/Forms/VisualBasic/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb rename to src/System.Windows.Forms.Analyzers.VisualBasic/src/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb diff --git a/src/System.Windows.Forms.Analyzers.VisualBasic/src/System/Windows/Forms/VisualBasic/Diagnostic/VisualBasicDiagnosticDescriptors.vb b/src/System.Windows.Forms.Analyzers.VisualBasic/src/Diagnostic/VisualBasicDiagnosticDescriptors.vb similarity index 100% rename from src/System.Windows.Forms.Analyzers.VisualBasic/src/System/Windows/Forms/VisualBasic/Diagnostic/VisualBasicDiagnosticDescriptors.vb rename to src/System.Windows.Forms.Analyzers.VisualBasic/src/Diagnostic/VisualBasicDiagnosticDescriptors.vb diff --git a/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System/Windows/Forms/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationAnalyzerTest.vb b/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/MissingPropertySerializationConfigurationAnalyzerTest.vb similarity index 100% rename from src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System/Windows/Forms/Analyzers/MissingPropertySerializationConfiguration/MissingPropertySerializationConfigurationAnalyzerTest.vb rename to src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/MissingPropertySerializationConfigurationAnalyzerTest.vb diff --git a/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System.Windows.Forms.Analyzers.VisualBasic.Tests.vbproj b/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System.Windows.Forms.Analyzers.VisualBasic.Tests.vbproj index c59dd663ee6..083c68dac3c 100644 --- a/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System.Windows.Forms.Analyzers.VisualBasic.Tests.vbproj +++ b/src/System.Windows.Forms.Analyzers.VisualBasic/tests/UnitTests/System.Windows.Forms.Analyzers.VisualBasic.Tests/System.Windows.Forms.Analyzers.VisualBasic.Tests.vbproj @@ -28,10 +28,4 @@ - - - PreserveNewest - - - diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities.Tests/PathLengthTests.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities.Tests/PathLengthTests.cs new file mode 100644 index 00000000000..e8b3fe470fc --- /dev/null +++ b/src/System.Windows.Forms.Primitives/tests/TestUtilities.Tests/PathLengthTests.cs @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using FluentAssertions; +using System.IO.Enumeration; + +namespace System.Tests; + +public class PathLengthTests +{ + [Fact] + public void RepoPathsLeaveRoomForRoot() + { + string currentPath = typeof(PathLengthTests).Assembly.Location; + currentPath = Path.GetFullPath(@"..\..\..\..\..\..\src", currentPath); + Directory.Exists(currentPath).Should().BeTrue(); + + // Current path will be something like C:\Users\jkuhne\source\repos\winforms\src (41 chars, 38 without src). + // We want to reserve 40 characters of the path length for everything past src. + int currentRootLength = currentPath.Length - "src".Length; + + const int MaxRootLength = 40; + + int maxLength = 260 - (currentRootLength > MaxRootLength + ? MaxRootLength + : MaxRootLength + (MaxRootLength - currentRootLength)); + + FileSystemEnumerable enumerable = new( + currentPath, + (ref FileSystemEntry entry) => entry.ToFullPath(), + new EnumerationOptions() { RecurseSubdirectories = true }) + { + ShouldIncludePredicate = (ref FileSystemEntry entry) => + // Directory doesn't contain a trailing slash + entry.Directory.Length + entry.FileName.Length > maxLength + }; + + enumerable.Should().BeEmpty(); + } +}