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>(); var connection = new NetworkConnection(tconn42); Assert.That(identityTrue.OnCheckObserver(connection), Is.True); Assert.That(compTrue.called, Is.EqualTo(1)); }
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>(); var connection = new NetworkConnection(tconn42); Assert.That(identityFalse.OnCheckObserver(connection), Is.False); Assert.That(compFalse.called, Is.EqualTo(1)); }
public void OnCheckObserverCatchesException() { // add component gameObject.AddComponent <CheckObserverExceptionNetworkBehaviour>(); var connection = new NetworkConnection(tconn42); // should catch the exception internally and not throw it Assert.Throws <Exception>(() => { identity.OnCheckObserver(connection); }); }