예제 #1
0
        public async Task CurrentWeather_MadridCityCodeProvided_ShouldReturnWeather()
        {
            var provider             = new CurrentWeatherProvider();
            var currentMadridWeather = await provider.FindForCityCodeAsync("6359304");

            Assert.IsNotNull(currentMadridWeather);
        }
예제 #2
0
        public async Task CurrentWeather_NoLocationProvider_ShouldReturnNull()
        {
            var provider       = new CurrentWeatherProvider();
            var currentWeather = await provider.FindForCoordinatesAsync(-1, -1);

            Assert.IsNull(currentWeather);
        }
예제 #3
0
        public async Task CurrenWeather_NoCityCodeProvided_ShouldReturnNull()
        {
            var provider       = new CurrentWeatherProvider();
            var currentWeather = await provider.FindForCityCodeAsync(string.Empty);

            Assert.IsNull(currentWeather);
        }
예제 #4
0
        public async Task GetCurrentWeather_Voronezh_ConditionTextNotNull()
        {
            var weatherProvider = new CurrentWeatherProvider();

            var weather = await weatherProvider.GetCurrentWeather("Voronezh");

            var current = weather.CurrentWeather;

            Console.WriteLine(JsonConvert.SerializeObject(weather));
            Assert.IsNotNull(current.Condition.Text);
        }
예제 #5
0
        public WeatherApiService()
        {
            InitializeComponent();

            _apiClient = new CurrentWeatherProvider();
            _cancellationTokenSource = new CancellationTokenSource();

            EventLog = new EventLog();
            if (!EventLog.SourceExists("WeatherAppService"))
            {
                EventLog.CreateEventSource(
                    "WeatherAppService", "");
            }

            EventLog.Source = "WeatherAppService";
            EventLog.Log    = "";
        }