Skip to content

Commit

Permalink
Don't run network test if we don't have the Content folder present
Browse files Browse the repository at this point in the history
  • Loading branch information
evilfactory committed Oct 22, 2024
1 parent 32525b5 commit 0cf0fce
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Barotrauma/BarotraumaTest/ClientServer/ClientServerTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extern alias Client;
extern alias Server;
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
Expand All @@ -22,7 +23,7 @@ public class ClientServerTests : IDisposable
{
private readonly ITestOutputHelper testOutputHelper;

private readonly GameMain serverGame;
private readonly GameMain? serverGame;
private GameServer? currentServer;
private readonly string generatedPassword;

Expand All @@ -32,6 +33,10 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
{
this.testOutputHelper = testOutputHelper;

if (!File.Exists(ContentPackageManager.VanillaFileList))
{
return;
}
serverGame = new GameMain(Array.Empty<string>());
serverGame.Init();
var random = new Random();
Expand All @@ -41,6 +46,12 @@ public ClientServerTests(ITestOutputHelper testOutputHelper)
[Fact]
public void TestLidgren()
{
if (serverGame == null)
{
testOutputHelper.WriteLine("VanillaFileList not found, skipping test");
return;
}

var server = CreateServer();
var client = CreateClient(server);
Prop.ForAll<byte[]>(data =>
Expand Down Expand Up @@ -120,7 +131,7 @@ private void UpdateServer(GameServer server)
}

private void OnTestsFinished()
=> serverGame.CloseServer();
=> serverGame?.CloseServer();

public void Dispose()
{
Expand Down

0 comments on commit 0cf0fce

Please sign in to comment.