public void ShouldBeAbleToUnicastAMessageAndReceiveAResponse() { var sampleClusterConfiguration = BuildSampleClusterConfiguration(); // Start a test server to listen for requests SampleResponse serverResponse = new SampleResponse("test response"); var testServer = new TestServer(sampleClusterConfiguration.Nodes[0], serverResponse); testServer.Start(); var sut = new NetMqRpcChannel(sampleClusterConfiguration, TimeSpan.FromMilliseconds(200)); var sampleRequest = new SampleRequest("test"); var responseReturned = sut.Unicast<SampleRequest, SampleResponse>(sampleClusterConfiguration.Nodes[0].Id, sampleRequest); Assert.IsNotNull(responseReturned); Assert.AreEqual(serverResponse, responseReturned); Assert.AreEqual(sampleRequest, testServer.GetLastReceivedMessageObject<SampleRequest>()); }
private static TestServer SetupTestServerForNode(NodeAddress serverNode) { SampleResponse serverResponse = new SampleResponse(serverNode.Id.ToString()); var testServer = new TestServer(serverNode, serverResponse); return testServer; }