public async Task <string> AsByteArray_OfModel(string content)
        {
            // arrange
            IResponse response = this.ConstructResponse(new Model <string>(content));

            // act
            byte[] actual = await response
                            .AsByteArray()
                            .VerifyTaskResultAsync();

            // assert
            Assert.That(actual, Is.Not.Null.Or.Empty, "byte array");
            return(Encoding.UTF8.GetString(actual));
        }
예제 #2
0
        public string AsByteArray(string content)
        {
            // arrange
            IResponse response = this.ConstructResponse(content);

            // act
            byte[] actual = response
                            .AsByteArray()
                            .VerifyTaskResult();

            // assert
            Assert.That(actual, Is.Not.Null.Or.Empty, "byte array");
            return(Encoding.UTF8.GetString(actual));
        }
예제 #3
0
        /// <summary>Asynchronously retrieve the response body as an array of <see cref="byte"/>.</summary>
        /// <returns>Returns the response body, or <c>null</c> if the response has no body.</returns>
        /// <exception cref="ApiException">An error occurred processing the response.</exception>
        public async Task <byte[]> AsByteArray()
        {
            IResponse response = await this.AsResponse().ConfigureAwait(false);

            return(await response.AsByteArray().ConfigureAwait(false));
        }