"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" private List WeatherForecast WeatherForecasts { get; set; } public WeatherProviderFake() Initialize(50); private void Initialize(int quantity) var rng = new Random(); WeatherForecasts = Enumerable.Range(1, quantity).Select(index = new WeatherForecast DateFormatted = DateTime.Now.AddDays(index).ToString("d"), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }).ToList(); public List WeatherForecast GetForecasts() return WeatherForecasts; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) services.AddMvc(); // Simple example with dependency injection for a data provider. services.AddSingleton IWeatherProvider, WeatherProviderFake (); }