Example #1
0
        protected AlexaCoreTestRunner()
        {
            SkillResponse = null;

            _hasRun = false;

            _function = BuildFunction();
        }
        private async Task SendAlexaRequestAsync(HttpRequest req, ILogger logger, IAlexaRequestVerifier alexaVerifier, IAdventureSampleProcessor advSampleProcessor)
        {
            try
            {
                IActionResult res = await AlexaFunction.Run(req, logger, alexaVerifier, advSampleProcessor);

                ProcessActionResult(res);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                throw;
            }
        }
Example #3
0
        public T RunInitialFunction(string intentName, string newSessionId = "", Session session = null, Context context = null, Dictionary <string, Slot> slots = null, Request request = null)
        {
            _function = BuildFunction();

            var lambdaContext = new TestLambdaContext
            {
                Logger = new TestLambdaLogger(),
            };

            if (slots == null)
            {
                slots = new Dictionary <string, Slot>();
            }

            if (request == null)
            {
                request = new IntentRequest {
                    Intent = new Intent {
                        Name = intentName, Slots = slots
                    }
                };
            }

            var response =
                _function.FunctionHandler(
                    new SkillRequest
            {
                Session = session ?? new Session {
                    New = true, SessionId = newSessionId
                },
                Request = request,
                Context = context
            }, lambdaContext);

            SkillResponse = response;

            _hasRun = true;

            return(Convert(this));
        }
Example #4
0
 public virtual void UpdateFunction(AlexaFunction function)
 {
     _function = function;
 }