Esempio n. 1
0
        public void HandleRequest_NoMatchingSkillRequestHandler_ReturnsRequestContextFallbackResponse()
        {
            SkillResponse response = ResponseBuilder.Tell("Test");

            RequestListener.SkillRequestHandlerFactory = new DefaultSkillRequestHandlerFactory();
            RequestContext.FallbackResponse            = response;
            SkillRequest request = new SkillRequest();

            request.Request = new IntentRequest();

            AssertExt.IsEmpty(RequestListener.SkillRequestHandlerFactory.SkillRequestHandlers);
            Assert.AreSame(response, RequestListener.HandleRequest(request, null));
        }
Esempio n. 2
0
        public void HandleRequest_WithMatchingSkillRequestHandler_ReturnsMatchingSkillRequestHandlerResponse()
        {
            SkillResponse           response            = ResponseBuilder.Tell("Test");
            MockSkillRequestHandler skillRequestHandler = new MockSkillRequestHandler();

            skillRequestHandler.HandleRequest_Result = response;

            RequestListener.SkillRequestHandlerFactory = new DefaultSkillRequestHandlerFactory();
            RequestListener.SkillRequestHandlerFactory.SkillRequestHandlers.Add(skillRequestHandler);
            SkillRequest request = new SkillRequest();

            request.Request = new IntentRequest();

            Assert.IsNotNull(RequestListener.SkillRequestHandlerFactory.SkillRequestHandlers.Exists(x => x.IsHandlerForRequest(request)));
            Assert.AreSame(response, RequestListener.HandleRequest(request, null));
        }