Beispiel #1
0
 private async void Button_OnClicked(object sender, EventArgs e)
 {
     if (PickerCity.SelectedIndex == -1)
     {
         await DisplayAlert("Alerta", "Escoja la Ciudad!!", "OK");
     }
     else
     {
         await _weatherViewModel.GetWeatherAsync(PickerCity.Items[PickerCity.SelectedIndex].ToLower());
     }
 }
Beispiel #2
0
        public async Task CurrentWeatherShouldNotBeNull()
        {
            HttpMessageHandler handlerMock = MockHttpMessageHandler.CreateMock(
                new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(
                    FromEmbedResources.ReadText("ResponseMock.CurrentWeatherResponse.json"))
            });
            var              httpClient           = new HttpClient(handlerMock);
            IWeatherService  weatherService       = new WeatherService(httpClient, "");
            WeatherViewModel weatherViewModelMock = MockWeatherViewModel.CreateMock(weatherService).Object;

            await weatherViewModelMock.GetWeatherAsync();

            weatherViewModelMock.CurrentWeather.Should().NotBeNull();
        }