@@ -71,7 +71,7 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
71
71
// arrange
72
72
var typeModule = new TriggerableTypeModule ( ) ;
73
73
var warmups = 0 ;
74
- var resetEvent = new AutoResetEvent ( false ) ;
74
+ var warmupResetEvent = new AutoResetEvent ( false ) ;
75
75
76
76
var services = new ServiceCollection ( ) ;
77
77
services
@@ -80,7 +80,7 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
80
80
. InitializeOnStartup ( keepWarm : true , warmup : ( _ , _ ) =>
81
81
{
82
82
warmups ++ ;
83
- resetEvent . Set ( ) ;
83
+ warmupResetEvent . Set ( ) ;
84
84
return Task . CompletedTask ;
85
85
} )
86
86
. AddQueryType ( d => d . Field ( "foo" ) . Resolve ( "" ) ) ;
@@ -99,15 +99,19 @@ public async Task Ensure_Warmups_Are_Triggered_An_Appropriate_Number_Of_Times()
99
99
100
100
// act
101
101
// assert
102
+ warmupResetEvent . WaitOne ( ) ;
103
+
104
+ Assert . Equal ( 1 , warmups ) ;
105
+ warmupResetEvent . Reset ( ) ;
106
+
102
107
typeModule . TriggerChange ( ) ;
103
- resetEvent . WaitOne ( ) ;
108
+ warmupResetEvent . WaitOne ( ) ;
104
109
105
- // 2 since we have the initial warmup at "startup" and the one triggered above.
106
110
Assert . Equal ( 2 , warmups ) ;
111
+ warmupResetEvent . Reset ( ) ;
107
112
108
- resetEvent . Reset ( ) ;
109
113
typeModule . TriggerChange ( ) ;
110
- resetEvent . WaitOne ( ) ;
114
+ warmupResetEvent . WaitOne ( ) ;
111
115
112
116
Assert . Equal ( 3 , warmups ) ;
113
117
}
0 commit comments