public void SubscriberIsAdded() { var manager = new GameEventsManager(); int testVal = 0; Action <TestEvent> listener = evt => testVal = evt.value; manager.Subscribe(listener); manager.Invoke(new TestEvent(10)); Assert.IsTrue(testVal == 10); }
public void MultipleSubscribersAreAdded() { var manager = new GameEventsManager(); int testVal = 0; Action <TestEvent> l1 = evt => testVal += evt.value; Action <TestEvent> l2 = evt => testVal += evt.value; manager.Subscribe(l1); manager.Subscribe(l2); manager.Invoke(new TestEvent(10)); Assert.IsTrue(testVal == 20); }
public void Invoke(GameEvent gameEvent) { _gameEventsManager.Invoke(gameEvent); }