public async Task SetSyncEventHandler(bool nullContents)
        {
            // Setup: Create a mock request handler
            var eventHandler = new Mock <Action <CommonObjects.TestMessageContents, EventContext> >();
            var message      = nullContents
                ? Message.CreateEvent(CommonObjects.EventType, null)
                : CommonObjects.EventMessage;

            // If: I assign an event handler on the JSON RPC host
            var jh = new JsonRpcHost(GetChannelBase(null, null).Object);

            jh.SetEventHandler(CommonObjects.EventType, eventHandler.Object);

            // Then: It should be the only event handler set
            Assert.Single(jh.eventHandlers);
            Assert.Contains(CommonObjects.EventType.MethodName, jh.eventHandlers.Keys);

            // If: I call the stored event handler
            await jh.eventHandlers[CommonObjects.EventType.MethodName](message);
            await jh.eventHandlers[CommonObjects.EventType.MethodName](message);

            // Then: The event handler should have been called with the params and a proper event context
            var expectedContents = nullContents
                ? null
                : CommonObjects.TestMessageContents.DefaultInstance;

            eventHandler.Verify(a => a(
                                    It.Is <CommonObjects.TestMessageContents>(p => p == expectedContents),
                                    It.Is <EventContext>(p => p.messageQueue == jh.outputQueue)
                                    ), Times.Exactly(2));
        }
        public void SetSyncEventHandlerNull()
        {
            // If: I assign an event handler on the message gispatcher with a null event handler
            var jh = new JsonRpcHost(GetChannelBase(null, null).Object);

            Assert.Throws <ArgumentNullException>(() => jh.SetEventHandler(CommonObjects.EventType, null));
        }