From 1408e8de42f6dcf0febb0348af63edcb52c30f64 Mon Sep 17 00:00:00 2001 From: vis2k Date: Sat, 7 Mar 2020 14:54:41 +0100 Subject: [PATCH] NetworkBehaviourTests: SyncVarNetworkIdentityEqualValidIdentityWithDifferentNetId --- .../Tests/Editor/NetworkBehaviourTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs index a3ccbd963..10dde40d3 100644 --- a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs @@ -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(); + 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