public async Task DownloadStream() { var data = new byte[] { 3, 1, 4, 5 }; using (MockHttpServer.ReturnByteArray(x => data)) { var client = HttpApiClient <IDownloadStream> .Create("http://localhost:8844/path"); byte[] result = null; await client.DownloadStream(async x => result = await x.ReadToEndAsync()); Assert.IsTrue(result.SequenceEqual(data)); } }