Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpResponseMockContent"/> class.
        /// </summary>
        /// <param name="httpResponseMock">The mock that provides content.</param>
        public HttpResponseMockContent(HttpResponseMock httpResponseMock)
        {
            contentType = httpResponseMock.ContentType;
            switch (contentType)
            {
            case HttpResponseMock.ResponseContentType.String:
                content = httpResponseMock.Content == null ? string.Empty : httpResponseMock.Content.ToString();
                break;

            case HttpResponseMock.ResponseContentType.ByteArray:
                content = Convert.FromBase64String(httpResponseMock.Content == null ? string.Empty : httpResponseMock.Content.ToString());
                break;

            default:
                throw new NotSupportedException($"{httpResponseMock.ContentType} is not supported yet!");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpResponseMockMessage"/> class.
 /// </summary>
 /// <param name="httpResponseMock">
 /// The mock that provides data.
 /// </param>
 public HttpResponseMockMessage(HttpResponseMock httpResponseMock)
 {
     mock    = httpResponseMock;
     content = new HttpResponseMockContent(mock);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpResponseMockMessage"/> class.
 /// Contain OK(200) status code, an empty reason phrase and an empty content.
 /// </summary>
 public HttpResponseMockMessage()
 {
     mock    = new HttpResponseMock();
     content = new HttpResponseMockContent(mock);
 }