public void ShouldReceiveDelegateOnDifferentThreadIfThreadAffinity()
        {
            int calledThreadId = -1;
            string calledThreadName = string.Empty;
            ManualResetEvent completeEvent = new ManualResetEvent(false);
            Action<object> action = delegate
            {
                calledThreadId = Thread.CurrentThread.ManagedThreadId;
                calledThreadName = Thread.CurrentThread.Name;
                completeEvent.Set();
            };

            IDelegateReference actionDelegateReference = new MockDelegateReference() { Target = action };
            IDelegateReference filterDelegateReference = new MockDelegateReference() { Target = (Predicate<object>)delegate { return true; } };
            SynchronizationContextMock mockSyncContext = new SynchronizationContextMock();
            var eventSubscription = new CompositeEventSubscription<object>(actionDelegateReference, filterDelegateReference, mockSyncContext);

            var publishAction = eventSubscription.GetExecutionStrategy();

            Assert.IsNotNull(publishAction);

            publishAction.Invoke(null);

            completeEvent.WaitOne(5000, false);
            Assert.AreNotEqual(Thread.CurrentThread.ManagedThreadId, calledThreadId);
            Assert.AreEqual("SynchronizationContextMockThread", calledThreadName);
        }
            internal WorkerThread(string name, SynchronizationContextMock context)
            {
                m_Context = context;

                m_EndLoop = false;

                m_ThreadObj = new Thread(Run);
                m_ThreadObj.IsBackground = true;
                m_ThreadObj.Name = name;
                m_ThreadObj.Start();
            }