File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed
Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change 11using NUnit . Framework ;
22using System . Runtime . InteropServices ;
3- using Terraria . Utilities ;
43
54namespace TerrariaServerAPI . Tests ;
65
@@ -11,27 +10,28 @@ public class BaseTest
1110 [ OneTimeSetUp ]
1211 public void EnsureInitialised ( )
1312 {
14- TestContext . Out . WriteLine ( $ "Test architecture { RuntimeInformation . ProcessArchitecture } ") ;
15-
1613 if ( ! _initialized )
1714 {
15+ TestContext . Out . WriteLine ( $ "Test architecture { RuntimeInformation . ProcessArchitecture } ") ;
16+
1817 bool invoked = false ;
19- HookEvents . HookDelegate < global :: Terraria . Main , HookEvents . Terraria . Main . DedServEventArgs > cb = ( instance , args ) =>
18+ HookEvents . HookDelegate < Terraria . Main , HookEvents . Terraria . Main . DedServEventArgs > cb = ( instance , args ) =>
2019 {
2120 invoked = true ;
2221 // DedServ typically requires input, so no need to continue execution
2322 args . ContinueExecution = false ;
2423 // DedServ calls the following, which is needed for subsequent tests
25- global ::Terraria . Main . rand = new UnifiedRandom ( ) ;
2624 instance . Initialize ( ) ;
2725 } ;
2826 HookEvents . Terraria . Main . DedServ += cb ;
2927
30- global :: TerrariaApi . Server . Program . Main ( [ ] ) ;
28+ TerrariaApi . Server . Program . Main ( [ ] ) ;
3129
3230 HookEvents . Terraria . Main . DedServ -= cb ;
3331
3432 Assert . That ( invoked , Is . True ) ;
33+
34+ _initialized = true ;
3535 }
3636 }
3737}
Original file line number Diff line number Diff line change @@ -22,16 +22,12 @@ public void EnsureRuntimeDetours()
2222
2323 bool invoked = false ;
2424
25- On . Terraria . Main . hook_DedServ callback = ( orig , self ) =>
26- {
27- invoked = true ;
28- // DedServ typically requires input, so no need to continue execution
29- } ;
30- On . Terraria . Main . DedServ += callback ;
25+ On . Terraria . Program . hook_RunGame callback = ( orig ) => invoked = true ;
26+ On . Terraria . Program . RunGame += callback ;
3127
32- global :: TerrariaApi . Server . Program . Main ( [ ] ) ;
28+ Terraria . Program . RunGame ( ) ;
3329
34- On . Terraria . Main . DedServ -= callback ;
30+ On . Terraria . Program . RunGame -= callback ;
3531
3632 Assert . That ( invoked , Is . True ) ;
3733 }
You can’t perform that action at this time.
0 commit comments