public async Task GetTest_NoRecord() { var WeatherInfoController = new WeatherInfoController(); var info = await WeatherInfoController.Get("12343"); Assert.IsNotNull(info); Assert.AreEqual("No record found for given City Id", info.Name); }
public async Task GetTest() { var WeatherInfoController = new WeatherInfoController(); var info = await WeatherInfoController.Get("4229546"); Assert.IsNotNull(info); Assert.AreEqual("Washington", info.Name); }
public async Task GetCurrentWeatherInfo_Successfull() { //Arrange _city = "London"; //Act var result = await SUT.Get(_city, _date); var okObjectResult = result as OkObjectResult; var cityWeatherInfo = okObjectResult.Value as CityWeatherInfo; //Assert Assert.IsNotNull(result); Assert.AreEqual((int)HttpStatusCode.OK, okObjectResult.StatusCode); Assert.AreEqual(_city, cityWeatherInfo.City); Assert.AreEqual(_location.Localtime, cityWeatherInfo.LocalTime); Assert.AreEqual(_location.Region, cityWeatherInfo.Region); Assert.AreEqual(_location.Country, cityWeatherInfo.Country); Assert.AreEqual(_astronomyDetail.Astronomy.Astro.Sunrise, cityWeatherInfo.Sunrise); Assert.AreEqual(_astronomyDetail.Astronomy.Astro.Sunset, cityWeatherInfo.Sunset); }