mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkIdentityTests: ClearObservers
This commit is contained in:
parent
d9036a6a79
commit
90cece63dc
@ -932,5 +932,27 @@ public void OnNetworkDestroy()
|
||||
// clean up
|
||||
GameObject.DestroyImmediate(gameObject);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClearObservers()
|
||||
{
|
||||
// create a networkidentity
|
||||
GameObject gameObject = new GameObject();
|
||||
NetworkIdentity identity = gameObject.AddComponent<NetworkIdentity>();
|
||||
|
||||
// call OnStartServer so that observers dict is created
|
||||
identity.OnStartServer();
|
||||
|
||||
// add some observers
|
||||
identity.observers[42] = new NetworkConnectionToClient(42);
|
||||
identity.observers[43] = new NetworkConnectionToClient(43);
|
||||
|
||||
// call ClearObservers
|
||||
identity.ClearObservers();
|
||||
Assert.That(identity.observers.Count, Is.EqualTo(0));
|
||||
|
||||
// clean up
|
||||
GameObject.DestroyImmediate(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user