示例#1
0
		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);
		}
示例#2
0
		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);
		}