/// <summary> /// Sets a slot name and value. /// </summary> /// <param name="name"></param> /// <param name="confirmationStatus"></param> /// <param name="value"></param> public void SetSlot(string name, string value, AlexaConfirmationState confirmationStatus) { // ensure we have slots if (UpdatedIntent.Slots == null) { UpdatedIntent.Slots = new System.Collections.Generic.Dictionary <string, AlexaSlot>(); } // get the slot AlexaSlot slot; if (UpdatedIntent.Slots.ContainsKey(name)) { slot = UpdatedIntent.Slots[name]; } else { slot = new AlexaSlot(); UpdatedIntent.Slots.Add(name, slot); } // now set the slot slot.Name = name; slot.ConfirmationStatus = confirmationStatus; slot.Value = value; }
public void TestIntentConfirmationStatusProperty(string enumValue) { try { string testJson = GetSlotConfirmationStatusJson(enumValue); AlexaSlot slot = JsonConvert.DeserializeObject <AlexaSlot>(testJson); int confirmationStatus = (int)slot.ConfirmationStatus; Assert.True(confirmationStatus > -1); Assert.True(confirmationStatus < 3); } catch (JsonSerializationException) { Assert.Equal("faker", enumValue); } }