您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
35 行
1.0 KiB
35 行
1.0 KiB
using NUnit.Framework;
|
|
using UnityEngine;
|
|
|
|
namespace Unity.Netcode.RuntimeTests
|
|
{
|
|
public class NetworkManagerCustomMessageManagerTests
|
|
{
|
|
[Test]
|
|
public void CustomMessageManagerAssigned()
|
|
{
|
|
var gameObject = new GameObject(nameof(CustomMessageManagerAssigned));
|
|
var networkManager = gameObject.AddComponent<NetworkManager>();
|
|
var transport = gameObject.AddComponent<DummyTransport>();
|
|
|
|
networkManager.NetworkConfig = new NetworkConfig();
|
|
|
|
|
|
|
|
// Set dummy transport that does nothing
|
|
networkManager.NetworkConfig.NetworkTransport = transport;
|
|
|
|
CustomMessagingManager preManager = networkManager.CustomMessagingManager;
|
|
|
|
// Start server to cause initialization
|
|
networkManager.StartServer();
|
|
|
|
Debug.Assert(preManager == null);
|
|
Debug.Assert(networkManager.CustomMessagingManager != null);
|
|
|
|
|
|
networkManager.Shutdown();
|
|
Object.DestroyImmediate(gameObject);
|
|
}
|
|
}
|
|
}
|