public void InputContextLifespanTest() { var dataService = CreateDataService(); var aiRequest = new AIRequest("and for tomorrow"); var aiContext = new AIContext { Name = "weather", Parameters = new Dictionary<string, string> { { "location", "London"} }, Lifespan = 3 }; aiRequest.Contexts = new List<AIContext> { aiContext }; var response = MakeRequest(dataService, aiRequest); Assert.IsNotNull(response.Result.GetContext("weather")); for (int i = 0; i < 2; i++) { response = MakeRequest(dataService, new AIRequest("next request")); } Assert.IsNotNull(response.Result.GetContext("weather")); response = MakeRequest(dataService, new AIRequest("next request")); Assert.IsNull(response.Result.GetContext("weather")); }
public void InputContextWithParametersTest() { var dataService = CreateDataService(); var aiRequest = new AIRequest("and for tomorrow"); var aiContext = new AIContext { Name = "weather", Parameters = new Dictionary<string,string> { { "location", "London"} } }; aiRequest.Contexts = new List<AIContext> { aiContext }; var response = MakeRequest(dataService, aiRequest); Assert.AreEqual("Weather in London for tomorrow", response.Result.Fulfillment.Speech); }