public void when_sending_multiple_events_then_calls_all_handlers()
        {
            var processor = new EventProcessor(new SubscriptionReceiver(Settings, Topic, Subscription), new JsonTextSerializer());
            var bus       = new EventBus(new TopicSender(Settings, Topic), new StandardMetadataProvider(), new JsonTextSerializer());

            var fooEvent   = new ManualResetEventSlim();
            var fooHandler = new FooEventHandler(fooEvent);

            var barEvent   = new ManualResetEventSlim();
            var barHandler = new BarEventHandler(barEvent);

            processor.Register(fooHandler);
            processor.Register(barHandler);

            processor.Start();

            try {
                bus.Publish(new IEvent[] { new FooEvent(), new BarEvent() });

                fooEvent.Wait(TimeoutPeriod);
                barEvent.Wait(TimeoutPeriod);

                Assert.True(fooHandler.Called);
                Assert.True(barHandler.Called);
            } finally {
                processor.Stop();
            }
        }
Beispiel #2
0
        public static BarEventHandler GetBarEventHandler()
        {
            const string    TAG      = "Bar";
            BarEventHandler foundCmp = GameObject.FindGameObjectWithTag(TAG).GetComponent <BarEventHandler>();

            INFORM_NOT_FOUND(foundCmp, TAG);

            return(foundCmp);
        }
Beispiel #3
0
        public void Initialize(Color color)
        {
            //Initialize the Events.
            ValueChange += new BarEventHandler(OnValueChange);
            //Calculate the new size of the bar.
            Width = GetTransformedValue(_MaxWidth, _MaxValue, _MinValue, _CurrentValue);

            _FillColor = new Color[(int)(_MaxWidth * _MaxHeight)];
            FillArray(color);
        }