mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Fixing runtime tests (#1833)
* adding assetId to prefab * making sure NetworkManager is shutdown * removing host set up for test that doesn't need it * using OneTimeTearDown * fixing performance test
This commit is contained in:
parent
2b5ad08260
commit
a700d7afc3
@ -13,7 +13,9 @@ class NetworkManagerTest : NetworkManager
|
|||||||
public override void Awake()
|
public override void Awake()
|
||||||
{
|
{
|
||||||
transport = gameObject.AddComponent<MemoryTransport>();
|
transport = gameObject.AddComponent<MemoryTransport>();
|
||||||
playerPrefab = new GameObject("testPlayerPrefab", typeof(NetworkIdentity));
|
playerPrefab = new GameObject();
|
||||||
|
NetworkIdentity identity = playerPrefab.AddComponent<NetworkIdentity>();
|
||||||
|
identity.assetId = System.Guid.NewGuid();
|
||||||
base.Awake();
|
base.Awake();
|
||||||
}
|
}
|
||||||
public override void OnDestroy()
|
public override void OnDestroy()
|
||||||
@ -45,6 +47,16 @@ IEnumerator Disconnect()
|
|||||||
yield return null;
|
yield return null;
|
||||||
GameObject.Destroy(manager.gameObject);
|
GameObject.Destroy(manager.gameObject);
|
||||||
}
|
}
|
||||||
|
[OneTimeTearDown]
|
||||||
|
public void OneTimeTearDown()
|
||||||
|
{
|
||||||
|
if (NetworkManager.singleton != null)
|
||||||
|
{
|
||||||
|
GameObject go = NetworkManager.singleton.gameObject;
|
||||||
|
NetworkManager.Shutdown();
|
||||||
|
GameObject.DestroyImmediate(go);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[UnityTest]
|
||||||
public IEnumerator ConnectAndDisconnectWorks()
|
public IEnumerator ConnectAndDisconnectWorks()
|
||||||
|
@ -24,6 +24,7 @@ public IEnumerator SetupHost()
|
|||||||
|
|
||||||
playerGO = new GameObject();
|
playerGO = new GameObject();
|
||||||
identity = playerGO.AddComponent<NetworkIdentity>();
|
identity = playerGO.AddComponent<NetworkIdentity>();
|
||||||
|
identity.assetId = System.Guid.NewGuid();
|
||||||
|
|
||||||
manager.playerPrefab = playerGO;
|
manager.playerPrefab = playerGO;
|
||||||
manager.startOnHeadless = false;
|
manager.startOnHeadless = false;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
namespace Mirror.Tests.Runtime
|
namespace Mirror.Tests.Runtime
|
||||||
{
|
{
|
||||||
public class NetworkManagerTests : HostSetup
|
public class NetworkManagerTests
|
||||||
{
|
{
|
||||||
Scene activeScene;
|
Scene activeScene;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user