public void WhenIPostThisRequestToSerrver() { fromFeature.q = "London,us"; fromFeature.appid = "b6907d289e10d714a6e88b30761fae22"; DataTable dt = new DataTable(); dt.Columns.Add("endpoint"); dt.Columns.Add("parameter"); dt.Columns.Add("parametervalue"); dt.Columns.Add("parametertype"); DataRow tempRow1 = dt.NewRow(); tempRow1["endpoint"] = "forecast"; tempRow1["parameter"] = "q"; tempRow1["parametervalue"] = "London,us"; tempRow1["parametertype"] = "NA"; dt.Rows.Add(tempRow1); DataRow tempRow2 = dt.NewRow(); tempRow2["endpoint"] = "forecast"; tempRow2["parameter"] = "appid"; tempRow2["parametervalue"] = "b6907d289e10d714a6e88b30761fae22"; tempRow2["parametertype"] = "NA"; dt.Rows.Add(tempRow2); dtrwauthparam = dt.Select("endpoint" + " = '" + "forecast" + "'"); response = APILayer.GetTransactionPreferenceRequestToMuleSoft(URL, "forecast", fromFeature, dtrwauthparam); }
public void ThenTheResponseShouldHaveDaysOfData(int p0) { WeatherForecast resp = APILayer.GetJsonobj <WeatherForecast>(response); if (!(resp.cnt / 24 == 4)) { Assert.Fail(); } }
public void ThenInTheResponseTempValueShouldBeInBetweenTemp_MinAndTemp_Max() { WeatherForecast resp = APILayer.GetJsonobj <WeatherForecast>(response); foreach (var item in resp.list) { if (!(item.main.temp <= item.main.temp_max && item.main.temp >= item.main.temp_min)) { Assert.Fail(); } } }
public void ThenDescriptionShouldBeClearSkyIfTheValueForWeatherIdIs(int p0) { WeatherForecast resp = APILayer.GetJsonobj <WeatherForecast>(response); foreach (var item in resp.list) { if (item.weather[0].id.ToString() == "800") { if (item.weather[0].description.ToString() != "clear sky") { Assert.Fail(); } } } }
public void ThenTheResponseShouldHaveForecastInHourlyInterval() { WeatherForecast resp = APILayer.GetJsonobj <WeatherForecast>(response); for (int i = 0; i < resp.list.Count; i++) { if (i != 0) { DateTime prevDateTime = Convert.ToDateTime(resp.list[i - 1].dt_txt); DateTime currentDateTime = Convert.ToDateTime(resp.list[i].dt_txt); prevDateTime = prevDateTime.AddHours(1); if (prevDateTime != currentDateTime) { Assert.Fail(); } } } }