/// <summary> /// Sets up an endpoint that follows 2-way outbound communication pattern - /// send a request and expects a response synchronously /// </summary> /// <param name="sender">An expression that returns the address of the send endpoint for this operation</param> /// <returns>The current instance of the <see cref="EndpointsMock{TAddresses}"/> class</returns> public EndpointsMock <TAddresses> SetupSendRequestAndReceiveResponse(Expression <Func <TAddresses, Addressing.TwoWaySendAddress> > sender) { var sendReceiveEndpoint = new TwoWaySendEndpoint(); // Invoke the callback for setting the send endpoint properties as well as the expectation method sendReceiveEndpoint.URL = sender.Compile()(this.mockAddresses).Value; endpointsMap.Add(sendReceiveEndpoint.URL, sendReceiveEndpoint); return(this); }
private void SetupReceiveRequestAndSendResponse(TwoWaySendEndpoint sendReceiveEndpoint) { var receiveSendOperation = new MessageOperationExpectation() { TwoWaySendEndpoint = sendReceiveEndpoint, MockMessageServer = new StreamingNamedPipeServer( new Uri(sendReceiveEndpoint.URL).AbsolutePath) }; receiveSendOperation.MockMessageServer.ReadCompleted += MockMessageServer_ReadCompleted; receiveSendOperation.MockMessageServer.Start(); operationExpectations.Add(sendReceiveEndpoint.URL, receiveSendOperation); }
public TestCasting <TAddresses> SetupReceiveRequestAndSendResponse(Expression <Func <TAddresses, string> > sender) { var sendReceiveEndpoint = new TwoWaySendEndpoint(); // Invoke the callback for setting the send endpoint properties as well as the expectation method sendReceiveEndpoint.URL = sender.Compile()(this.mockAddresses); var sendReceiveOperation = new MessageOperationExpectation() { TwoWaySendEndpoint = sendReceiveEndpoint, MockMessageClient = new StreamingNamedPipeClient(new System.Uri(sendReceiveEndpoint.URL)) }; endpointsMap.Add(sendReceiveEndpoint.URL, sendReceiveOperation); return(this); }