Exemplo n.º 1
0
        void InvokeCompatibleCallbacks(FakeBusEvent fakeBusEvent)
        {
            foreach (var callback in _callbacks)
            {
                var compatibleHandlerType = typeof(Action <>).MakeGenericType(fakeBusEvent.GetType());

                if (!compatibleHandlerType.IsInstanceOfType(callback))
                {
                    continue;
                }

                try
                {
                    callback.DynamicInvoke(fakeBusEvent);
                }
                catch (Exception exception)
                {
                    throw new TargetInvocationException($"Error invoking callback for fake bus event {fakeBusEvent}", exception);
                }
            }
        }
Exemplo n.º 2
0
        public void Record(FakeBusEvent fakeBusEvent)
        {
            AddFakeBusEvent(fakeBusEvent);

            InvokeCompatibleCallbacks(fakeBusEvent);
        }
Exemplo n.º 3
0
 void AddFakeBusEvent(FakeBusEvent fakeBusEvent)
 {
     _events.Enqueue(fakeBusEvent);
 }
Exemplo n.º 4
0
 void Record(FakeBusEvent fakeBusEvent)
 {
     _recorder.Record(fakeBusEvent);
 }