public void OnCreationTheCurrentStateOfTheIconIsRead()
        {
            StatusIcon icon = new StatusIcon();

            mockIconProvider.Setup(_iconProvider => _iconProvider.GetStatusIconForState(ProjectState.Building)).Returns(icon).Verifiable();

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            Assert.AreSame(icon, adaptor.StatusIcon);

            mockIconProvider.Verify();
        }
        public void OnCreationTheCurrentStateOfTheIconIsRead()
        {
            StatusIcon icon = new StatusIcon();

            mockIconProvider.ExpectAndReturn("GetStatusIconForState", icon, ProjectState.Building);

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            Assert.AreSame(icon, adaptor.StatusIcon);

            mockIconProvider.Verify();
        }
        public void WhenTheMonitorPollsTheIconMayBeUpdated()
        {
            StatusIcon icon = new StatusIcon();

            mockIconProvider.Setup(_iconProvider => _iconProvider.GetStatusIconForState(ProjectState.Building)).Returns(icon).Verifiable();

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            Assert.AreSame(icon, adaptor.StatusIcon);

            monitor.ProjectState = ProjectState.Broken;

            StatusIcon icon2 = new StatusIcon();

            mockIconProvider.Setup(_iconProvider => _iconProvider.GetStatusIconForState(ProjectState.Broken)).Returns(icon2).Verifiable();

            monitor.Poll();

            Assert.AreSame(icon2, adaptor.StatusIcon);
            mockIconProvider.Verify();
        }
        public void WhenTheMonitorPollsTheIconMayBeUpdated()
        {
            StatusIcon icon = new StatusIcon();

            mockIconProvider.ExpectAndReturn("GetStatusIconForState", icon, ProjectState.Building);

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            Assert.AreSame(icon, adaptor.StatusIcon);

            monitor.ProjectState = ProjectState.Broken;

            StatusIcon icon2 = new StatusIcon();

            mockIconProvider.ExpectAndReturn("GetStatusIconForState", icon2, ProjectState.Broken);

            monitor.Poll();

            Assert.AreSame(icon2, adaptor.StatusIcon);
            mockIconProvider.Verify();
        }
        public void WhenTheStatusIconIsChangedAnEventIsFired()
        {
            iconChangedCount = 0;

            StatusIcon icon = new StatusIcon();

            mockIconProvider.Setup(_iconProvider => _iconProvider.GetStatusIconForState(ProjectState.Building)).Returns(icon).Verifiable();

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            adaptor.IconChanged += new EventHandler(IconChanged);

            Assert.AreEqual(0, iconChangedCount);

            StatusIcon icon2 = new StatusIcon();

            adaptor.StatusIcon = icon2;
            Assert.AreEqual(1, iconChangedCount);

            adaptor.StatusIcon = icon2;
            Assert.AreEqual(1, iconChangedCount);
        }
        public void WhenTheStatusIconIsChangedAnEventIsFired()
        {
            iconChangedCount = 0;

            StatusIcon icon = new StatusIcon();

            mockIconProvider.ExpectAndReturn("GetStatusIconForState", icon, ProjectState.Building);

            ProjectStateIconAdaptor adaptor = new ProjectStateIconAdaptor(monitor, iconProvider);

            adaptor.IconChanged += new EventHandler(IconChanged);

            Assert.AreEqual(0, iconChangedCount);

            StatusIcon icon2 = new StatusIcon();

            adaptor.StatusIcon = icon2;
            Assert.AreEqual(1, iconChangedCount);

            adaptor.StatusIcon = icon2;
            Assert.AreEqual(1, iconChangedCount);
        }