public void findTwoDates() { var weather1 = new WeatherStation() { Place = "her", Celcius = 20, Humidity = 50 }; var weather2 = new WeatherStation() { Place = "Der", Celcius = 29, Humidity = 50, Date = DateTime.Today.AddDays(-1) }; var weather3 = new WeatherStation() { Place = "her", Celcius = 20, Humidity = 50, Date = DateTime.Today.AddDays(-1) }; _DbContext.WeatherStations.Add(weather1); _DbContext.WeatherStations.Add(weather2); _DbContext.WeatherStations.Add(weather3); _DbContext.SaveChanges(); var weatherController = new WeatherStationsController(_DbContext); var weatherList = (weatherController.GetTodaysWeatherStations(DateTime.Today.AddDays(-1).ToString())); Assert.Equal(2, weatherList.Result.Count); }
public void findOneDate() { var weather1 = new WeatherStation() { Place = "her", Celcius = 20, Humidity = 50 }; var weather2 = new WeatherStation() { Place = "her", Celcius = 20, Humidity = 50, Date = DateTime.Today }; var weather3 = new WeatherStation() { Place = "her", Celcius = 20, Humidity = 50, Date = DateTime.Today.AddDays(-1) }; _DbContext.WeatherStations.Add(weather1); _DbContext.WeatherStations.Add(weather2); _DbContext.WeatherStations.Add(weather3); _DbContext.SaveChanges(); var weatherController = new WeatherStationsController(_DbContext); var weather = new List <Task <List <WeatherStation> > >(); weather.Add(weatherController.GetTodaysWeatherStations(DateTime.Today.AddDays(-1).ToString())); Assert.Equal(1, weather.Count); }