public void RebuildObserversDoesntAddNotReadyConnectionsIfImplemented() { // add a proximity checker // one with a ready connection, one with no ready connection, one with null connection RebuildObserversNetworkBehaviour comp = gameObject.AddComponent <RebuildObserversNetworkBehaviour>(); comp.observer = Substitute.For <INetworkConnection>(); comp.observer.IsReady.Returns(false); // rebuild observers should add all component's ready observers identity.RebuildObservers(true); Assert.That(identity.observers, Is.Empty); }
public void GetNewObservers() { // add components RebuildObserversNetworkBehaviour comp = gameObject.AddComponent <RebuildObserversNetworkBehaviour>(); comp.observer = new NetworkConnection(tconn42); // get new observers var observers = new HashSet <INetworkConnection>(); bool result = identity.GetNewObservers(observers, true); Assert.That(result, Is.True); Assert.That(observers.Count, Is.EqualTo(1)); Assert.That(observers.Contains(comp.observer), Is.True); }