mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServerTest: GetNetworkIdentity
This commit is contained in:
parent
67a2a85cb9
commit
5cdf02b258
@ -821,6 +821,34 @@ public void SendToClientOfPlayer()
|
|||||||
GameObject.DestroyImmediate(identity.gameObject);
|
GameObject.DestroyImmediate(identity.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetNetworkIdentity()
|
||||||
|
{
|
||||||
|
// create a GameObject with NetworkIdentity
|
||||||
|
GameObject go = new GameObject();
|
||||||
|
NetworkIdentity identity = go.AddComponent<NetworkIdentity>();
|
||||||
|
|
||||||
|
// GetNetworkIdentity
|
||||||
|
bool result = NetworkServer.GetNetworkIdentity(go, out NetworkIdentity value);
|
||||||
|
Assert.That(result, Is.True);
|
||||||
|
Assert.That(value, Is.EqualTo(identity));
|
||||||
|
|
||||||
|
// create a GameObject without NetworkIdentity
|
||||||
|
GameObject goWithout = new GameObject();
|
||||||
|
|
||||||
|
// GetNetworkIdentity for GO without identity
|
||||||
|
// (error log is expected)
|
||||||
|
LogAssert.ignoreFailingMessages = true;
|
||||||
|
result = NetworkServer.GetNetworkIdentity(goWithout, out NetworkIdentity valueNull);
|
||||||
|
Assert.That(result, Is.False);
|
||||||
|
Assert.That(valueNull, Is.Null);
|
||||||
|
LogAssert.ignoreFailingMessages = false;
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
GameObject.DestroyImmediate(go);
|
||||||
|
GameObject.DestroyImmediate(goWithout);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ShutdownCleanupTest()
|
public void ShutdownCleanupTest()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user