Don't run network test if we don't have the Content folder present
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
extern alias Client;
|
extern alias Client;
|
||||||
extern alias Server;
|
extern alias Server;
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -22,7 +23,7 @@ public class ClientServerTests : IDisposable
|
|||||||
{
|
{
|
||||||
private readonly ITestOutputHelper testOutputHelper;
|
private readonly ITestOutputHelper testOutputHelper;
|
||||||
|
|
||||||
private readonly GameMain serverGame;
|
private readonly GameMain? serverGame;
|
||||||
private GameServer? currentServer;
|
private GameServer? currentServer;
|
||||||
private readonly string generatedPassword;
|
private readonly string generatedPassword;
|
||||||
|
|
||||||
@@ -32,6 +33,10 @@ public class ClientServerTests : IDisposable
|
|||||||
{
|
{
|
||||||
this.testOutputHelper = testOutputHelper;
|
this.testOutputHelper = testOutputHelper;
|
||||||
|
|
||||||
|
if (!File.Exists(ContentPackageManager.VanillaFileList))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
serverGame = new GameMain(Array.Empty<string>());
|
serverGame = new GameMain(Array.Empty<string>());
|
||||||
serverGame.Init();
|
serverGame.Init();
|
||||||
var random = new Random();
|
var random = new Random();
|
||||||
@@ -41,6 +46,12 @@ public class ClientServerTests : IDisposable
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void TestLidgren()
|
public void TestLidgren()
|
||||||
{
|
{
|
||||||
|
if (serverGame == null)
|
||||||
|
{
|
||||||
|
testOutputHelper.WriteLine("VanillaFileList not found, skipping test");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var server = CreateServer();
|
var server = CreateServer();
|
||||||
var client = CreateClient(server);
|
var client = CreateClient(server);
|
||||||
Prop.ForAll<byte[]>(data =>
|
Prop.ForAll<byte[]>(data =>
|
||||||
@@ -120,7 +131,7 @@ public class ClientServerTests : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnTestsFinished()
|
private void OnTestsFinished()
|
||||||
=> serverGame.CloseServer();
|
=> serverGame?.CloseServer();
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user