public void TestVoidCallOfInterface() { var instance = new Mock <IDebuggerService>(); instance.Setup(i => i.Execute(It.IsAny <int>())); var dispatcher = new MethodsDispatcher <IDebuggerService>(); dispatcher.Dispatch(instance.Object, "Execute", new object[] { 1 }); instance.Verify(i => i.Execute(1), Times.Once); instance.VerifyNoOtherCalls(); }
public void TestFunctionCallOfInterface() { var instance = new Mock <IDebuggerService>(); instance.Setup(i => i.GetThreads()).Returns(new [] { 1, 2, 3 }); var dispatcher = new MethodsDispatcher <IDebuggerService>(); var result = dispatcher.Dispatch(instance.Object, "GetThreads", new object[0]); instance.Verify(i => i.GetThreads(), Times.Once); instance.VerifyNoOtherCalls(); Assert.That(result, Has.Length.EqualTo(3)); }
private void ProcessSuccess(RpcCall message, ICommunicationChannel responseChannel) { RpcCallResult callResult = null; try { var methodResult = _requestProcessor.Dispatch(_requestService, message.Id, message.Parameters); if (methodResult != null) { callResult = RpcCallResult.Respond(message, methodResult); } } catch (Exception e) { callResult = RpcCallResult.Exception(message, e); } if (callResult != null) { responseChannel.Write(callResult); } }