mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkBehaviourTests: OnStartClient
This commit is contained in:
parent
ad0788fb95
commit
d48ab55ede
@ -179,6 +179,16 @@ public override void OnNetworkDestroy()
|
||||
}
|
||||
}
|
||||
|
||||
// we need to inherit from networkbehaviour to test protected functions
|
||||
public class OnStartClientComponent : NetworkBehaviour
|
||||
{
|
||||
public int called;
|
||||
public override void OnStartClient()
|
||||
{
|
||||
++called;
|
||||
}
|
||||
}
|
||||
|
||||
public class NetworkBehaviourTests
|
||||
{
|
||||
GameObject gameObject;
|
||||
@ -1548,6 +1558,20 @@ public void OnNetworkDestroy()
|
||||
// should have been forwarded to behaviours
|
||||
Assert.That(comp.called, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnStartClient()
|
||||
{
|
||||
// add test component
|
||||
OnStartClientComponent comp = gameObject.AddComponent<OnStartClientComponent>();
|
||||
Assert.That(comp.called, Is.EqualTo(0));
|
||||
|
||||
// call identity OnNetworkDestroy
|
||||
identity.OnStartClient();
|
||||
|
||||
// should have been forwarded to behaviours
|
||||
Assert.That(comp.called, Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
|
||||
// we need to inherit from networkbehaviour to test protected functions
|
||||
|
Loading…
Reference in New Issue
Block a user