您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.9 KiB
46 行
1.9 KiB
using System;
|
|
using System.Collections;
|
|
using NUnit.Framework;
|
|
using Unity.Multiplayer.Samples.Utilities;
|
|
using Unity.Netcode;
|
|
using UnityEditor;
|
|
using UnityEditor.TestTools;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.TestTools;
|
|
|
|
namespace Unity.Multiplayer.Samples.BossRoom.Tests.Runtime
|
|
{
|
|
[ConditionalIgnore(DedicatedServerTestUtilities.ServerOnly, "Ignored on Client.")]
|
|
public class DedicatedServerFullFlowTest
|
|
{
|
|
[UnityTest]
|
|
public IEnumerator TestStartToLobbyFlow()
|
|
{
|
|
SceneManager.LoadSceneAsync(SceneNames.Startup);
|
|
|
|
// validate the loading of project's Bootstrap scene
|
|
yield return new TestUtilities.WaitForSceneLoad(SceneNames.Startup);
|
|
|
|
// MainMenu is loaded as soon as Startup scene is launched, validate it is loaded
|
|
yield return new TestUtilities.WaitForSceneLoad(SceneNames.DedicatedServerLobbyManagement);
|
|
|
|
// MainMenu is loaded as soon as Startup scene is launched, validate it is loaded
|
|
yield return new TestUtilities.WaitForSceneLoad(SceneNames.CharSelect);
|
|
|
|
// Trying to simulate a client connecting would involve stubbing pretty much all of boss room... not gonna do that, this test setup stops here
|
|
// We can still do basic tests, seeing if dedicated server can at least be started automatically with no errors
|
|
|
|
Assert.That(NetworkManager.Singleton.IsListening);
|
|
Assert.That(NetworkManager.Singleton.IsServer);
|
|
Assert.False(NetworkManager.Singleton.IsClient);
|
|
}
|
|
|
|
[UnityTearDown]
|
|
public IEnumerator DestroySceneGameObjects()
|
|
{
|
|
SceneManager.LoadScene("EmptyScene", LoadSceneMode.Single);
|
|
yield return new TestUtilities.WaitForSceneLoad("EmptyScene");
|
|
}
|
|
}
|
|
}
|