public void TestIntentConfirmationStatusProperty(string enumValue)
 {
     try
     {
         string      testJson           = GetIntentConfirmationStatusJson(enumValue);
         AlexaIntent intent             = JsonConvert.DeserializeObject <AlexaIntent>(testJson);
         int         confirmationStatus = (int)intent.ConfirmationStatus;
         Assert.True(confirmationStatus > -1);
         Assert.True(confirmationStatus < 3);
     }
     catch (JsonSerializationException)
     {
         Assert.Equal("faker", enumValue);
     }
 }
Exemplo n.º 2
0
        public SkillResponse Run(SkillRequest input, IntentParameters parameters)
        {
            AlexaIntent intentToRun = null;

            Dictionary<string, Slot> slots = null;

            string intentName = "";

            if (input.GetRequestType() == typeof(LaunchRequest))
            {
                intentToRun = _intentFactory.LaunchIntent();

                slots = new Dictionary<string, Slot>();
            }
            else if (input.GetRequestType() == typeof(IntentRequest))
            {
                var intentRequest = (IntentRequest)input.Request;

                var intents = _intentFactory.Intents();

                slots = intentRequest.Intent.Slots;

                intentName = intentRequest.Intent.Name;

                if (intents.ContainsKey(intentRequest.Intent.Name))
                {
                    intentToRun = intents[intentRequest.Intent.Name];
                }
                else
                {
                    intentToRun = _intentFactory.HelpIntent();
                }
            }

            if (intentToRun == null)
            {
                return ResponseBuilder.Tell(new PlainTextOutputSpeech { Text = String.Format(_noIntentMatchedText, intentName) });
            }

            var skillResponse = intentToRun.GetResponse(slots);

            skillResponse.Response.ShouldEndSession = intentToRun.ShouldEndSession;

            parameters.CommandQueue.Enqueue(intentToRun.CommandDefinition());

            return skillResponse;
        }
Exemplo n.º 3
0
 public DialogDirective(string intent)
 {
     UpdatedIntent      = new AlexaIntent();
     UpdatedIntent.Name = intent;
 }
Exemplo n.º 4
0
 public DialogDirective(string intent, AlexaConfirmationState confirmationStatus)
 {
     UpdatedIntent      = new AlexaIntent();
     UpdatedIntent.Name = intent;
     UpdatedIntent.ConfirmationStatus = confirmationStatus.ToString();
 }