File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
tests/GraphQL.Integration.Tests Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -168,12 +168,13 @@ query Long {
168168 }" ) ;
169169
170170 using ( var setup = WebHostHelpers . SetupTest < StartupChat > ( false , serializer ) ) {
171- var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 1 ) ) ;
171+ var cancellationTimeout = TimeSpan . FromSeconds ( 1 ) ;
172+ var cts = new CancellationTokenSource ( cancellationTimeout ) ;
172173
173174 Func < Task > requestTask = ( ) => setup . Client . SendQueryAsync ( graphQLRequest , ( ) => new { longRunning = string . Empty } , cts . Token ) ;
174175 Action timeMeasurement = ( ) => requestTask . Should ( ) . Throw < TaskCanceledException > ( ) ;
175176
176- timeMeasurement . ExecutionTime ( ) . Should ( ) . BeCloseTo ( TimeSpan . FromSeconds ( 2 ) , TimeSpan . FromMilliseconds ( 200 ) ) ;
177+ timeMeasurement . ExecutionTime ( ) . Should ( ) . BeCloseTo ( cancellationTimeout , TimeSpan . FromMilliseconds ( 50 ) ) ;
177178 }
178179 }
179180 }
Original file line number Diff line number Diff line change @@ -59,12 +59,13 @@ query Long {
5959 }" ) ;
6060
6161 using ( var setup = WebHostHelpers . SetupTest < StartupChat > ( true , Serializer ) ) {
62- var cts = new CancellationTokenSource ( TimeSpan . FromSeconds ( 1 ) ) ;
62+ var cancellationTimeout = TimeSpan . FromSeconds ( 1 ) ;
63+ var cts = new CancellationTokenSource ( cancellationTimeout ) ;
6364
64- Func < Task > requestTask = ( ) => setup . Client . SendQueryAsync ( graphQLRequest , ( ) => new { longRunning = string . Empty } , cts . Token ) ;
65+ Func < Task > requestTask = ( ) => setup . Client . SendQueryAsync ( graphQLRequest , ( ) => new { longRunning = string . Empty } , cts . Token ) ;
6566 Action timeMeasurement = ( ) => requestTask . Should ( ) . Throw < TaskCanceledException > ( ) ;
6667
67- timeMeasurement . ExecutionTime ( ) . Should ( ) . BeCloseTo ( TimeSpan . FromSeconds ( 2 ) , TimeSpan . FromMilliseconds ( 200 ) ) ;
68+ timeMeasurement . ExecutionTime ( ) . Should ( ) . BeCloseTo ( cancellationTimeout , TimeSpan . FromMilliseconds ( 50 ) ) ;
6869 }
6970 }
7071
You can’t perform that action at this time.
0 commit comments