Пример #1
0
        public async Task InitializeAsync()
        {
            FulcrumApplicationHelper.UnitTestSetup(nameof(AzureStorageV12QueueTest));
            var connectionString = TestSettings.ConnectionString;

            Assert.IsNotNull(connectionString);
            _queue = new AzureStorageQueue <Message>(connectionString, "test-queue");
            await _queue.ClearAsync();
        }
Пример #2
0
        public async Task InitializeNonExistingAsync()
        {
            var connectionString = TestSettings.ConnectionStringNonExisting;

            Assert.IsNotNull(connectionString);
            var queue = new AzureStorageQueue <Message>(connectionString, "test-queue", new QueueClientOptions
            {
                Retry = { MaxRetries = 0 }
            });
            await queue.ClearAsync();
        }
Пример #3
0
        public async Task InitializeNonExistingAsync()
        {
            var connectionString = TestSettings.ConnectionStringNonExisting;

            Assert.IsNotNull(connectionString);
            var queue = new AzureStorageQueue <Message>(connectionString, "test-queue", new QueueRequestOptions()
            {
                MaximumExecutionTime = TimeSpan.FromMilliseconds(500)
            });
            await queue.ClearAsync();
        }
Пример #4
0
        public async Task ClearQueueAsync()
        {
            var message = new Message {
                Name = "Message1"
            };
            await _queue.AddMessageAsync(message);

            await _queue.ClearAsync();

            var getTask = _queue.GetOneMessageNoBlockAsync();
            await Task.Delay(TimeSpan.FromMilliseconds(200));

            Assert.IsTrue(getTask.IsCompleted, "Expected the method to finish quickly.");
            Assert.IsNull(await getTask);
        }