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); } }
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; }
public DialogDirective(string intent) { UpdatedIntent = new AlexaIntent(); UpdatedIntent.Name = intent; }
public DialogDirective(string intent, AlexaConfirmationState confirmationStatus) { UpdatedIntent = new AlexaIntent(); UpdatedIntent.Name = intent; UpdatedIntent.ConfirmationStatus = confirmationStatus.ToString(); }