NetworkBehaviourTests: GetSyncVarNetworkIdentityOnClientNull

This commit is contained in:
vis2k 2020-03-07 18:57:06 +01:00
parent 29035aaa7e
commit 258d3bed02

View File

@ -1366,6 +1366,26 @@ public void GetSyncVarNetworkIdentityOnClient()
Transport.activeTransport = null;
GameObject.DestroyImmediate(go);
}
[Test]
public void GetSyncVarNetworkIdentityOnClientNull()
{
// are we on client and not on server?
identity.isClient = true;
Assert.That(identity.isServer, Is.False);
// add test component
NetworkBehaviourGetSyncVarNetworkIdentityComponent comp = gameObject.AddComponent<NetworkBehaviourGetSyncVarNetworkIdentityComponent>();
comp.syncInterval = 0; // for isDirty check
// get it on the client. null should be supported.
NetworkIdentity result = comp.GetSyncVarNetworkIdentityExposed();
Assert.That(result, Is.Null);
// clean up
NetworkServer.Shutdown();
Transport.activeTransport = null;
}
}
// we need to inherit from networkbehaviour to test protected functions