/// <summary>
 /// Initializes a new instance of the <see cref="FakeResponseContainer"/> class.
 /// </summary>
 public FakeResponseContainer()
 {
     ResponseMessage = new FakeResponseMessage();
     ResponseMessage.ReasonPhrase = "OK";
     ResponseMessage.StatusCode = System.Net.HttpStatusCode.OK;
     ResponseMessage.ResponseHeaders["Status"] = new List<string> { "200 OK" };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FakeResponseContainer"/> class.
 /// </summary>
 public FakeResponseContainer()
 {
     ResponseMessage = new FakeResponseMessage();
     ResponseMessage.ReasonPhrase = "OK";
     ResponseMessage.StatusCode   = System.Net.HttpStatusCode.OK;
     ResponseMessage.ResponseHeaders["Status"] = new List <string> {
         "200 OK"
     };
 }
        /// <summary>
        /// Converts the specified HTTP response to a fake response message.
        /// </summary>
        /// <param name="httpResponse">The HTTP response to convert.</param>
        /// <returns>A fake response messages.</returns>
        protected virtual FakeResponseMessage Convert(HttpResponseMessage httpResponse)
        {
            var response = new FakeResponseMessage();
            response.ReasonPhrase = httpResponse.ReasonPhrase;
            response.StatusCode = httpResponse.StatusCode;
            response.ResponseHeaders = httpResponse.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); ;
            response.ContentHeaders = httpResponse.Content.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); ;

            return response;
        }
Beispiel #4
0
        /// <summary>
        /// Converts the specified HTTP response to a fake response message.
        /// </summary>
        /// <param name="httpResponse">The HTTP response to convert.</param>
        /// <returns>A fake response messages.</returns>
        protected virtual FakeResponseMessage Convert(HttpResponseMessage httpResponse)
        {
            var response = new FakeResponseMessage();

            response.ReasonPhrase    = httpResponse.ReasonPhrase;
            response.StatusCode      = httpResponse.StatusCode;
            response.ResponseHeaders = httpResponse.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);;
            response.ContentHeaders  = httpResponse.Content.Headers.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);;

            return(response);
        }
        /// <summary>
        /// Converts the specified fake response to an HTTP response message.
        /// </summary>
        /// <param name="fakeResponse">The fake response to convert.</param>
        /// <returns>An HTTP response message.</returns>
        protected virtual HttpResponseMessage Convert(FakeResponseMessage fakeResponse)
        {
            var response = new HttpResponseMessage();
            response.ReasonPhrase = fakeResponse.ReasonPhrase;
            response.StatusCode = fakeResponse.StatusCode;

            foreach (var header in fakeResponse.ResponseHeaders)
                response.Headers.Add(header.Key, header.Value);

            return response;
        }
Beispiel #6
0
        /// <summary>
        /// Converts the specified fake response to an HTTP response message.
        /// </summary>
        /// <param name="fakeResponse">The fake response to convert.</param>
        /// <returns>An HTTP response message.</returns>
        protected virtual HttpResponseMessage Convert(FakeResponseMessage fakeResponse)
        {
            var response = new HttpResponseMessage();

            response.ReasonPhrase = fakeResponse.ReasonPhrase;
            response.StatusCode   = fakeResponse.StatusCode;

            foreach (var header in fakeResponse.ResponseHeaders)
            {
                response.Headers.Add(header.Key, header.Value);
            }

            return(response);
        }