/// <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" };
 }
Пример #2
0
 /// <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"
     };
 }
Пример #3
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;
        }
Пример #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);
        }
Пример #5
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;
        }
Пример #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);
        }