Example #1
0
        public void TestGetCitiesByCountry()
        {
            string citiesxml = globalWeatherServiceAgent.GetCitiesByCountry("Australia");

            Assert.IsNotNull(citiesxml);
            Assert.IsTrue(citiesxml.Trim().Length > 0, "The message length must be greater than zero");
        }
        /// <summary>
        /// Implements the following business logic:
        /// 1. Interact with internal serviceagent called globalWeatherServiceAgent
        /// 2. fetches list of cities by inputted country
        /// 3. converts the soap xml message to json string
        /// </summary>
        /// <param name="strcountryName">name of the country</param>
        /// <returns>list of cities as json text format</returns>
        public string GetCitiesByCountry(string strcountryName)
        {
            mLog.Info("Calling GlobalWeatherServiceClient.GetCitiesByCountry...");

            try
            {
                string strCities = globalWeatherServiceAgent.GetCitiesByCountry(strcountryName);
                return(GlobalWeatherHelper.ConvertXMLToJSON(strCities));
            }
            catch (Exception ex)
            {
                mLog.Error(ex.InnerException);
                throw ex;
            }
        }