public void SetUp()
		{
			monitor1 = new DynamicMock(typeof (IProjectMonitor));
			monitor2 = new DynamicMock(typeof (IProjectMonitor));
			monitor3 = new DynamicMock(typeof (IProjectMonitor));

			monitors = new IProjectMonitor[]
				{
					(IProjectMonitor) monitor1.MockInstance,
					(IProjectMonitor) monitor2.MockInstance,
					(IProjectMonitor) monitor3.MockInstance,
				};

			aggregator = new AggregatingProjectMonitor(monitors);
		}
		public void BuildOccuredIsFiredWheneverAnyContainedProjectStatusFiresIt()
		{
			buildOccurredCount = 0;
			lastBuildOccurredEventArgs = null;

			StubProjectMonitor stubProjectMonitor1 = new StubProjectMonitor("project1");
			StubProjectMonitor stubProjectMonitor2 = new StubProjectMonitor("project2");

			aggregator = new AggregatingProjectMonitor(stubProjectMonitor1, stubProjectMonitor2);
			aggregator.BuildOccurred += new MonitorBuildOccurredEventHandler(Aggregator_BuildOccurred);

			Assert.AreEqual(0, buildOccurredCount);
			stubProjectMonitor1.OnBuildOccurred(new MonitorBuildOccurredEventArgs(stubProjectMonitor1, BuildTransition.Fixed));

			Assert.AreEqual(1, buildOccurredCount);
			Assert.AreSame(stubProjectMonitor1, lastBuildOccurredEventArgs.ProjectMonitor);
			Assert.AreEqual(BuildTransition.Fixed, lastBuildOccurredEventArgs.BuildTransition);
		}
		public void PolledIsFiredWheneverAnyContainedProjectStatusFiresIt()
		{
			pollCount = 0;

			StubProjectMonitor stubProjectMonitor1 = new StubProjectMonitor("project1");
			StubProjectMonitor stubProjectMonitor2 = new StubProjectMonitor("project2");

			aggregator = new AggregatingProjectMonitor(stubProjectMonitor1, stubProjectMonitor2);
			aggregator.Polled += new MonitorPolledEventHandler(Aggregator_Polled);

			Assert.AreEqual(0, pollCount);
			stubProjectMonitor1.OnPolled(new MonitorPolledEventArgs(stubProjectMonitor1));

			Assert.AreEqual(1, pollCount);
		}
		public void WhenPolledIsFiredTheSourcePointToTheAggregatorNotTheFiringProject()
		{
			StubProjectMonitor stubProjectMonitor1 = new StubProjectMonitor("project1");

			aggregator = new AggregatingProjectMonitor(stubProjectMonitor1);
			aggregator.Polled += new MonitorPolledEventHandler(Aggregator_Polled);

			stubProjectMonitor1.OnPolled(new MonitorPolledEventArgs(stubProjectMonitor1));

			Assert.AreSame(lastPolledSource, aggregator);
			Assert.AreSame(lastPolledArgs.ProjectMonitor, stubProjectMonitor1);
		}