Esempio n. 1
0
        public async Task Test_Return_City_isNotNull()
        {
            // Arrange
            var local = await ServiceHttp.GetCity(-23.620635, -46.607222).ConfigureAwait(false);

            // Assert
            Assert.IsNotNull(local);
        }
Esempio n. 2
0
        internal async void ThisOnAppearing()
        {
            try
            {
                IsLoad = true;

                // verifica se tem internet
                if (Connectivity.NetworkAccess != NetworkAccess.Internet)
                {
                    await App.Current.MainPage.DisplayAlert("Informativo", "Sem Conexão com a Internet.", "ok");

                    return;
                }

                var location = await Geolocation.GetLastKnownLocationAsync();

                // pegou uma localização?
                if (location != null)
                {
                    Local = await ServiceHttp.GetCity(location.Latitude, location.Longitude).ConfigureAwait(false);

                    WeatherLocal = await ServiceHttp.GetWeather(location.Latitude, location.Longitude).ConfigureAwait(false);

                    Temperature     = Math.Round(WeatherLocal.Currently.Temperature, 0).ToString();
                    SensacaoTermica = Math.Round(WeatherLocal.Currently.ApparentTemperature, 0).ToString();
                    VentoVelocidade = Math.Round(WeatherLocal.Currently.WindSpeed, 2).ToString();
                    var list = WeatherLocal.Daily.Data;
                    Summary = WeatherLocal.Currently.Summary;

                    int cont = 1;
                    foreach (Datum datum in list)
                    {
                        if (cont == 7)
                        {
                            break;
                        }

                        datum.Day = String.Format(new CultureInfo("pt-BR"), "{0:dddd }", DateTime.Now.AddDays(cont));
                        Dailys.Add(datum);
                        cont++;
                    }
                }
                else
                {
                    Temperature = "-";
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                IsLoad = false;
            }
        }
Esempio n. 3
0
        public async Task Test_Return_City_equals_sao_paulo()
        {
            // Arrange
            var local = await ServiceHttp.GetCity(-23.620635, -46.607222).ConfigureAwait(false);

            //Act
            var very_local = "São Paulo";

            // Assert
            Assert.AreSame(local, very_local);
        }