public async void ShouldReturnWeatherResults()
        {
            var serviceA = new Mock<IWeatherService>();
            var serviceB = new Mock<IWeatherService>();

            serviceA.Setup(o => o.GetWeather(Location)).ReturnsAsync(new AccuweatherResult());
            serviceB.Setup(o => o.GetWeather(Location)).ReturnsAsync(new BbcWeatherResult());

            var listOfServices = new List<IWeatherService>() { serviceA.Object, serviceB.Object };
            _service = new WeatherAggregatorService(listOfServices);

            var result = await _service.GetWeatherResults(Location);

            result.Should().NotBeNull();
            result.Should().NotBeEmpty();
            result.All(o => o != null).Should().BeTrue();
        }
示例#2
0
 public WeatherController(IWeatherAggregatorService weatherAggregatorService)
 {
     _weatherAggregatorService = weatherAggregatorService;
 }