Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }