NetworkIdentityTests HandleEvent tests invalid component index / function hash too

This commit is contained in:
vis2k 2020-03-03 13:19:09 +01:00
parent bbcc3599ef
commit 4bc1c3eb20

View File

@ -1314,6 +1314,18 @@ public void HandleSyncEvent()
identity.HandleSyncEvent(componentIndex, functionHash, payload);
Assert.That(comp0.called, Is.EqualTo(1));
// try wrong component index. syncevent shouldn't be called again.
LogAssert.ignoreFailingMessages = true; // warning is expected
identity.HandleSyncEvent(1, functionHash, payload);
LogAssert.ignoreFailingMessages = false;
Assert.That(comp0.called, Is.EqualTo(1));
// try wrong function hash. syncevent shouldn't be called again.
LogAssert.ignoreFailingMessages = true; // warning is expected
identity.HandleSyncEvent(0, functionHash+1, payload);
LogAssert.ignoreFailingMessages = false;
Assert.That(comp0.called, Is.EqualTo(1));
// clean up
NetworkIdentity.spawned.Clear();
NetworkBehaviour.ClearDelegates();