public override string Evaluate(RequestProcess process) { process.Log(LogLevel.Info, $"In element <test>: running test {this.Name}"); string text = this.Children?.Evaluate(process) ?? ""; process.Log(LogLevel.Diagnostic, "In element <test>: processing text '" + text + "'."); var newRequest = new Aiml.Request(text, process.User, process.Bot); text = process.Bot.ProcessRequest(newRequest, false, false, process.RecursionDepth + 1, out var duration).ToString().Trim(); process.Log(LogLevel.Diagnostic, "In element <test>: the request returned '" + text + "'."); if (process.testResults != null) { var expectedResponse = this.ExpectedResponse.Evaluate(process).Trim(); TestResult result; if (process.Bot.Config.CaseSensitiveStringComparer.Equals(text, expectedResponse)) { result = TestResult.Pass(duration); } else { result = TestResult.Failure($"Expected response: {expectedResponse}\nActual response: {text}", duration); } process.testResults[this.Name] = result; } else { process.Log(LogLevel.Warning, "In element <test>: Tests are not being used."); } return(text); }
public override string Evaluate(RequestProcess process) { string text = process.star[0]; process.Log(LogLevel.Diagnostic, "In element <sr>: processing text '" + text + "'."); var newRequest = new Aiml.Request(text, process.User, process.Bot); text = process.Bot.ProcessRequest(newRequest, false, false, process.RecursionDepth + 1, out _).ToString(); process.Log(LogLevel.Diagnostic, "In element <sr>: the request returned '" + text + "'."); return(text); }