public void OnCheckObserverTrue() { // create a networkidentity with a component that returns true // result should still be true. var gameObjectTrue = new GameObject(); NetworkIdentity identityTrue = gameObjectTrue.AddComponent <NetworkIdentity>(); CheckObserverTrueNetworkBehaviour compTrue = gameObjectTrue.AddComponent <CheckObserverTrueNetworkBehaviour>(); Assert.That(identityTrue.OnCheckObserver(player1), Is.True); Assert.That(compTrue.called, Is.EqualTo(1)); }
public void OnCheckObserverCatchesException() { // add component gameObject.AddComponent <CheckObserverExceptionNetworkBehaviour>(); // should catch the exception internally and not throw it Assert.Throws <Exception>(() => { identity.OnCheckObserver(player1); }); }
public void OnCheckObserverFalse() { // create a networkidentity with a component that returns true and // one component that returns false. // result should still be false if any one returns false. var gameObjectFalse = new GameObject(); NetworkIdentity identityFalse = gameObjectFalse.AddComponent <NetworkIdentity>(); CheckObserverFalseNetworkBehaviour compFalse = gameObjectFalse.AddComponent <CheckObserverFalseNetworkBehaviour>(); Assert.That(identityFalse.OnCheckObserver(player1), Is.False); Assert.That(compFalse.called, Is.EqualTo(1)); }