File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/tests/nativeaot/SmokeTests/UnitTests Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ internal static class Threading
15
15
16
16
public static int Run ( )
17
17
{
18
+ if ( OperatingSystem . IsWindows ( ) )
19
+ {
20
+ Console . WriteLine ( " ApartmentTests" ) ;
21
+ ApartmentTests . ResetApartmentStatus ( ) ;
22
+ }
23
+
18
24
Console . WriteLine ( " WaitSubsystemTests.DoubleSetOnEventWithTimedOutWaiterShouldNotStayInWaitersList" ) ;
19
25
WaitSubsystemTests . DoubleSetOnEventWithTimedOutWaiterShouldNotStayInWaitersList ( ) ;
20
26
@@ -121,6 +127,26 @@ public static int Run()
121
127
}
122
128
}
123
129
130
+ internal static class ApartmentTests
131
+ {
132
+ [ Fact ]
133
+ public static void ResetApartmentStatus ( )
134
+ {
135
+ Assert . Equal ( ApartmentState . MTA , Thread . CurrentThread . GetApartmentState ( ) ) ;
136
+
137
+ Thread . CurrentThread . SetApartmentState ( ApartmentState . Unknown ) ;
138
+ Assert . Equal ( ApartmentState . MTA , Thread . CurrentThread . GetApartmentState ( ) ) ;
139
+
140
+ Thread . CurrentThread . SetApartmentState ( ApartmentState . STA ) ;
141
+ Assert . Equal ( ApartmentState . STA , Thread . CurrentThread . GetApartmentState ( ) ) ;
142
+
143
+ Thread . CurrentThread . SetApartmentState ( ApartmentState . Unknown ) ;
144
+ Assert . Equal ( ApartmentState . MTA , Thread . CurrentThread . GetApartmentState ( ) ) ;
145
+
146
+ Thread . CurrentThread . SetApartmentState ( ApartmentState . MTA ) ;
147
+ }
148
+ }
149
+
124
150
internal static class WaitSubsystemTests
125
151
{
126
152
private const int AcceptableEarlyWaitTerminationDiffMilliseconds = - 100 ;
You can’t perform that action at this time.
0 commit comments