Skip to content

Commit

Permalink
Added a test project for the reproduction of Issue nunit#4658.
Browse files Browse the repository at this point in the history
  • Loading branch information
dd-eg committed Mar 11, 2024
1 parent ab98e0e commit 491566f
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Issue4658/.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<NUnit>
<DefaultTimeout>1200000</DefaultTimeout>
</NUnit>
</RunSettings>
18 changes: 18 additions & 0 deletions Issue4658/ApartmentTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Issue4658/ApartmentTest.sln
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions Issue4658/README.md
Original file line number Diff line number Diff line change
@@ -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
```
14 changes: 14 additions & 0 deletions Issue4658/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -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));
}
}
}

0 comments on commit 491566f

Please sign in to comment.