public void GetCityWeatherData() { //action WeatherController controller = new WeatherController(); JsonResult result = controller.GetCityWeather("Sydney") as JsonResult; //convert data result dynamic jsonObject = JObject.Parse(result.Data.ToString()); //check if the data result name is Sydney Assert.AreEqual("Sydney", jsonObject.name.ToString()); }