NetworkBehaviourTests: SyncVarNetworkIdentityEqualValidIdentityWithDifferentNetId

This commit is contained in:
vis2k 2020-03-07 14:54:41 +01:00
parent c9a3a0dceb
commit 1408e8de42

View File

@ -823,6 +823,24 @@ public void SyncVarNetworkIdentityEqualNull()
bool result = emptyBehaviour.SyncVarNetworkIdentityEqual(null, identity.netId);
Assert.That(result, Is.False);
}
// NOTE: SyncVarNetworkIdentityEqual should be static later
[Test]
public void SyncVarNetworkIdentityEqualValidIdentityWithDifferentNetId()
{
// our identity should have a netid for comparing
identity.netId = 42;
// gameobject with valid networkidentity and netid that is different
GameObject go = new GameObject();
NetworkIdentity ni = go.AddComponent<NetworkIdentity>();
ni.netId = 43;
bool result = emptyBehaviour.SyncVarNetworkIdentityEqual(ni, identity.netId);
Assert.That(result, Is.False);
// clean up
GameObject.DestroyImmediate(go);
}
}
// we need to inherit from networkbehaviour to test protected functions