File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
5
- <TargetFramework >netcoreapp2.1 </TargetFramework >
5
+ <TargetFramework >net5.0 </TargetFramework >
6
6
<Authors >Andreas Beham</Authors >
7
7
<Version >3.4</Version >
8
8
<Company >HEAL, FH Upper Austria</Company >
Original file line number Diff line number Diff line change 2
2
3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
5
- <TargetFramework >netcoreapp2.1 </TargetFramework >
5
+ <TargetFramework >net5.0 </TargetFramework >
6
6
<Version >3.4</Version >
7
7
<Authors >Andreas Beham</Authors >
8
8
<Company >HEAL, FH Upper Austria</Company >
Original file line number Diff line number Diff line change @@ -170,19 +170,21 @@ public void EnvironmentBackwardsCompat() {
170
170
171
171
[ Fact ]
172
172
public void PseudoRealtimeEnvTestStopTest ( ) {
173
- var then = DateTime . UtcNow ;
173
+ var sw = Stopwatch . StartNew ( ) ;
174
174
var env = new PseudoRealtimeSimulation ( ) ;
175
175
env . Run ( TimeSpan . FromSeconds ( 1 ) ) ;
176
- var now = DateTime . UtcNow ;
177
- Assert . True ( now - then >= TimeSpan . FromSeconds ( 1 ) ) ;
176
+ sw . Stop ( ) ;
177
+ Assert . True ( sw . Elapsed >= TimeSpan . FromSeconds ( 1 ) ) ;
178
178
179
- then = DateTime . UtcNow ;
179
+ sw . Restart ( ) ;
180
+ var simTime = env . Now ;
180
181
var t = Task . Run ( ( ) => env . Run ( TimeSpan . FromMinutes ( 1 ) ) ) ;
181
182
Task . Delay ( TimeSpan . FromMilliseconds ( 200 ) ) . Wait ( ) ;
182
183
env . StopAsync ( ) ;
183
184
t . Wait ( ) ;
184
- now = DateTime . UtcNow ;
185
- Assert . True ( now - then < TimeSpan . FromMinutes ( 1 ) ) ;
185
+ sw . Stop ( ) ;
186
+ // probably safe to assume this didn't take longer than 10s
187
+ Assert . True ( env . Now - simTime < TimeSpan . FromSeconds ( 10 ) ) ;
186
188
}
187
189
188
190
[ Fact ]
Original file line number Diff line number Diff line change 2
2
3
3
<PropertyGroup >
4
4
<OutputType >Library</OutputType >
5
- <TargetFramework >netcoreapp2.1 </TargetFramework >
5
+ <TargetFramework >net5.0 </TargetFramework >
6
6
<Version >3.4</Version >
7
7
<Authors >Andreas Beham</Authors >
8
8
<Company >HEAL, FH Upper Austria</Company >
You can’t perform that action at this time.
0 commit comments