diff --git a/Winforms.sln b/Winforms.sln index 03304b28b9a..8f39430544d 100644 --- a/Winforms.sln +++ b/Winforms.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28627.84 @@ -37,8 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Integr EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Facade", "src\System.Drawing\src\System.Drawing.Facade.csproj", "{F1B0790A-1A40-4487-A607-36D21D827E44}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InternalUtilitiesForTests", "src\Common\tests\InternalUtilitiesForTests\InternalUtilitiesForTests.csproj", "{3603561D-907D-494B-9E3C-29D7001018F6}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accessibility", "src\Accessibility\src\Accessibility.ilproj", "{351D8601-6E21-45E8-B3B9-847C4540BD4E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accessibility-version", "src\Accessibility\ver\Accessibility-version.csproj", "{6103E743-057D-41C6-946C-23A751A08748}" @@ -117,7 +115,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiLabelTests", "src\Syste EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Primitives", "src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj", "{90B27178-F535-43F7-886E-0AB75203F246}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Primitives.Tests", "src\System.Windows.Forms.Primitives\tests\System.Windows.Forms.Primitives.Tests.csproj", "{9BFDE7F2-C8F3-40D6-9A16-8DCD1A37E900}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Primitives.Tests", "src\System.Windows.Forms.Primitives\tests\UnitTests\System.Windows.Forms.Primitives.Tests.csproj", "{9BFDE7F2-C8F3-40D6-9A16-8DCD1A37E900}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4AA2764C-B013-40B5-9E5B-9459EF976C8B}" ProjectSection(SolutionItems) = preProject @@ -130,6 +128,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiMonthCalendarTests", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MauiTestsHelper", "src\System.Windows.Forms\tests\IntegrationTests\MauiTests\MauiTestsHelper\MauiTestsHelper.csproj", "{44BB1092-1844-4EAF-8DF5-338DE4C3149A}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.Primitives.TestUtilities", "src\System.Windows.Forms.Primitives\tests\TestUtilities\System.Windows.Forms.Primitives.TestUtilities.csproj", "{73B0857A-966B-4E7D-8A83-FECFE0281AB9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Forms.TestUtilities", "src\System.Windows.Forms\tests\TestUtilities\System.Windows.Forms.TestUtilities.csproj", "{86418F0B-39DC-4B5A-8145-6D607E6150AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -180,10 +182,6 @@ Global {F1B0790A-1A40-4487-A607-36D21D827E44}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1B0790A-1A40-4487-A607-36D21D827E44}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1B0790A-1A40-4487-A607-36D21D827E44}.Release|Any CPU.Build.0 = Release|Any CPU - {3603561D-907D-494B-9E3C-29D7001018F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3603561D-907D-494B-9E3C-29D7001018F6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3603561D-907D-494B-9E3C-29D7001018F6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3603561D-907D-494B-9E3C-29D7001018F6}.Release|Any CPU.Build.0 = Release|Any CPU {351D8601-6E21-45E8-B3B9-847C4540BD4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {351D8601-6E21-45E8-B3B9-847C4540BD4E}.Debug|Any CPU.Build.0 = Debug|Any CPU {351D8601-6E21-45E8-B3B9-847C4540BD4E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -260,6 +258,14 @@ Global {44BB1092-1844-4EAF-8DF5-338DE4C3149A}.Debug|Any CPU.Build.0 = Debug|Any CPU {44BB1092-1844-4EAF-8DF5-338DE4C3149A}.Release|Any CPU.ActiveCfg = Release|Any CPU {44BB1092-1844-4EAF-8DF5-338DE4C3149A}.Release|Any CPU.Build.0 = Release|Any CPU + {73B0857A-966B-4E7D-8A83-FECFE0281AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73B0857A-966B-4E7D-8A83-FECFE0281AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73B0857A-966B-4E7D-8A83-FECFE0281AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73B0857A-966B-4E7D-8A83-FECFE0281AB9}.Release|Any CPU.Build.0 = Release|Any CPU + {86418F0B-39DC-4B5A-8145-6D607E6150AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86418F0B-39DC-4B5A-8145-6D607E6150AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86418F0B-39DC-4B5A-8145-6D607E6150AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86418F0B-39DC-4B5A-8145-6D607E6150AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -278,7 +284,6 @@ Global {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A} = {DF68A171-D27B-4E6A-8A7E-63A651622355} {238195CE-7CCE-4469-ACD8-EA00E88D947A} = {680FB14C-7B0C-4D63-9F1A-18ACCDB0F52A} {F1B0790A-1A40-4487-A607-36D21D827E44} = {434C00C3-E498-4BA7-9764-9F0FC8CFE457} - {3603561D-907D-494B-9E3C-29D7001018F6} = {DF68A171-D27B-4E6A-8A7E-63A651622355} {351D8601-6E21-45E8-B3B9-847C4540BD4E} = {088DD24C-DF6B-45F3-A8BC-592580A4B2A9} {6103E743-057D-41C6-946C-23A751A08748} = {088DD24C-DF6B-45F3-A8BC-592580A4B2A9} {088DD24C-DF6B-45F3-A8BC-592580A4B2A9} = {77FEDB47-F7F6-490D-AF7C-ABB4A9E0B9D7} @@ -301,6 +306,8 @@ Global {E0681991-228A-420E-85D5-A9E796F0AAE0} = {434C00C3-E498-4BA7-9764-9F0FC8CFE457} {9DDC6936-9197-4C09-8640-AF0BE4918700} = {8F20A905-BD37-4D80-B8DF-FA45276FC23F} {44BB1092-1844-4EAF-8DF5-338DE4C3149A} = {8F20A905-BD37-4D80-B8DF-FA45276FC23F} + {73B0857A-966B-4E7D-8A83-FECFE0281AB9} = {DF68A171-D27B-4E6A-8A7E-63A651622355} + {86418F0B-39DC-4B5A-8145-6D607E6150AC} = {DF68A171-D27B-4E6A-8A7E-63A651622355} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7B1B0433-F612-4E5A-BE7E-FCF5B9F6E136} diff --git a/src/Common/tests/Directory.Build.props b/src/Common/tests/Directory.Build.props deleted file mode 100644 index a01177951bc..00000000000 --- a/src/Common/tests/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - ECMA - - diff --git a/src/Common/tests/NoAssertContext.cs b/src/Common/tests/NoAssertContext.cs deleted file mode 100644 index 466087b0d98..00000000000 --- a/src/Common/tests/NoAssertContext.cs +++ /dev/null @@ -1,111 +0,0 @@ -// 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.Diagnostics; -using System.Threading; - -namespace System -{ - /// - /// Use (within a using) to eat asserts. - /// - public sealed class NoAssertContext : IDisposable - { - private static readonly object s_lock = new object(); - private static readonly HashSet s_suppressedThreads = new HashSet(); - private static TraceListener s_defaultListener; - private static readonly NoAssertListener s_noAssertListener = new NoAssertListener(); - - public NoAssertContext() - { - lock (s_lock) - { - s_suppressedThreads.Add(Thread.CurrentThread.ManagedThreadId); - if (s_suppressedThreads.Count == 1) - { - // Hook our custom listener first so we don't lose assertions from other threads when - // we disconnect the default listener. - Trace.Listeners.Add(s_noAssertListener); - - // "Default" is the listener that terminates the process when debug assertions fail. - s_defaultListener = Trace.Listeners["Default"]; - Trace.Listeners.Remove(s_defaultListener); - } - } - } - - public void Dispose() - { - GC.SuppressFinalize(this); - - lock (s_lock) - { - s_suppressedThreads.Remove(Thread.CurrentThread.ManagedThreadId); - if (s_suppressedThreads.Count == 0 && s_defaultListener != null) - { - // Add the default listener back first to make sure we don't lose any - // asserts from other threads. - Trace.Listeners.Add(s_defaultListener); - Trace.Listeners.Remove(s_noAssertListener); - s_defaultListener = null; - } - } - } - - ~NoAssertContext() - { - // We need this class to be used in a using to effectively rationalize about a test. - throw new InvalidOperationException($"Did not dispose {nameof(NoAssertContext)}"); - } - - private class NoAssertListener : TraceListener - { - public NoAssertListener() - : base(typeof(NoAssertListener).FullName) - { - } - - public override void Fail(string message) - { - lock (s_lock) - { - if (!s_suppressedThreads.Contains(Thread.CurrentThread.ManagedThreadId)) - { - s_defaultListener?.Fail(message); - } - } - } - - public override void Fail(string message, string detailMessage) - { - lock (s_lock) - { - if (!s_suppressedThreads.Contains(Thread.CurrentThread.ManagedThreadId)) - { - s_defaultListener?.Fail(message, detailMessage); - } - } - } - - // Write and WriteLine are virtual - - public override void Write(string message) - { - lock (s_lock) - { - s_defaultListener?.Write(message); - } - } - - public override void WriteLine(string message) - { - lock (s_lock) - { - s_defaultListener?.WriteLine(message); - } - } - } - } -} diff --git a/src/Microsoft.VisualBasic/tests/IntegrationTests/Microsoft.VisualBasic.IntegrationTests/Microsoft.VisualBasic.IntegrationTests.csproj b/src/Microsoft.VisualBasic/tests/IntegrationTests/Microsoft.VisualBasic.IntegrationTests/Microsoft.VisualBasic.IntegrationTests.csproj index 315685c7e0e..ca9ed1d3242 100644 --- a/src/Microsoft.VisualBasic/tests/IntegrationTests/Microsoft.VisualBasic.IntegrationTests/Microsoft.VisualBasic.IntegrationTests.csproj +++ b/src/Microsoft.VisualBasic/tests/IntegrationTests/Microsoft.VisualBasic.IntegrationTests/Microsoft.VisualBasic.IntegrationTests.csproj @@ -2,7 +2,6 @@ - diff --git a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft.VisualBasic.Tests.csproj b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft.VisualBasic.Tests.csproj index 6cdbde8c0b0..4a1ed48e401 100644 --- a/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft.VisualBasic.Tests.csproj +++ b/src/Microsoft.VisualBasic/tests/UnitTests/Microsoft.VisualBasic.Tests.csproj @@ -6,17 +6,14 @@ + + + + - - - - - - - diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj b/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj index 5112042edde..103ab50d46d 100644 --- a/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj +++ b/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj @@ -15,13 +15,10 @@ + - - - - diff --git a/src/System.Windows.Forms.Primitives/src/Properties/InternalsVisibleTo.cs b/src/System.Windows.Forms.Primitives/src/Properties/InternalsVisibleTo.cs index 02ca6491933..348b2ca8d03 100644 --- a/src/System.Windows.Forms.Primitives/src/Properties/InternalsVisibleTo.cs +++ b/src/System.Windows.Forms.Primitives/src/Properties/InternalsVisibleTo.cs @@ -8,11 +8,12 @@ [assembly: InternalsVisibleTo("System.Windows.Forms.Design, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("System.Windows.Forms.Design.Editors, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo("System.Windows.Forms.Design.Tests, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("System.Windows.Forms.Primitives.Tests, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo("System.Windows.Forms.Primitives.TestUtilities, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("System.Windows.Forms.Tests, PublicKey=00000000000000000400000000000000")] -[assembly: InternalsVisibleTo("System.Windows.Forms.Design.Tests, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo("System.Windows.Forms.TestUtilities, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("WinformsControlsTest, PublicKey=00000000000000000400000000000000")] -[assembly: InternalsVisibleTo("InternalUtilitiesForTests, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("MauiListViewTests, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("System.Windows.Forms.IntegrationTests.Common, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo("System.Windows.Forms.Maui.IntegrationTests, PublicKey=00000000000000000400000000000000")] diff --git a/src/System.Windows.Forms.Primitives/tests/System.Windows.Forms.Primitives.Tests.csproj b/src/System.Windows.Forms.Primitives/tests/System.Windows.Forms.Primitives.Tests.csproj deleted file mode 100644 index 0ae2e2c762d..00000000000 --- a/src/System.Windows.Forms.Primitives/tests/System.Windows.Forms.Primitives.Tests.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - System.Windows.Forms.Primitives.Tests - true - - - - - - - - - - - - - - - - - - - - diff --git a/src/Common/tests/InternalUtilitiesForTests/src/ArchitectureDetection.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/ArchitectureDetection.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/ArchitectureDetection.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/ArchitectureDetection.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/AssertExtensions.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/AssertExtensions.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/AssertExtensions.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/AssertExtensions.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/TheoryExtensions.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/TheoryExtensions.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/TheoryExtensions.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/Extensions/TheoryExtensions.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/GdiHelper.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/GdiHelper.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/GdiHelper.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/GdiHelper.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/ITestAccessor.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/ITestAccessor.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/ITestAccessor.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/ITestAccessor.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/NoAssertContext.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/NoAssertContext.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/NoAssertContext.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/NoAssertContext.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/PlatformDetection.Windows.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/PlatformDetection.Windows.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/PlatformDetection.Windows.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/PlatformDetection.Windows.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/PlatformDetection.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/PlatformDetection.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/PlatformDetection.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/PlatformDetection.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/InternalsVisibleTo.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/Properties/InternalsVisibleTo.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/InternalsVisibleTo.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/Properties/InternalsVisibleTo.cs diff --git a/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj b/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj new file mode 100644 index 00000000000..2848fc195c3 --- /dev/null +++ b/src/System.Windows.Forms.Primitives/tests/TestUtilities/System.Windows.Forms.Primitives.TestUtilities.csproj @@ -0,0 +1,21 @@ + + + System.Windows.Forms.Primitives.TestUtilities + true + System + + + + + + + + + + + + + + + + diff --git a/src/Common/tests/InternalUtilitiesForTests/src/TestAccessor.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/TestAccessor.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/TestAccessor.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/TestAccessor.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/TestAccessors.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/TestAccessors.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/TestAccessors.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/TestAccessors.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/WindowClass.cs b/src/System.Windows.Forms.Primitives/tests/TestUtilities/WindowClass.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/WindowClass.cs rename to src/System.Windows.Forms.Primitives/tests/TestUtilities/WindowClass.cs diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/LVITEMWTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/LVITEMWTests.cs similarity index 97% rename from src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/LVITEMWTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/LVITEMWTests.cs index 3359170dd7d..54bcd63e778 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/LVITEMWTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/LVITEMWTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Tests.InteropTests { - public class LVITEMWTests : IClassFixture + public class LVITEMWTests { [Fact] public unsafe void UpdateText_should_throw_AOOR_if_cchTextMax_less_than_1() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/MCGRIDINFOTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/MCGRIDINFOTests.cs similarity index 98% rename from src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/MCGRIDINFOTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/MCGRIDINFOTests.cs index 838c009712e..62f8bb1d042 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/MCGRIDINFOTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/MCGRIDINFOTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.ComCtl32 { - public class MCGRIDINFOTests : IClassFixture + public class MCGRIDINFOTests { [ConditionalFact(typeof(ArchitectureDetection), nameof(ArchitectureDetection.Is32bit))] public unsafe void MCGRIDINFO_x32_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs similarity index 95% rename from src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs index bf7b70ff408..a79c4cdd230 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGIconUnionTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.ComCtl32 { - public class TASKDIALOGCONFIGIconUnionTests : IClassFixture + public class TASKDIALOGCONFIGIconUnionTests { [ConditionalFact(typeof(ArchitectureDetection), nameof(ArchitectureDetection.Is32bit))] public unsafe void TASKDIALOGCONFIGIconUnion_x32_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs similarity index 98% rename from src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs index ff9edd16f76..331ce4abc2f 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOGCONFIGTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.ComCtl32 { - public class TASKDIALOGCONFIGTests : IClassFixture + public class TASKDIALOGCONFIGTests { [ConditionalFact(typeof(ArchitectureDetection), nameof(ArchitectureDetection.Is32bit))] public unsafe void TASKDIALOGCONFIG_x32_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs similarity index 95% rename from src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs index 70a83515c7f..05d9b766d9f 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/ComCtl32/TASKDIALOG_BUTTONTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.ComCtl32 { - public class TASKDIALOG_BUTTONTests : IClassFixture + public class TASKDIALOG_BUTTONTests { [ConditionalFact(typeof(ArchitectureDetection), nameof(ArchitectureDetection.Is32bit))] public unsafe void TASKDIALOG_BUTTON_x32_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Comdlg32/PRINTDLGWTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Comdlg32/PRINTDLGWTests.cs similarity index 98% rename from src/System.Windows.Forms.Primitives/tests/Interop/Comdlg32/PRINTDLGWTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Comdlg32/PRINTDLGWTests.cs index 9ef53777b33..71cb48fbb5c 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Comdlg32/PRINTDLGWTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Comdlg32/PRINTDLGWTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.Comdlg32 { - public class PRINTDLGWTests : IClassFixture + public class PRINTDLGWTests { [ConditionalFact(typeof(ArchitectureDetection), nameof(ArchitectureDetection.Is32bit))] public unsafe void PRINTDLGW_32_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockAxHost.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockAxHost.cs new file mode 100644 index 00000000000..d53644548e5 --- /dev/null +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockAxHost.cs @@ -0,0 +1,141 @@ +// 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.Drawing; +using System.Drawing.Imaging; +using System.Runtime.InteropServices; +using static Interop; +using static Interop.Ole32; + +namespace System.Windows.Forms.Primitives.Tests.Interop.Mocks +{ + [ComVisible(true)] + [ClassInterface(ClassInterfaceType.AutoDispatch)] + internal class MockAxHost + { + private static Guid ipictureDisp_Guid = typeof(IPictureDisp).GUID; + private static Guid ipicture_Guid = typeof(IPicture).GUID; + + public MockAxHost(string clsidString) + { + } + + public static IPictureDisp GetIPictureDispFromPicture(Image image) + { + PICTDESC desc = GetPICTDESCFromPicture(image); + return (IPictureDisp)OleCreatePictureIndirect(ref desc, ref ipictureDisp_Guid, fOwn: BOOL.TRUE); + } + + public static IPicture GetIPictureFromCursor(IntPtr cursorHandle) + { + PICTDESC desc = PICTDESC.FromIcon(Icon.FromHandle(cursorHandle), copy: true); + return (IPicture)OleCreatePictureIndirect(ref desc, ref ipicture_Guid, fOwn: BOOL.TRUE); + } + + public static IPicture GetIPictureFromPicture(Image image) + { + PICTDESC desc = GetPICTDESCFromPicture(image); + return (IPicture)OleCreatePictureIndirect(ref desc, ref ipicture_Guid, fOwn: BOOL.TRUE); + } + + public static Image GetPictureFromIPicture(object picture) + { + int hPal = default; + IPicture pict = (IPicture)picture; + PICTYPE type = (PICTYPE)pict.Type; + if (type == PICTYPE.BITMAP) + { + try + { + hPal = pict.hPal; + } + catch (COMException) + { + } + } + + return GetPictureFromParams(pict.Handle, type, hPal, pict.Width, pict.Height); + } + + public static Image GetPictureFromIPictureDisp(object picture) + { + if (picture == null) + { + return null; + } + + int hPal = default; + IPictureDisp pict = (IPictureDisp)picture; + PICTYPE type = (PICTYPE)pict.Type; + if (type == PICTYPE.BITMAP) + { + try + { + hPal = pict.hPal; + } + catch (COMException) + { + } + } + + Image image = GetPictureFromParams(pict.Handle, type, hPal, pict.Width, pict.Height); + GC.KeepAlive(pict); + return image; + } + + private static PICTDESC GetPICTDESCFromPicture(Image image) + { + if (image is Bitmap bmp) + { + return PICTDESC.FromBitmap(bmp); + } + + if (image is Metafile mf) + { + return PICTDESC.FromMetafile(mf); + } + + throw new ArgumentException("AXUnknownImage", nameof(image)); + } + + private static Image GetPictureFromParams( + int handle, + PICTYPE type, + int paletteHandle, + int width, + int height) + { + switch (type) + { + case PICTYPE.ICON: + return (Image)Icon.FromHandle((IntPtr)handle).Clone(); + case PICTYPE.METAFILE: + WmfPlaceableFileHeader header = new WmfPlaceableFileHeader + { + BboxRight = (short)width, + BboxBottom = (short)height + }; + + using (var metafile = new Metafile((IntPtr)handle, header, deleteWmf: false)) + { + return (Image)metafile.Clone(); + } + case PICTYPE.ENHMETAFILE: + using (var metafile = new Metafile((IntPtr)handle, deleteEmf: false)) + { + return (Image)metafile.Clone(); + } + case PICTYPE.BITMAP: + return Image.FromHbitmap((IntPtr)handle, (IntPtr)paletteHandle); + case PICTYPE.NONE: + // MSDN says this should not be a valid value, but comctl32 returns it... + return null; + case PICTYPE.UNINITIALIZED: + return null; + default: + throw new ArgumentException("AXUnknownImage", nameof(type)); + } + } + } +} diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockCursor.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockCursor.cs new file mode 100644 index 00000000000..8c70dddbfca --- /dev/null +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Mocks/MockCursor.cs @@ -0,0 +1,53 @@ +// 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.Drawing; +using static Interop.User32; + +namespace System.Windows.Forms.Primitives.Tests.Interop.Mocks +{ + public class MockCursor : IDisposable + { + private IntPtr _handle = IntPtr.Zero; // handle to loaded image + private bool _ownHandle = true; + private readonly int _resourceId = 0; + + public MockCursor(int nResourceId) + { + // We don't delete stock cursors. + _ownHandle = false; + _resourceId = nResourceId; + _handle = LoadCursorW(IntPtr.Zero, (IntPtr)nResourceId); + } + + public void Dispose() + { + if (_handle != IntPtr.Zero) + { + if (_ownHandle) + { + DestroyCursor(_handle); + } + _handle = IntPtr.Zero; + } + } + + public IntPtr Handle + { + get + { + if (_handle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(MockCursor)); + } + return _handle; + } + } + + public Size Size + { + get => new Size(GetSystemMetrics(SystemMetric.SM_CXCURSOR), GetSystemMetrics(SystemMetric.SM_CYCURSOR)); + } + } +} diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/NtDll/RtlGetVersionTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/NtDll/RtlGetVersionTests.cs similarity index 94% rename from src/System.Windows.Forms.Primitives/tests/Interop/NtDll/RtlGetVersionTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/NtDll/RtlGetVersionTests.cs index 17fac989395..a14170d2428 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/NtDll/RtlGetVersionTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/NtDll/RtlGetVersionTests.cs @@ -7,7 +7,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.NtDll { - public class RtlGetVersionTests : IClassFixture + public class RtlGetVersionTests { [Fact] public void BasicFunctionality() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Ole32/IPictureTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs similarity index 55% rename from src/System.Windows.Forms.Primitives/tests/Interop/Ole32/IPictureTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs index c17a1df8424..98ccce1befd 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Ole32/IPictureTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Ole32/IPictureTests.cs @@ -4,17 +4,21 @@ using System.Drawing; using Xunit; +using System.Windows.Forms.Primitives.Tests.Interop.Mocks; using static Interop.Ole32; +using static Interop.User32; namespace System.Windows.Forms.Primitives.Tests.Interop.Ole32 { - public class IPictureTests : IClassFixture + [Collection("Sequential")] + public class IPictureTests { - [Fact] + [StaFact] public void GetIPictureFromCursor() { - Cursor arrow = Cursors.Arrow; - IPicture picture = AxHostAccess.GetIPictureFromCursor(arrow); + using MockCursor arrow = new MockCursor(CursorResourceId.IDC_ARROW); + + IPicture picture = MockAxHost.GetIPictureFromCursor(arrow.Handle); Assert.NotNull(picture); Assert.Equal(PICTYPE.ICON, (PICTYPE)picture.Type); @@ -22,12 +26,13 @@ public void GetIPictureFromCursor() Assert.Equal(arrow.Size.Width, GdiHelper.HimetricToPixelX(picture.Width)); } - [Fact] + [StaFact] public void GetIPictureFromImage() { - using Icon icon = Icon.FromHandle(Cursors.Arrow.Handle); + using MockCursor arrow = new MockCursor(CursorResourceId.IDC_ARROW); + using Icon icon = Icon.FromHandle(arrow.Handle); using Bitmap bitmap = icon.ToBitmap(); - IPicture picture = AxHostAccess.GetIPictureFromPicture(bitmap); + IPicture picture = MockAxHost.GetIPictureFromPicture(bitmap); Assert.NotNull(picture); Assert.Equal(PICTYPE.BITMAP, (PICTYPE)picture.Type); @@ -35,12 +40,12 @@ public void GetIPictureFromImage() Assert.Equal(bitmap.Size.Width, GdiHelper.HimetricToPixelX(picture.Width)); } - [Fact] + [StaFact] public void GetIPictureDispFromImage() { using Icon icon = SystemIcons.Question; using Bitmap bitmap = icon.ToBitmap(); - IPictureDisp picture = AxHostAccess.GetIPictureDispFromPicture(bitmap); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(bitmap); Assert.NotNull(picture); Assert.Equal(PICTYPE.BITMAP, (PICTYPE)picture.Type); @@ -48,47 +53,27 @@ public void GetIPictureDispFromImage() Assert.Equal(bitmap.Size.Width, GdiHelper.HimetricToPixelX(picture.Width)); } - [Fact] + [StaFact] public void GetPictureFromIPicture() { using Icon icon = SystemIcons.Exclamation; using Bitmap bitmap = icon.ToBitmap(); - IPicture picture = AxHostAccess.GetIPictureFromPicture(bitmap); + IPicture picture = MockAxHost.GetIPictureFromPicture(bitmap); Assert.NotNull(picture); - using Image image = AxHostAccess.GetPictureFromIPicture(picture); + using Image image = MockAxHost.GetPictureFromIPicture(picture); Assert.NotNull(image); Assert.Equal(bitmap.Size, image.Size); } - [Fact] + [StaFact] public void GetPictureFromIPictureDisp() { using Bitmap bitmap = new Bitmap(100, 200); - IPictureDisp picture = AxHostAccess.GetIPictureDispFromPicture(bitmap); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(bitmap); Assert.NotNull(picture); - using Image image = AxHostAccess.GetPictureFromIPictureDisp(picture); + using Image image = MockAxHost.GetPictureFromIPictureDisp(picture); Assert.NotNull(image); Assert.Equal(bitmap.Size, image.Size); } - - internal class AxHostAccess : AxHost - { - private AxHostAccess() : base(string.Empty) { } - - internal new static IPicture GetIPictureFromCursor(Cursor cursor) - => (IPicture)AxHost.GetIPictureFromCursor(cursor); - - internal new static IPicture GetIPictureFromPicture(Image image) - => (IPicture)AxHost.GetIPictureFromPicture(image); - - internal new static IPictureDisp GetIPictureDispFromPicture(Image image) - => (IPictureDisp)AxHost.GetIPictureDispFromPicture(image); - - internal static Image GetPictureFromIPicture(IPicture picture) - => GetPictureFromIPicture((object)picture); - - internal static Image GetPictureFromIPictureDisp(IPictureDisp picture) - => GetPictureFromIPictureDisp((object)picture); - } } } diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/IDispatchTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/IDispatchTests.cs similarity index 78% rename from src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/IDispatchTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/IDispatchTests.cs index 83be7f5fbee..272a2d65afb 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/IDispatchTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/IDispatchTests.cs @@ -4,6 +4,7 @@ using System.Drawing; using Xunit; +using System.Windows.Forms.Primitives.Tests.Interop.Mocks; using static Interop; using static Interop.Ole32; using static Interop.Oleaut32; @@ -11,13 +12,13 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.Oleaut32 { [Collection("Sequential")] - public class IDispatchTests : IClassFixture + public partial class IDispatchTests { - [WinFormsFact] + [StaFact] public unsafe void IDispatch_GetIDsOfNames_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; Guid riid = Guid.Empty; @@ -32,11 +33,11 @@ public unsafe void IDispatch_GetIDsOfNames_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void IDispatch_GetTypeInfo_Invoke_Success() { using var image = new Bitmap(16, 16); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; @@ -46,11 +47,11 @@ public unsafe void IDispatch_GetTypeInfo_Invoke_Success() System.Runtime.InteropServices.Marshal.ReleaseComObject(typeInfo); } - [WinFormsFact] + [StaFact] public unsafe void IDispatch_GetTypeInfoCount_Invoke_Success() { using var image = new Bitmap(16, 16); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; uint ctInfo = uint.MaxValue; @@ -59,11 +60,11 @@ public unsafe void IDispatch_GetTypeInfoCount_Invoke_Success() Assert.Equal(1u, ctInfo); } - [WinFormsFact] + [StaFact] public unsafe void IDispatch_Invoke_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; Guid riid = Guid.Empty; @@ -85,14 +86,5 @@ public unsafe void IDispatch_Invoke_Invoke_Success() Assert.Equal(16, GdiHelper.HimetricToPixelY((int)varResult[0])); Assert.Equal(0u, argErr); } - - private class SubAxHost : AxHost - { - private SubAxHost(string clsidString) : base(clsidString) - { - } - - public new static IPictureDisp GetIPictureDispFromPicture(Image image) => (IPictureDisp)AxHost.GetIPictureDispFromPicture(image); - } } } diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/ITypeInfoTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs similarity index 89% rename from src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/ITypeInfoTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs index 2e7eba55a63..b9d30cc6e2b 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Oleaut32/ITypeInfoTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Oleaut32/ITypeInfoTests.cs @@ -4,6 +4,7 @@ using System.Drawing; using System.Runtime.InteropServices; +using System.Windows.Forms.Primitives.Tests.Interop.Mocks; using Xunit; using static Interop; using static Interop.Ole32; @@ -12,13 +13,13 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.Oleaut32 { [Collection("Sequential")] - public class ITypeInfoTests : IClassFixture + public class ITypeInfoTests { - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_AddressOfMember_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -31,11 +32,11 @@ public unsafe void ITypeInfo_AddressOfMember_Invoke_Success() Assert.Equal(IntPtr.Zero, pv); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_CreateInstance_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -49,11 +50,11 @@ public unsafe void ITypeInfo_CreateInstance_Invoke_Success() Assert.Equal(IntPtr.Zero, pvObj); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetContainingTypeLib_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -75,11 +76,11 @@ public unsafe void ITypeInfo_GetContainingTypeLib_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetDllEntry_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -96,11 +97,11 @@ public unsafe void ITypeInfo_GetDllEntry_Invoke_Success() Assert.Equal(0u, wOrdinal); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetDocumentation_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -119,11 +120,11 @@ public unsafe void ITypeInfo_GetDocumentation_Invoke_Success() Assert.Empty(helpFile.String.ToString()); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetFuncDesc_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -156,11 +157,11 @@ public unsafe void ITypeInfo_GetFuncDesc_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetIDsOfNames_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -178,11 +179,11 @@ public unsafe void ITypeInfo_GetIDsOfNames_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetImplTypeFlags_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -195,11 +196,11 @@ public unsafe void ITypeInfo_GetImplTypeFlags_Invoke_Success() Assert.NotEqual(IMPLTYPEFLAG.FDEFAULT, implTypeFlags); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetMops_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -212,11 +213,11 @@ public unsafe void ITypeInfo_GetMops_Invoke_Success() Assert.Empty(mops.String.ToString()); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetNames_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -237,11 +238,11 @@ public unsafe void ITypeInfo_GetNames_Invoke_Success() rgszNames[1].Dispose(); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetRefTypeInfo_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -260,11 +261,11 @@ public unsafe void ITypeInfo_GetRefTypeInfo_Invoke_Success() Assert.NotNull(refTypeInfo); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetRefTypeOfImplType_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -277,11 +278,11 @@ public unsafe void ITypeInfo_GetRefTypeOfImplType_Invoke_Success() Assert.NotEqual(0u, refType); } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetTypeAttr_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -319,11 +320,11 @@ public unsafe void ITypeInfo_GetTypeAttr_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetTypeComp_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -343,11 +344,11 @@ public unsafe void ITypeInfo_GetTypeComp_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_GetVarDesc_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -375,11 +376,11 @@ public unsafe void ITypeInfo_GetVarDesc_Invoke_Success() } } - [WinFormsFact] + [StaFact] public unsafe void ITypeInfo_Invoke_Invoke_Success() { using var image = new Bitmap(16, 32); - IPictureDisp picture = SubAxHost.GetIPictureDispFromPicture(image); + IPictureDisp picture = MockAxHost.GetIPictureDispFromPicture(image); IDispatch dispatch = (IDispatch)picture; ITypeInfo typeInfo; HRESULT hr = dispatch.GetTypeInfo(0, Kernel32.GetThreadLocale(), out typeInfo); @@ -404,15 +405,6 @@ public unsafe void ITypeInfo_Invoke_Invoke_Success() Assert.Equal(0u, argErr); } - private class SubAxHost : AxHost - { - private SubAxHost(string clsidString) : base(clsidString) - { - } - - public new static IPictureDisp GetIPictureDispFromPicture(Image image) => (IPictureDisp)AxHost.GetIPictureDispFromPicture(image); - } - // ITypeInfo often requires manual RCW reference management. The native object may be free threaded // but when created on an STA thread it will be associated with that thread. If the native code keeps // reusing the same instance you can run into a condition where the GC cleans up the RCW from one STA diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Richedit/CHARFORMATWTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/CHARFORMATWTests.cs similarity index 94% rename from src/System.Windows.Forms.Primitives/tests/Interop/Richedit/CHARFORMATWTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/CHARFORMATWTests.cs index 1797970c1f3..f28ce42598f 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Richedit/CHARFORMATWTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/CHARFORMATWTests.cs @@ -7,7 +7,7 @@ namespace System.Windows.Forms.Tests.Interop.Richedit { - public class CHARFORMATWTests : IClassFixture + public class CHARFORMATWTests { [Fact] public unsafe void CharFormat_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Richedit/EDITSTREAMTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/EDITSTREAMTests.cs similarity index 86% rename from src/System.Windows.Forms.Primitives/tests/Interop/Richedit/EDITSTREAMTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/EDITSTREAMTests.cs index deeb232417c..f2801571ed8 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Richedit/EDITSTREAMTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/Richedit/EDITSTREAMTests.cs @@ -7,9 +7,9 @@ namespace System.Windows.Forms.Tests.Interop.Richedit { - public class EDITSTREAMTests : IClassFixture + public class EDITSTREAMTests { - [WinFormsFact] + [Fact] public unsafe void EditStream_Size_Get_ReturnsExpected() { if (IntPtr.Size == 4) diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/User32/GetWindowTextTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/GetWindowTextTests.cs similarity index 92% rename from src/System.Windows.Forms.Primitives/tests/Interop/User32/GetWindowTextTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/GetWindowTextTests.cs index 87035132bbd..a07340133c9 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/User32/GetWindowTextTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/GetWindowTextTests.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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. @@ -7,15 +7,15 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.User32 { - public class GetWindowTextTests : IClassFixture + public class GetWindowTextTests { - [WinFormsFact] + [StaFact] public void GetWindowText_DoesNotTruncateText() { CallGetWindowText(useBeforeGetTextLengthCallback: false); } - [WinFormsFact] + [StaFact] public void GetWindowText_DoesNotLoopInfinitely() { CallGetWindowText(useBeforeGetTextLengthCallback: true); diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/User32/LOGFONTWTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/LOGFONTWTests.cs similarity index 95% rename from src/System.Windows.Forms.Primitives/tests/Interop/User32/LOGFONTWTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/LOGFONTWTests.cs index 89de4647a13..89befafc2f6 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/User32/LOGFONTWTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/LOGFONTWTests.cs @@ -8,7 +8,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.User32 { - public class LOGFONTWTests : IClassFixture + public class LOGFONTWTests { [Fact] public unsafe void LogFont_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/User32/SysInfoTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/SysInfoTests.cs similarity index 91% rename from src/System.Windows.Forms.Primitives/tests/Interop/User32/SysInfoTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/SysInfoTests.cs index 0d4c9bfd2b2..ba8f6c19639 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/User32/SysInfoTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/Interop/User32/SysInfoTests.cs @@ -7,7 +7,7 @@ namespace System.Windows.Forms.Primitives.Tests.Interop.User32 { - public class SysInfoTests : IClassFixture + public class SysInfoTests { [Fact] public unsafe void NonClientMetrics_Size() diff --git a/src/System.Windows.Forms.Primitives/tests/UnitTests/System.Windows.Forms.Primitives.Tests.csproj b/src/System.Windows.Forms.Primitives/tests/UnitTests/System.Windows.Forms.Primitives.Tests.csproj new file mode 100644 index 00000000000..3ea85b8a5ad --- /dev/null +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System.Windows.Forms.Primitives.Tests.csproj @@ -0,0 +1,19 @@ + + + + System.Windows.Forms.Primitives.Tests + true + $(NoWarn);618 + + + + + + + + + + + + + diff --git a/src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlaceTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlaceTests.cs similarity index 79% rename from src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlaceTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlaceTests.cs index c9e069a9e7e..24374dfb313 100644 --- a/src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlaceTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlaceTests.cs @@ -3,15 +3,25 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using WinForms.Common.Tests; using Xunit; namespace System.Windows.Forms.Tests { public class FileDialogCustomPlaceTests { + public static TheoryData GetStringWithNullTheoryData() + { + var data = new TheoryData + { + null, + string.Empty, + "reasonable" + }; + return data; + } + [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetStringWithNullTheoryData))] + [MemberData(nameof(GetStringWithNullTheoryData))] public void FileDialogCustomPlace_Ctor_String(string path) { var place = new FileDialogCustomPlace(path); @@ -19,8 +29,18 @@ public void FileDialogCustomPlace_Ctor_String(string path) Assert.Same(path ?? string.Empty, place.Path); } + public static TheoryData GetGuidTheoryData() + { + var data = new TheoryData + { + Guid.Empty, + Guid.NewGuid() + }; + return data; + } + [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetGuidTheoryData))] + [MemberData(nameof(GetGuidTheoryData))] public void FileDialogCustomPlace_Ctor_Guid(Guid knownFolderGuid) { var place = new FileDialogCustomPlace(knownFolderGuid); @@ -29,7 +49,7 @@ public void FileDialogCustomPlace_Ctor_Guid(Guid knownFolderGuid) } [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetGuidTheoryData))] + [MemberData(nameof(GetGuidTheoryData))] public void FileDialogCustomPlace_KnownFolderGuid_Set_GetReturnsExpected(Guid value) { var place = new FileDialogCustomPlace("path") @@ -46,7 +66,7 @@ public void FileDialogCustomPlace_KnownFolderGuid_Set_GetReturnsExpected(Guid va } [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetStringWithNullTheoryData))] + [MemberData(nameof(GetStringWithNullTheoryData))] public void FileDialogCustomPlace_Path_Set_GetReturnsExpected(string value) { var place = new FileDialogCustomPlace(Guid.NewGuid()) diff --git a/src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs similarity index 66% rename from src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs rename to src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs index 536bef25465..5887860b1b0 100644 --- a/src/System.Windows.Forms.Primitives/tests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs +++ b/src/System.Windows.Forms.Primitives/tests/UnitTests/System/Windows/Forms/FileDialogCustomPlacesCollectionTests.cs @@ -3,15 +3,25 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; -using WinForms.Common.Tests; using Xunit; namespace System.Windows.Forms.Tests { public class FileDialogCustomPlacesCollectionTests { + public static TheoryData GetStringWithNullTheoryData() + { + var data = new TheoryData + { + null, + string.Empty, + "reasonable" + }; + return data; + } + [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetStringWithNullTheoryData))] + [MemberData(nameof(GetStringWithNullTheoryData))] public void FileDialogCustomPlacesCollection_Add_String_Success(string path) { var collection = new FileDialogCustomPlacesCollection @@ -23,8 +33,18 @@ public void FileDialogCustomPlacesCollection_Add_String_Success(string path) Assert.Same(path ?? string.Empty, place.Path); } + public static TheoryData GetGuidTheoryData() + { + var data = new TheoryData + { + Guid.Empty, + Guid.NewGuid() + }; + return data; + } + [Theory] - [CommonMemberData(nameof(CommonTestHelper.GetGuidTheoryData))] + [MemberData(nameof(GetGuidTheoryData))] public void FileDialogCustomPlacesCollection_Add_Guid_Success(Guid knownFolderGuid) { var collection = new FileDialogCustomPlacesCollection diff --git a/src/Common/tests/InternalUtilitiesForTests/src/AdminHelpers.cs b/src/System.Windows.Forms/tests/TestUtilities/AdminHelpers.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/AdminHelpers.cs rename to src/System.Windows.Forms/tests/TestUtilities/AdminHelpers.cs diff --git a/src/Common/tests/InternalUtilitiesForTests/src/BinarySerialization.cs b/src/System.Windows.Forms/tests/TestUtilities/BinarySerialization.cs similarity index 100% rename from src/Common/tests/InternalUtilitiesForTests/src/BinarySerialization.cs rename to src/System.Windows.Forms/tests/TestUtilities/BinarySerialization.cs diff --git a/src/Common/tests/CommonMemberDataAttribute.cs b/src/System.Windows.Forms/tests/TestUtilities/CommonMemberDataAttribute.cs similarity index 100% rename from src/Common/tests/CommonMemberDataAttribute.cs rename to src/System.Windows.Forms/tests/TestUtilities/CommonMemberDataAttribute.cs diff --git a/src/Common/tests/CommonTestHelper.cs b/src/System.Windows.Forms/tests/TestUtilities/CommonTestHelper.cs similarity index 99% rename from src/Common/tests/CommonTestHelper.cs rename to src/System.Windows.Forms/tests/TestUtilities/CommonTestHelper.cs index d2767ae6532..ed166b0a7f4 100644 --- a/src/Common/tests/CommonTestHelper.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/CommonTestHelper.cs @@ -20,7 +20,7 @@ namespace WinForms.Common.Tests public static class CommonTestHelper { // helper method to generate theory data from all values of an enum type - internal static TheoryData GetEnumTheoryData() where T : Enum + public static TheoryData GetEnumTheoryData() where T : Enum { var data = new TheoryData(); foreach (T item in Enum.GetValues(typeof(T))) @@ -43,7 +43,7 @@ public static TheoryData GetEnumTypeTheoryData(Type enumType) // helper method to generate invalid theory data for an enum type // This method assumes that int.MinValue and int.MaxValue are not in the enum - internal static TheoryData GetEnumTheoryDataInvalid() where T : Enum + public static TheoryData GetEnumTheoryDataInvalid() where T : Enum { var data = new TheoryData { diff --git a/src/Common/tests/InternalUtilitiesForTests/InternalUtilitiesForTests.csproj b/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj similarity index 74% rename from src/Common/tests/InternalUtilitiesForTests/InternalUtilitiesForTests.csproj rename to src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj index cb833482993..67f5df65580 100644 --- a/src/Common/tests/InternalUtilitiesForTests/InternalUtilitiesForTests.csproj +++ b/src/System.Windows.Forms/tests/TestUtilities/System.Windows.Forms.TestUtilities.csproj @@ -1,7 +1,8 @@  - InternalUtilitiesForTests + System.Windows.Forms.TestUtilities true + System @@ -16,7 +17,8 @@ - + + diff --git a/src/Common/tests/SystemEventsHelper.cs b/src/System.Windows.Forms/tests/TestUtilities/SystemEventsHelper.cs similarity index 99% rename from src/Common/tests/SystemEventsHelper.cs rename to src/System.Windows.Forms/tests/TestUtilities/SystemEventsHelper.cs index cd35e5a1ac9..86c29866c21 100644 --- a/src/Common/tests/SystemEventsHelper.cs +++ b/src/System.Windows.Forms/tests/TestUtilities/SystemEventsHelper.cs @@ -8,7 +8,7 @@ using Xunit; using static Interop.User32; -namespace WinForms.Common.Tests +namespace System { public static class SystemEventsHelper { diff --git a/src/Common/tests/TempFile.cs b/src/System.Windows.Forms/tests/TestUtilities/TempFile.cs similarity index 100% rename from src/Common/tests/TempFile.cs rename to src/System.Windows.Forms/tests/TestUtilities/TempFile.cs diff --git a/src/Common/tests/ThreadExceptionFixture.cs b/src/System.Windows.Forms/tests/TestUtilities/ThreadExceptionFixture.cs similarity index 100% rename from src/Common/tests/ThreadExceptionFixture.cs rename to src/System.Windows.Forms/tests/TestUtilities/ThreadExceptionFixture.cs diff --git a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj index 4162eae72bf..f50c892432d 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj +++ b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj @@ -16,9 +16,7 @@ - - - + @@ -26,14 +24,6 @@ - - - - - - - - PreserveNewest diff --git a/src/System.Windows.Forms.Primitives/tests/Interop/Mso/IMsoComponentManagerTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ComponentManagerTests.cs similarity index 99% rename from src/System.Windows.Forms.Primitives/tests/Interop/Mso/IMsoComponentManagerTests.cs rename to src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ComponentManagerTests.cs index 8ec521c08ec..641e0d71147 100644 --- a/src/System.Windows.Forms.Primitives/tests/Interop/Mso/IMsoComponentManagerTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Application.ComponentManagerTests.cs @@ -8,7 +8,7 @@ using static Interop; using static Interop.Mso; -namespace System.Windows.Forms.Primitives.Tests.Interop.Mso +namespace System.Windows.Forms.Tests.Interop_Mso { public unsafe class IMsoComponentManagerTests : IClassFixture {