You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
873 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeatherClient.Models;
namespace WeatherClient.Services
{
internal static class WeatherServer
{
public static async Task<WeatherData> GetWeather(string postalCode)
{
int totalWeatherTypes = Enum.GetNames<WeatherType>().Length;
await Task.Delay(TimeSpan.FromSeconds(2));
WeatherData data = new WeatherData()
{
Temperature = Random.Shared.Next(-10, 40),
Condition = (WeatherType)Random.Shared.Next(0, totalWeatherTypes),
Humidity = Random.Shared.Next(0, 101),
Precipitation = Random.Shared.Next(0, 101),
Wind = Random.Shared.Next(0, 30)
};
return data;
}
}
}