Ejemplo n.º 1
0
        public async Task If_TryStartOverTheConcurrencyLimit_ThenMarkExecutionAsBlocked()
        {
            // ARRANGE
            var executionHelper = new ExecutionsHelper();

            // ACT
            bool startedOk;
            bool startedOkBlockedExec;
            bool isBlocked;

            using (var executionContext = ClientHelper.GetExecutionContext(TestConstants.TaskName, ClientHelper.GetDefaultTaskConfigurationWithKeepAliveAndReprocessing()))
            {
                startedOk = await executionContext.TryStartAsync();

                using (var executionContextBlocked = ClientHelper.GetExecutionContext(TestConstants.TaskName, ClientHelper.GetDefaultTaskConfigurationWithKeepAliveAndReprocessing()))
                {
                    startedOkBlockedExec = await executionContextBlocked.TryStartAsync();
                }
                isBlocked = executionHelper.GetBlockedStatusOfLastExecution(_taskDefinitionId);
            }

            // ASSERT
            Assert.True(isBlocked);
            Assert.True(startedOk);
            Assert.False(startedOkBlockedExec);
        }