Exemplo n.º 1
0
        public async Task StreamToStringAsync_ReturnsNullWhenStreamIsNull()
        {
            HttpClient     httpClient     = new HttpClient();
            HttpClientBase httpClientBase = new HttpClientBase(httpClient, loggerMock.Object);

            var result = await httpClientBase.StreamToStringAsync(null);

            result.Should().BeNull();
        }
Exemplo n.º 2
0
        public async Task StreamToStringAsync_ReturnsValueWhenStreamHasValue()
        {
            HttpClient     httpClient     = new HttpClient();
            HttpClientBase httpClientBase = new HttpClientBase(httpClient, loggerMock.Object);

            using (MemoryStream ms = new MemoryStream(System.Text.Encoding.UTF8.GetBytes("some value")))
            {
                var result = await httpClientBase.StreamToStringAsync(ms);

                result.Should().BeEquivalentTo("some value");
            }
        }