Esempio n. 1
0
        public void TestGetFunctionFromCommandStringReturnsExpectedFunctionWhenShallowFunction()
        {
            // tests that the GetFunctionFromCommandString function still works even if it's not working on a nested Dictionary
            ActionRouter.SetUp();
            const string commandString = "Get the weather for tomorrow";
            Func <string, BobTheDigitalAssistant.Actions.Action> returnedFunction = ActionRouter.GetFunctionFromCommandString(commandString);

            Assert.IsNotNull(returnedFunction);
            WeatherAction returnedAction = (WeatherAction)returnedFunction(commandString);

            Assert.IsNotNull(returnedAction);
        }
 private string GetUrl(WeatherAction action, string zip)
 {
     string actionStr = string.Empty;
     switch (action)
     {
         case WeatherAction.Current:
             actionStr = "weather";
             break;
         case WeatherAction.Forecast:
             actionStr = "forecast/daily";
             break;
     }
     return string.Format("{0}/{1}?APPID={2}&units={3}&zip={4}", ServiceBaseUrl, actionStr,
         ServiceApiKey, ServiceUnits, zip);
 }
Esempio n. 3
0
        private string GetUrl(WeatherAction action, string zip)
        {
            string actionStr = string.Empty;

            switch (action)
            {
            case WeatherAction.Current:
                actionStr = "weather";
                break;

            case WeatherAction.Forecast:
                actionStr = "forecast/daily";
                break;
            }
            return(string.Format("{0}/{1}?APPID={2}&units={3}&zip={4}", ServiceBaseUrl, actionStr,
                                 ServiceApiKey, ServiceUnits, zip));
        }