Esempio n. 1
0
        private void StartMultipleTimers_Click(object sender, EventArgs e)
        {
            _weather.ZipList.Add(new ZipInformation {
                ZipCode = "30188", Interval = 6000
            });
            _weather.ZipList.Add(new ZipInformation {
                ZipCode = "32184", Interval = 7000
            });
            _weather.ZipList.Add(new ZipInformation {
                ZipCode = "10001", Interval = 15000
            });

            _weather.CreateMultipleWeatherChecks();
            ResultsDisplay.Text = "The weather checks have been created." + Environment.NewLine;;
        }
        public void CreateMultipleWeatherChecks_NumberOfTimersAdded()
        {
            var sut = new WeatherAPI();

            sut.ZipList.Add(new ZipInformation()
            {
                ZipCode = "30004", Interval = 60000
            });

            sut.CreateMultipleWeatherChecks();

            Assert.That(sut.Timers, Has.One.Matches <System.Timers.Timer>(item => item.Enabled == true));
            Assert.That(sut.ZipList.Count, Is.EqualTo(1));

            //TODO: Really wish I had time to find this but google foo is failing me right now
            sut.StopTimers();
        }