Beispiel #1
0
        private void SetupSendRequestAndReceiveResponse(TwoWayReceiveEndpoint receiveSendEndpoint)
        {
            var sendReceiveOperation = new MessageOperationExpectation()
            {
                TwoWayReceiveEndpoint = receiveSendEndpoint,
                MockMessageClient     = new StreamingNamedPipeClient(new System.Uri(receiveSendEndpoint.URL))
            };

            operationExpectations.Add(receiveSendEndpoint.URL, sendReceiveOperation);
        }
Beispiel #2
0
        /// <summary>
        /// Sets up a mock for a 2-way receive operation where a request is received and a response is supplied back.
        /// </summary>
        /// <param name="receiver">An expression that returns the address of the 2-way receive endpoint</param>
        /// <returns>The current instance of the <see cref="EndpointsMock{TAddresses}"/> class</returns>
        public EndpointsMock <TAddresses> SetupReceiveRequestAndSendResponse(Expression <Func <TAddresses, Addressing.TwoWayReceiveAddress> > receiver)
        {
            var receiveSendEndpoint = new TwoWayReceiveEndpoint();

            // Invoke the callback for setting the send endpoint properties as well as the expectation method
            receiveSendEndpoint.URL = receiver.Compile()(this.mockAddresses).Value;

            endpointsMap.Add(receiveSendEndpoint.URL, receiveSendEndpoint);

            return(this);
        }
Beispiel #3
0
        public TestCasting <TAddresses> SetupSendRequestAndReceiveResponse(Expression <Func <TAddresses, string> > receiver)
        {
            var receiveSendEndpoint = new TwoWayReceiveEndpoint();

            // Invoke the callback for setting the send endpoint properties as well as the expectation method
            receiveSendEndpoint.URL = receiver.Compile()(this.mockAddresses);

            var receiveSendOperation = new MessageOperationExpectation()
            {
                TwoWayReceiveEndpoint = receiveSendEndpoint,
                MockMessageServer     = new StreamingNamedPipeServer(
                    new Uri(receiveSendEndpoint.URL).AbsolutePath)
            };

            receiveSendOperation.MockMessageServer.ReadCompleted += MockMessageServer_ReadCompleted;
            receiveSendOperation.MockMessageServer.Start();

            endpointsMap.Add(receiveSendEndpoint.URL, receiveSendOperation);

            return(this);
        }