/// <summary> /// Processes given phrase, as if it will be qualified as greeting or valediction, it will be marked and response will follow. /// </summary> /// <param name="given">given phrase</param> /// <returns>response, if was processed, null, if 'not my thing'</returns> public string Process(string given) { // Check entry param if (string.IsNullOrWhiteSpace(given)) { return(null); } // Check, if _dialogUtils is initalized if (_dialogUtils == null) { return("_dialogUtils is not present."); } // Change to lower case given = given.Trim().ToLower(); // Prepare response variable string responseText = null; // Check, in known greetings if (new[] { "hi", "hello", "welcome" }.Contains(given)) { responseText = _dialogUtils.Greeting(); } else if (new[] { "bye", "goodbye", "farewell" }.Contains(given)) { responseText = _dialogUtils.Valediction(); } return(responseText); }