Azi.Amazon.CloudDrive.Tests.AmazonFilesTests.DownloadWithProgressCancelTest C# (CSharp) Method

DownloadWithProgressCancelTest() private method

private DownloadWithProgressCancelTest ( ) : Task
return Task
        public async Task DownloadWithProgressCancelTest()
        {
            var testFileContent = Enumerable.Range(1, 1000).Select(i => (byte)(i & 255)).ToArray();
            var testFile = await Amazon.Files.UploadNew(TestDirId, testFileName, () => new MemoryStream(testFileContent));

            var memStr = new MemoryStream();
            await Assert.ThrowsAsync<OperationCanceledException>(async () =>
                await Amazon.Files.Download(testFile.id, memStr, bufferSize: 10, progress: ProgressCancel));
            Assert.Equal(10, memStr.Position);
        }