public void Should_Retrieve_Weather_When_SettingsChangedEvent_Received()
        {
            const string ZIP_CODE = "90210";

            var settingsChangedEvent = CreateEvent<SettingsChangedEvent<WeatherSettings>>();
            var service = Mock<IWeatherService>();

            var weatherSettings = new WeatherSettings {ZipCode = ZIP_CODE};

            service.Expect(s => s.GetLatestWeatherReport(Arg<string>.Is.Equal(ZIP_CODE), Arg<UnitsSystems>.Is.Equal(UnitsSystems.Imperial))).Repeat.Once();

            CreateSUT(service);

            settingsChangedEvent.Publish(weatherSettings);

            service.VerifyAllExpectations();
        }
        public WeatherViewModel(IRepository<WeatherSettings> repository, IWeatherService weatherService,
                                IEventAggregator eventAggregator)
        {
            EventAggregator = eventAggregator;

            _weatherService = weatherService;
            _weatherService.WeatherRetrieved += (s, e) => WeatherReport = e.Payload;

            _weatherSettings = repository.Load();

            GetLatestWeather();

            var timer = new DispatcherTimer
                            {
                                Interval = new TimeSpan(0, 1, 0, 0)
                            };

            timer.Tick += OnTimerElapsed;

            timer.Start();

            SubscribeToEvents();
        }
        private void OnSettingsChangedEvent(WeatherSettings weatherSettings)
        {
            _weatherSettings = weatherSettings;

            GetLatestWeather();
        }