Ejemplo n.º 1
0
 public WeatherController(
     IWeatherSource weatherSource,
     IForecastsCache cache)
 {
     this.weatherSource = weatherSource ?? throw new ArgumentNullException($"{nameof(weatherSource)}");
     this.cache         = cache ?? throw new ArgumentNullException($"{nameof(cache)}");
 }
            public void SetUp()
            {
                cache = Substitute.For <IForecastsCache>();
                cache.TryGetForecasts(DefaultCity, out _).Returns(false);
                weatherSource = Substitute.For <IWeatherSource>();
                weatherSource.GetWeatherFor(Arg.Any <string>(), Arg.Any <int>())
                .Returns(new WeatherForecastResult());
                watherController = new WeatherController(weatherSource, cache);

                query = new WeatherQuery
                {
                    City      = DefaultCity,
                    DaysCount = 10
                };
            }
 public void SetUp()
 {
     cache         = Substitute.For <IForecastsCache>();
     weatherSource = Substitute.For <IWeatherSource>();
 }