Exemple #1
0
            private FakeResponseHandler PrepareHttpMessageHandler()
            {
                var responseHandler = new FakeResponseHandler();

                responseHandler.AddFakeResponseGenerator(new System.Uri("http://instance1.service1.com/requestPath"), () =>
                {
                    var r     = new HttpResponseMessage(HttpStatusCode.OK);
                    r.Content = new StringContent("Hello world from service1 instance 1");

                    return(r);
                });

                responseHandler.AddFakeResponseGenerator(new System.Uri("http://service2.com/requestPath"), () =>
                {
                    var responseFromService2     = new HttpResponseMessage(HttpStatusCode.OK);
                    responseFromService2.Content = new StringContent(SuccessfulResponseContentFromService2);

                    return(responseFromService2);
                });

                return(responseHandler);
            }