Agent
This solution doesn’t use conditions and the program doesn’t know how many methods will be called (refereced) by the Agent. The concept is based on calling the method formed by a string. This string is created based on the verb and the noun’s method.
First I created some test methods which can return a value or not (void, int, string, double, List
Example of successful command
Command: select weather
Method to be called: selectXMLWeatherAPI(2 params)
Method: selectWeather
Returned a double: 25.5
Example of unsuccessful command
Error, no agent was found!
You can see in the picture below the Diagram of the code. The Agent class know that it has to use the AppFunctions class, but the Agent doesn’t know if it will call a method of AppFunctions.
An example of the code output is shown in the Output box. I also tested 3 different methods with 0, 1 and 2 parameters using NUnit.