ClientSceneTests: reuse CreateNetworked

This commit is contained in:
vis2k 2021-05-23 23:35:42 +08:00
parent 0a28072f26
commit 77e8f1d7e4

View File

@ -70,9 +70,8 @@ public override void TearDown()
[Test]
public void FindOrSpawnObject_FindExistingObject()
{
CreateNetworked(out GameObject go, out NetworkIdentity existing);
const uint netId = 1000;
GameObject go = new GameObject();
NetworkIdentity existing = go.AddComponent<NetworkIdentity>();
existing.netId = netId;
spawned.Add(netId, existing);
@ -84,10 +83,6 @@ public void FindOrSpawnObject_FindExistingObject()
Assert.IsTrue(success);
Assert.That(found, Is.EqualTo(existing));
// cleanup
GameObject.DestroyImmediate(found.gameObject);
}
[Test]
@ -700,7 +695,6 @@ public void OnSpawn_SpawnsAndAppliesPayload()
const int netId = 1;
Debug.Assert(spawned.Count == 0, "There should be no spawned objects before test");
Vector3 position = new Vector3(30, 20, 10);
Quaternion rotation = Quaternion.Euler(0, 0, 90);
SpawnMessage msg = new SpawnMessage