Esempio n. 1
0
        public async Task SetDuplicateQueueFailedTestsApi()
        {
            IEnumerable <QueueDetailContractV1> rows;
            var context = _workContext.WithTag(_tag);

            rows = (await _client.Management.GetQueueList(context)).Value.Items;
            rows.Should().NotBeNull();
            rows.Count().Should().Be(0);

            const string queueName = "test-queue";
            var          request   = new SetQueueContractV1
            {
                QueueName         = queueName,
                CurrentSizeLimit  = 10,
                CurrentRetryLimit = 11,
                LockValidForSec   = 12,
            };

            await _client.Management.SetQueue(context, request);

            QueueDetailContractV1 result = (await _client.Management.GetQueue(context, queueName)).Value;

            result.Should().NotBeNull();
            result.QueueName.Should().Be(queueName);

            rows = (await _client.Management.GetQueueList(context)).Value.Items;
            rows.Should().NotBeNull();
            rows.Count().Should().Be(1);

            await _client.Management.SetQueue(context, request);

            rows = (await _client.Management.GetQueueList(context)).Value.Items;
            rows.Should().NotBeNull();
            rows.Count().Should().Be(1);

            await _client.Management.DeleteQueue(context, queueName);

            rows = (await _client.Management.GetQueueList(context)).Value.Items;
            rows.Should().NotBeNull();
            rows.Count().Should().Be(0);

            await Verify.AssertExceptionAsync <RestNotFoundException>(async() => await _client.Management.GetQueue(context, queueName));
        }
Esempio n. 2
0
        public async Task <QueueDetailContractV1> VerifyQueue(IWorkContext context, string queueName, int queueLength, int scheduleQueueLength)
        {
            IEnumerable <QueueDetailContractV1> list = (await _client.Management.GetQueueList(context)).Value.Items;

            list.Should().NotBeNull();
            list.Count().Should().BeGreaterOrEqualTo(1);

            QueueDetailContractV1 queueItem = list.First(x => x.QueueName == queueName);

            queueItem.QueueName.Should().Be(queueName);
            queueItem.QueueLength.Should().NotHaveValue();

            QueueDetailContractV1 queueDetail = (await _client.Management.GetQueue(context, queueName)).Value;

            queueDetail.Should().NotBeNull();
            queueDetail.QueueName.Should().Be(queueName);
            queueDetail.QueueLength.Should().HaveValue();
            queueDetail.QueueLength.Should().Be(queueLength);
            queueDetail.ScheduleQueueLength.Should().HaveValue();
            queueDetail.ScheduleQueueLength.Should().Be(scheduleQueueLength);

            return(queueDetail);
        }
Esempio n. 3
0
        public async Task SetQueueSuccessTestsApi()
        {
            var context = _workContext.WithTag(_tag);

            const string queueName = "test-queue";

            await Verify.AssertExceptionAsync <RestNotFoundException>(async() => await _client.Management.GetQueue(context, queueName));

            RestResponse <QueueDetailContractV1> check = await _client.Management.GetQueue(context, queueName, new HttpStatusCode[] { HttpStatusCode.NotFound });

            check.StatusCode.Should().Be(HttpStatusCode.NotFound);

            var request = new SetQueueContractV1
            {
                QueueName         = queueName,
                CurrentSizeLimit  = 10,
                CurrentRetryLimit = 11,
                LockValidForSec   = 12,
            };

            await _client.Management.SetQueue(context, request);

            QueueDetailContractV1 result = (await _client.Management.GetQueue(context, queueName)).Value;

            result.Should().NotBeNull();
            result.QueueName.Should().Be(queueName);
            result.CurrentSizeLimit.Should().Be(10);
            result.CurrentRetryLimit.Should().Be(11);
            result.LockValidForSec.Should().Be(12);
            result.Disable.Should().BeFalse();
            result.QueueLength.Should().Be(0);

            await _client.Management.DeleteQueue(context, queueName);

            await Verify.AssertExceptionAsync <RestNotFoundException>(async() => await _client.Management.GetQueue(context, queueName));
        }