public async Task Weather_Service_Should_Return_Weather_Only_One_Forecast_For_Specified_Date(string cityName)
        {
            ApplicationData applicationData = new ApplicationData
            {
                OWMUrl         = "https://api.openweathermap.org/data/2.5/weather?",
                OWMApiKey      = "f1b58a47aa129daa6330e7280a88e7b5",
                OWMForecastUrl = "http://api.openweathermap.org/data/2.5/forecast?"
            };

            Random random      = new Random();
            var    options     = Options.Create <ApplicationData>(applicationData);
            var    mockFactory = new Mock <IHttpClientFactory>();
            var    client      = new HttpClient();

            mockFactory.Setup(x => x.CreateClient(It.IsAny <string>())).Returns(client);
            IHttpClientFactory factory        = mockFactory.Object;
            IClientService     clientService  = new ClientService(factory);
            IWeatherService    weatherService = new WeatherService(clientService, options);

            var result = await weatherService.GetLongWeatherForecastAsync(cityName);

            var date = result.List.ToList()[0].WeatherForecastDateTime.Date.ToShortDateString();

            var res  = WeatherForecastHelper.GetFilteredItems(result.List);
            var res2 = WeatherForecastHelper.GetFilteredItems(result.List).Skip(1);

            Assert.Equal(1, res.Where(res => res.WeatherForecastDateTime.Date.ToShortDateString() == date).Count());
            Assert.True(!res2.Any(res => res.WeatherForecastDateTime.Date.ToShortDateString() == date));
        }
        public async Task <ActionResult <ApiResponse <LongWeatherForecastModel> > > GetLongWeatherForecast(string cityName)
        {
            var response = await _weatherService.GetLongWeatherForecastAsync(cityName);

            if (response == null)
            {
                var res = new ApiResponse <string>
                {
                    ResponseBody = $"Cannot find weather for ${ cityName}",
                    StatusCode   = System.Net.HttpStatusCode.NotFound
                };

                return(NotFound(res));
            }


            var resultModel = new LongWeatherForecastModel
            {
                List = WeatherForecastHelper.GetFilteredItems(response.List),
                City = response.City
            };


            var result = new ApiResponse <LongWeatherForecastModel>
            {
                ResponseBody = resultModel,
                StatusCode   = System.Net.HttpStatusCode.OK
            };

            return(Ok(result));
        }