Exemplo n.º 1
0
        async Task InvokeActionByName(ActionContext prevActionContext, int invokesCount)
        {
            var max = _mvcOptions.StartAnotherActionMaxStackLevel;

            if (invokesCount > max)
            {
                throw new TelegramAspException($"StartAnotherAction invoked recursive more than {max} times. " +
                                               $"You can change max value in MvcOptions.");
            }

            var startAnotherActionData = MvcFeatures.GetData(prevActionContext);

            if (startAnotherActionData == null)
            {
                return;
            }
            var actName = startAnotherActionData.ActionName;

            var ctx     = prevActionContext.UpdateContext;
            var actDesc = _globalSearchBag.FindByName(actName);

            if (actDesc == null)
            {
                throw new TelegramAspException($"Can't find action with name '{actName}'.");
            }

            var actionContext = _contextPreparer.CreateContext(ctx, actDesc);
            await actDesc.Handler.Invoke(actionContext);

            //Check again.
            await InvokeActionByName(actionContext, invokesCount + 1);
        }
Exemplo n.º 2
0
        public void TestName()
        {
            var rdd = _sb.FindByName("LowPriority");
            var id  = GetHandlerIdentifier(rdd);

            Assert.AreEqual("M_LowPriority", id);
        }