mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Tests simplified
This commit is contained in:
parent
2328747b33
commit
8b42915429
@ -91,8 +91,11 @@ public void Shutdown_DisablesAllSpawnedPrefabs()
|
||||
// setup
|
||||
NetworkServer.Listen(1);
|
||||
|
||||
NetworkIdentity identity1 = SpawnSceneObject();
|
||||
NetworkIdentity identity2 = SpawnSceneObject();
|
||||
// spawn two scene objects
|
||||
CreateNetworkedAndSpawn(out _, out NetworkIdentity identity1);
|
||||
CreateNetworkedAndSpawn(out _, out NetworkIdentity identity2);
|
||||
identity1.sceneId = (ulong)identity1.GetHashCode();
|
||||
identity2.sceneId = (ulong)identity2.GetHashCode();
|
||||
|
||||
// test
|
||||
NetworkServer.Shutdown();
|
||||
@ -106,15 +109,5 @@ public void Shutdown_DisablesAllSpawnedPrefabs()
|
||||
|
||||
Assert.That(NetworkIdentity.spawned, Is.Empty);
|
||||
}
|
||||
|
||||
NetworkIdentity SpawnSceneObject()
|
||||
{
|
||||
CreateNetworked(out GameObject obj, out NetworkIdentity identity);
|
||||
if (identity.sceneId == 0) { identity.sceneId = (ulong)obj.GetHashCode(); }
|
||||
NetworkServer.Spawn(obj);
|
||||
|
||||
Assert.IsTrue(NetworkIdentity.spawned.ContainsValue(identity));
|
||||
return identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user