コード例 #1
0
		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);
		}
コード例 #2
0
		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);
		}
コード例 #3
0
		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);
		}
コード例 #4
0
		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);
		}