コード例 #1
0
        public async Task VerifyServiceWorks()
        {
            var locationProvider = new Mock <ILocationProvider>();

            locationProvider.Setup(m => m.GetPositionAsync())
            .ReturnsAsync(new GeoLocation
            {
                Latitude  = 44.55d,
                Longitude = 23,
            });

            var weatherService = new OpenWeatherMapService(locationProvider.Object, new RequestProvider());

            for (var i = 0; i < 15; i++)
            {
                var weather = await weatherService.GetWeatherInfoAsync();

                Assert.IsInstanceOf(typeof(WeatherInfo), weather);
            }
        }