/// <summary> /// Calls a Question asynchronously. /// </summary> /// <typeparam name="TAnswer">The answer type.</typeparam> /// <param name="question">The Question to ask.</param> /// <param name="enterPhrase">The phrase to print before calling.</param> /// <param name="exitPhrase">The phrase to print after calling.</param> /// <returns></returns> private async Task <TAnswer> CallQuestionAsync <TAnswer>(IQuestionAsync <TAnswer> question, string enterPhrase, string exitPhrase) { Logger.Info($"{this} {enterPhrase} {question}"); TAnswer answer = await question.RequestAsAsync(this); Logger.Info($"{question} {exitPhrase} {answer}"); return(answer); }
/// <summary> /// Asks a Question and returns the answer value asynchronously. /// The Actor must have the Abilities needed by the Question. /// </summary> /// <typeparam name="TAnswer">The answer type.</typeparam> /// <param name="question">The Question to ask.</param> public async Task <TAnswer> CallsAsync <TAnswer>(IQuestionAsync <TAnswer> question) { return(await CallQuestionAsync(question, "calls", "returned:")); }
/// <summary> /// Asks a Question and returns the answer value asynchronously. /// The Actor must have the Abilities needed by the Question. /// </summary> /// <typeparam name="TAnswer">The answer type.</typeparam> /// <param name="question">The Question to ask.</param> /// <returns></returns> public async Task <TAnswer> AskingForAsync <TAnswer>(IQuestionAsync <TAnswer> question) { return(await CallQuestionAsync(question, "asking for", "was")); }