1
1
extern alias Client ;
2
2
extern alias Server ;
3
3
using System ;
4
+ using System . IO ;
4
5
using System . Linq ;
5
6
using System . Net ;
6
7
using System . Threading ;
@@ -22,7 +23,7 @@ public class ClientServerTests : IDisposable
22
23
{
23
24
private readonly ITestOutputHelper testOutputHelper ;
24
25
25
- private readonly GameMain serverGame ;
26
+ private readonly GameMain ? serverGame ;
26
27
private GameServer ? currentServer ;
27
28
private readonly string generatedPassword ;
28
29
@@ -32,6 +33,10 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
32
33
{
33
34
this . testOutputHelper = testOutputHelper ;
34
35
36
+ if ( ! File . Exists ( ContentPackageManager . VanillaFileList ) )
37
+ {
38
+ return ;
39
+ }
35
40
serverGame = new GameMain ( Array . Empty < string > ( ) ) ;
36
41
serverGame . Init ( ) ;
37
42
var random = new Random ( ) ;
@@ -41,6 +46,12 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
41
46
[ Fact ]
42
47
public void TestLidgren ( )
43
48
{
49
+ if ( serverGame == null )
50
+ {
51
+ testOutputHelper . WriteLine ( "VanillaFileList not found, skipping test" ) ;
52
+ return ;
53
+ }
54
+
44
55
var server = CreateServer ( ) ;
45
56
var client = CreateClient ( server ) ;
46
57
Prop . ForAll < byte [ ] > ( data =>
@@ -120,7 +131,7 @@ private void UpdateServer(GameServer server)
120
131
}
121
132
122
133
private void OnTestsFinished ( )
123
- => serverGame . CloseServer ( ) ;
134
+ => serverGame ? . CloseServer ( ) ;
124
135
125
136
public void Dispose ( )
126
137
{
0 commit comments