From 491566f864cba98a840fb1ed02665cd25c0c4e4f Mon Sep 17 00:00:00 2001 From: Derek DuPont Date: Mon, 11 Mar 2024 13:52:38 -0400 Subject: [PATCH] Added a test project for the reproduction of Issue #4658. --- Issue4658/.runsettings | 6 ++++++ Issue4658/ApartmentTest.csproj | 18 ++++++++++++++++++ Issue4658/ApartmentTest.sln | 25 +++++++++++++++++++++++++ Issue4658/README.md | 7 +++++++ Issue4658/UnitTest1.cs | 14 ++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 Issue4658/.runsettings create mode 100644 Issue4658/ApartmentTest.csproj create mode 100644 Issue4658/ApartmentTest.sln create mode 100644 Issue4658/README.md create mode 100644 Issue4658/UnitTest1.cs diff --git a/Issue4658/.runsettings b/Issue4658/.runsettings new file mode 100644 index 0000000000..8177d2b136 --- /dev/null +++ b/Issue4658/.runsettings @@ -0,0 +1,6 @@ + + + + 1200000 + + \ No newline at end of file diff --git a/Issue4658/ApartmentTest.csproj b/Issue4658/ApartmentTest.csproj new file mode 100644 index 0000000000..444ccc96d7 --- /dev/null +++ b/Issue4658/ApartmentTest.csproj @@ -0,0 +1,18 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + + + diff --git a/Issue4658/ApartmentTest.sln b/Issue4658/ApartmentTest.sln new file mode 100644 index 0000000000..800e74494f --- /dev/null +++ b/Issue4658/ApartmentTest.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34525.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApartmentTest", "ApartmentTest.csproj", "{C94EF6CC-69E7-4FD2-BAC7-4F478F41C785}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C94EF6CC-69E7-4FD2-BAC7-4F478F41C785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C94EF6CC-69E7-4FD2-BAC7-4F478F41C785}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C94EF6CC-69E7-4FD2-BAC7-4F478F41C785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C94EF6CC-69E7-4FD2-BAC7-4F478F41C785}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {86F44442-904E-4CCC-9204-593A89740BC3} + EndGlobalSection +EndGlobal diff --git a/Issue4658/README.md b/Issue4658/README.md new file mode 100644 index 0000000000..217eac4a26 --- /dev/null +++ b/Issue4658/README.md @@ -0,0 +1,7 @@ +Test project for [Issue #4658](https://github.com/nunit/nunit/issues/4658). + +To reproduce, either run the test `ApartmentStateShouldBeSTA` from Visual Studio 2022, or open a command prompt from this directory and run the following: + +``` +dotnet test -s .runsettings +``` \ No newline at end of file diff --git a/Issue4658/UnitTest1.cs b/Issue4658/UnitTest1.cs new file mode 100644 index 0000000000..995d6646ae --- /dev/null +++ b/Issue4658/UnitTest1.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace ApartmentTest +{ + [TestFixture, Apartment(ApartmentState.STA)] + public class Tests + { + [Test] + public void ApartmentStateShouldBeSTA() + { + Assert.That(Thread.CurrentThread.GetApartmentState(), Is.EqualTo(ApartmentState.STA)); + } + } +} \ No newline at end of file