public void GetsArgumentsFromSlots()
        {
            var request = new SkillRequest
            {
                Request = new RequestBundle
                {
                    Intent = new Intent
                    {
                        Name  = "Test",
                        Slots = new Dictionary <string, Slot>
                        {
                            { "Answer", new Slot {
                                  Name = "Answer", Value = "Five"
                              } }
                        }
                    }
                }
            };

            var expected = new[] { new Argument("Answer", "Five") };

            var processor = new SkillRequestProcessor("");
            var args      = processor.GetArguments(request, Substitute.For <ILogger>());

            args.ShouldAllBeEquivalentTo(expected);
        }
        public void HandlesEmptyArgumentsWithoutCrashing()
        {
            var request = new SkillRequest
            {
                Request = new RequestBundle
                {
                    Intent = new Intent()
                }
            };

            var processor = new SkillRequestProcessor("");
            var args      = processor.GetArguments(request, Substitute.For <ILogger>());

            args.Length.Should().Be(0);
        }
        public void ReturnTheCorrectRequestTypeFromRawRequest(string requestName, RequestType?expectedRequestType)
        {
            var request = new SkillRequest
            {
                Request = new RequestBundle
                {
                    RequestId = "Test",
                    Type      = requestName
                },
                Session = new Session
                {
                    SessionId = "Test"
                }
            };

            var processor   = new SkillRequestProcessor("");
            var requestType = processor.GetRequestType(request, Substitute.For <ILogger>());

            requestType.Should().Be(expectedRequestType);
        }
        public void ValidatesApplicationId(string applicationId, string requestApplicationId, bool valid)
        {
            var request = new SkillRequest
            {
                Session = new Session
                {
                    Application = new Application
                    {
                        ApplicationId = requestApplicationId
                    }
                }
            };

            var processor = new SkillRequestProcessor(applicationId);

            if (!valid)
            {
                Assert.Throws <InvalidOperationException>(() => processor.ValidateRequest(request));
            }
            else
            {
                processor.ValidateRequest(request);
            }
        }