Skip to content

Commit 0cf0fce

Browse files
committed
Don't run network test if we don't have the Content folder present
1 parent 32525b5 commit 0cf0fce

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Barotrauma/BarotraumaTest/ClientServer/ClientServerTests.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
extern alias Client;
22
extern alias Server;
33
using System;
4+
using System.IO;
45
using System.Linq;
56
using System.Net;
67
using System.Threading;
@@ -22,7 +23,7 @@ public class ClientServerTests : IDisposable
2223
{
2324
private readonly ITestOutputHelper testOutputHelper;
2425

25-
private readonly GameMain serverGame;
26+
private readonly GameMain? serverGame;
2627
private GameServer? currentServer;
2728
private readonly string generatedPassword;
2829

@@ -32,6 +33,10 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
3233
{
3334
this.testOutputHelper = testOutputHelper;
3435

36+
if (!File.Exists(ContentPackageManager.VanillaFileList))
37+
{
38+
return;
39+
}
3540
serverGame = new GameMain(Array.Empty<string>());
3641
serverGame.Init();
3742
var random = new Random();
@@ -41,6 +46,12 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
4146
[Fact]
4247
public void TestLidgren()
4348
{
49+
if (serverGame == null)
50+
{
51+
testOutputHelper.WriteLine("VanillaFileList not found, skipping test");
52+
return;
53+
}
54+
4455
var server = CreateServer();
4556
var client = CreateClient(server);
4657
Prop.ForAll<byte[]>(data =>
@@ -120,7 +131,7 @@ private void UpdateServer(GameServer server)
120131
}
121132

122133
private void OnTestsFinished()
123-
=> serverGame.CloseServer();
134+
=> serverGame?.CloseServer();
124135

125136
public void Dispose()
126137
{

0 commit comments

Comments
 (0)