Beispiel #1
0
        public async Task Can_download_async_pdf()
        {
            var client = new ImagingService(BaseUrl);

            var pdfBytes = await client.GetBytesAsync("/sample.pdf");

            "PDF Size: {0} bytes".Print(pdfBytes.Length);

            Assert.That(pdfBytes.Length, Is.EqualTo(BytesSize));
        }
Beispiel #2
0
        public void Can_download_sync_pdf()
        {
            var client = new ImagingService(Constants.ServiceStackBaseHost);

            var pdfBytes = client.GetBytes("/sample.pdf");

            "PDF Size: {0} bytes".Print(pdfBytes.Length);

            Assert.That(pdfBytes.Length, Is.EqualTo(BytesSize));
        }
Beispiel #3
0
        public async Task Can_download_async_pdf()
        {
            var client = new ImagingService(BaseUrl);

            var pdfBytes = await client.GetBytesAsync("/sample.pdf");

            "PDF Size: {0} bytes".Print(pdfBytes.Length);

            Assert.That(pdfBytes.Length, Is.EqualTo(BytesSize));
        }
Beispiel #4
0
        public async Task Load_test_download_async_pdf()
        {
            const int NoOfTimes = 1000;

            var client = new ImagingService(BaseUrl);

            var fetchTasks = new List <Task>();

            for (var i = 0; i < NoOfTimes; i++)
            {
                var asyncResponse = client.GetBytesAsync("/sample.pdf")
                                    .ContinueWith(task =>
                {
                    var pdfBytes = task.Result;
                    "PDF Size: {0} bytes".Print(pdfBytes.Length);
                    Assert.That(pdfBytes.Length, Is.EqualTo(BytesSize));
                });

                fetchTasks.Add(asyncResponse);
            }

            await Task.WhenAll(fetchTasks);
        }
Beispiel #5
0
        public async Task Load_test_download_async_pdf()
        {
            const int NoOfTimes = 1000;

            var client = new ImagingService(BaseUrl);

            var fetchTasks = new List<Task>();

            for (var i = 0; i < NoOfTimes; i++)
            {
                var asyncResponse = client.GetBytesAsync("/sample.pdf")
                .ContinueWith(task =>
                {
                    var pdfBytes = task.Result;
                    "PDF Size: {0} bytes".Print(pdfBytes.Length);
                    Assert.That(pdfBytes.Length, Is.EqualTo(BytesSize));
                });

                fetchTasks.Add(asyncResponse);
            }

            await Task.WhenAll(fetchTasks);
        }