public WeatherController( IWeatherSource weatherSource, IForecastsCache cache) { this.weatherSource = weatherSource ?? throw new ArgumentNullException($"{nameof(weatherSource)}"); this.cache = cache ?? throw new ArgumentNullException($"{nameof(cache)}"); }
protected virtual void Start() { Source = GetComponent <IWeatherSource>(); if (Source != null) { Source.OnWeatherObservable() .Subscribe(weather => OnWeather(weather)) .AddTo(gameObject); } }
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>(); }
public WeatherSourceAopProxy(IWeatherSource weatherSource, ILogger <WeatherSourceAopProxy> logger) { _WeatherSource = weatherSource ?? throw new ArgumentNullException(nameof(weatherSource)); _Logger = logger ?? throw new ArgumentNullException(nameof(logger)); }