Exemplo n.º 1
0
		public void ShouldLogMessageOnChange()
		{
			Stoplight light = new Stoplight();
			MockLogger logger = new MockLogger();
			light.Logger = logger;

			light.Next();

			Assert.IsNotNull(logger.LastMessage);
			Assert.IsTrue(logger.LastMessage.StartsWith("LIGHT CHANGED TO"));
		}
Exemplo n.º 2
0
		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"));
		}