예제 #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!");
            }
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HttpResponseMockContent"/> class.
 /// Contain an empty content.
 /// </summary>
 public HttpResponseMockContent()
 {
     contentType = HttpResponseMock.ResponseContentType.String;
     content     = string.Empty;
 }