예제 #1
0
        public async Task UploadProvidesCorrectCount()
        {
            string bucketname = "uploadqueuetest";

            await ((UploadQueueService)_uploadQueueService).ClearAllPendingUploadsAsync();

            await _bucketService.CreateBucketAsync(bucketname);
            await _bucketService.GetBucketAsync(bucketname);
            byte[] bytesToUpload1 = GetRandomBytes(524288);

            Assert.AreEqual(0, await _uploadQueueService.GetOpenUploadCountAsync());

            await _uploadQueueService.AddObjectToUploadQueueAsync(bucketname, "mycountedqueuefile1.txt", _access.Serialize(), bytesToUpload1, "file1");

            Assert.AreEqual(1, await _uploadQueueService.GetOpenUploadCountAsync());

            _uploadQueueService.ProcessQueueInBackground();

            while (_uploadQueueService.UploadInProgress)
            {
                Assert.AreEqual(1, await _uploadQueueService.GetOpenUploadCountAsync());
                await Task.Delay(100);
            }

            _uploadQueueService.StopQueueInBackground();

            Assert.AreEqual(0, await _uploadQueueService.GetOpenUploadCountAsync());
        }
 public async Task RefreshAsync()
 {
     _currentQueueCount = await _uploadQueueService.GetOpenUploadCountAsync();
 }