public void WhenTheStateOfTheProjectChangesTheStatusEntriesOnTheListViewItemAreUpdated()
		{
			StubProjectMonitor projectMonitor = new StubProjectMonitor("projectName");
			projectMonitor.ProjectState = ProjectState.Building;
			projectMonitor.ProjectStatus = null;
            projectMonitor.Configuration = new CCTrayProject("http://somewhere", "projectName");

			ProjectStatusListViewItemAdaptor adaptor = new ProjectStatusListViewItemAdaptor(detailStringFormatter);
			ListViewItem item = adaptor.Create(projectMonitor);

			Assert.AreEqual(10, item.SubItems.Count);
			ListViewItem.ListViewSubItem activity = item.SubItems[3];
			ListViewItem.ListViewSubItem label = item.SubItems[5];

			Assert.AreEqual("", activity.Text);
			Assert.AreEqual("", label.Text);

			ProjectStatus status = ProjectStatusFixture.New(ProjectActivity.Sleeping, "lastLabel");
			projectMonitor.ProjectStatus = status;

			projectMonitor.OnPolled(new MonitorPolledEventArgs(projectMonitor));

			Assert.AreEqual("Sleeping", activity.Text);
			Assert.AreEqual("lastLabel", label.Text);

		}
		public void CanCreateListViewItem()
		{
			StubProjectMonitor projectMonitor = new StubProjectMonitor("projectName");

			ProjectStatusListViewItemAdaptor adaptor = new ProjectStatusListViewItemAdaptor(detailStringFormatter);
			ListViewItem item = adaptor.Create(projectMonitor);

			Assert.AreEqual("projectName", item.Text);
			Assert.AreEqual(0, item.ImageIndex);
		}
		public void WhenTheStateOfTheProjectChangesTheIconIsUpdated()
		{
			StubProjectMonitor projectMonitor = new StubProjectMonitor("projectName");
			ProjectStatusListViewItemAdaptor adaptor = new ProjectStatusListViewItemAdaptor(detailStringFormatter);
			ListViewItem item = adaptor.Create(projectMonitor);

			Assert.AreEqual("projectName", item.Text);
			Assert.AreEqual(0, item.ImageIndex);

			projectMonitor.ProjectState = ProjectState.Building;

			projectMonitor.OnPolled(new MonitorPolledEventArgs(projectMonitor));

			Assert.AreEqual("projectName", item.Text);
			Assert.AreEqual(ProjectState.Building.ImageIndex, item.ImageIndex);
		}
コード例 #4
0
        public void UsesDescriptionBuilderToGenerateDetailCaption()
        {
            StubProjectMonitor projectMonitor = new StubProjectMonitor("projectName");
            mockProjectDetailStringFormatter.Strict = true;

            mockProjectDetailStringFormatter.ExpectAndReturn("FormatDetailString", "test1", projectMonitor);
            ProjectStatusListViewItemAdaptor adaptor = new ProjectStatusListViewItemAdaptor(detailStringFormatter);
            ListViewItem item = adaptor.Create(projectMonitor);

            ListViewItem.ListViewSubItem detail = item.SubItems[4];
            Assert.AreEqual("test1", detail.Text);

            mockProjectDetailStringFormatter.ExpectAndReturn("FormatDetailString", "test2", projectMonitor);
            projectMonitor.OnPolled(new MonitorPolledEventArgs(projectMonitor));

            Assert.AreEqual("test2", detail.Text);

            mockProjectDetailStringFormatter.Verify();
        }