public async Task Execute_ReturnsNonEmptyRecognitionResult_WhenGivenValidIntent() { var testEntities = new List <LuisEntity> { new LuisEntity { Name = "", Type = "", Score = 0 } }; var settingsMock = new Mock <ISettings>(); settingsMock.Setup(x => x.TranslateApiKey).Returns("key"); var translateIntentMock = new Mock <ITranslateIntent>(); translateIntentMock.Setup(x => x.Execute(testEntities)) .Returns(Task.FromResult(new RecognitionResult { Message = "translated text" })); var homeAutomationMock = new Mock <IHomeAutomationIntent>(); var nonIntentMock = new Mock <INonIntent>(); var intentService = new IntentService(translateIntentMock.Object, nonIntentMock.Object, homeAutomationMock.Object); var result = await intentService.Execute("Translate", testEntities); Assert.IsNotNull(result); Assert.AreNotEqual(result.Message, string.Empty); }
/// <param name="subscriptionKey">LUIS Authoring Key</param> /// <param name="region">Regions currently available in West US, West Europe and Australia East".</param> public LuisProgClient(string subscriptionKey, Regions region) { Apps = new AppService(subscriptionKey, region); Entities = new EntityService(subscriptionKey, region); Examples = new ExampleService(subscriptionKey, region); Intents = new IntentService(subscriptionKey, region); Publishing = new PublishService(subscriptionKey, region); Versions = new VersionService(subscriptionKey, region); Training = new TrainingService(subscriptionKey, region); }
public JsonResult Delete(int id) { IntentService intentService = new IntentService(); intentService.Delete(id); return(Json(new ResponseMessage() { Message = "Đã tạo thành công", Success = true })); }
private static void Translate() { var translation = GoogleTranslateService.Translate("vegetable", "de"); System.Console.WriteLine(translation); var intent = IntentService.GetIntent("schedule a meeting with Mary on Saturday"); System.Console.WriteLine(intent.TopScoringIntent.Name); }
public Client AddServerApiService() { var env = new EnvironmentService { IsDebugMode = true }; var users = new InMemoryUserRepository(); var states = new InMemoryGameStateRepository(); var register = new GameLogics.Server.Service.RegisterService(users); var config = new FileConfigRepository(Convert, "Config.json"); var auth = new GameLogics.Server.Service.AuthService(Logger, new MockTokenService(), Time, users, states, config, new StateInitService()); var intent = new IntentService(env, Logger, Time, users, states, config); Api = new ConvertedServerApiService(Convert, Logger, new TerminateErrorHandleStrategy(Logger), register, auth, intent); AddCommon(); return(this); }
public JsonResult Update(int id, string name, int[] patterns, int[] groups) { IntentService service = new IntentService(); try { service.Update(id, name, patterns, groups); return(Json(new ResponseMessage() { Message = "Đã tạo thành công", Success = true })); } catch (Exception e) { return(Json(new ResponseMessage() { Message = "Đã có lỗi xảy ra", Success = false })); } }
public ActionResult Intents() { var intents = new IntentService().GetAll(); return(View(intents)); }
protected void IsInvalidOnServer(TCommand cmd) { Assert.False(IntentService.IsValidAsFirstCommand(cmd)); }
public ActionResult Edit(int id) { var intent = new IntentService().GetEditViewModel(id); return(PartialView(intent)); }
/// <summary> /// Creates new instance of this class. /// </summary> /// <param name="logService">Logging intent service.</param> public AndroidLogMethod(IntentService logService) { this.logService = logService; }
public IntentController() { intentService = new IntentService(); }
public UtteranceController() { intentService = new IntentService(); }
public ActionResult Create() { var intents = new IntentService().GetAllForCreatingDialog(); return(PartialView(intents)); }