public void ShouldFireChangeLightOnTimeExpiration()
		{
			bool lightChangedFired = false;

			MockStoplightTimer timer = new MockStoplightTimer();
			StoplightSchedule schedule = new StoplightSchedule(timer);
			schedule.ChangeLight += delegate { lightChangedFired = true; };

			timer.Expire();
			Assert.IsTrue(lightChangedFired);
		}
		public void ShouldSetTimerDurationForNextLight()
		{
			MockStoplightTimer timer = new MockStoplightTimer();
			StoplightSchedule schedule = new StoplightSchedule(timer);
			TimeSpan greenSchedule = new TimeSpan(800);
			TimeSpan yellowSchedule = new TimeSpan(1500);
			TimeSpan redSchedule = new TimeSpan(100);
			schedule.Update(greenSchedule, yellowSchedule, redSchedule);

			timer.Expire();
			Assert.AreEqual(yellowSchedule, timer.Duration);
		}
		public void ShouldLogOnForceChange()
		{
			MockStoplightTimer timer = new MockStoplightTimer();
			MockLogger logger = new MockLogger();
			StoplightSchedule schedule = new StoplightSchedule(timer);
			schedule.Logger = logger;
			TimeSpan greenSchedule = new TimeSpan(800);
			TimeSpan yellowSchedule = new TimeSpan(1500);
			TimeSpan redSchedule = new TimeSpan(100);
			schedule.Update(greenSchedule, yellowSchedule, redSchedule);

			schedule.ForceChange();
			Assert.IsNotNull(logger.LastMessage);
			Assert.IsTrue(logger.LastMessage.StartsWith("FORCED CHANGE"));
		}
		public void ShouldFireEventAndUpdateScheduleOnForceChange()
		{
			MockStoplightTimer timer = new MockStoplightTimer();
			StoplightSchedule schedule = new StoplightSchedule(timer);
			TimeSpan greenSchedule = new TimeSpan(800);
			TimeSpan yellowSchedule = new TimeSpan(1500);
			TimeSpan redSchedule = new TimeSpan(100);
			schedule.Update(greenSchedule, yellowSchedule, redSchedule);

			bool eventFired = false;
			schedule.ChangeLight += delegate { eventFired = true; };

			schedule.ForceChange();
			Assert.IsTrue(eventFired);
			Assert.AreEqual(yellowSchedule, timer.Duration);
		}