public void can_get_projects_from_a_uri()
        {
            var       aWellKnownUri    = new Uri("http://ccnetlive.thoughtworks.com/ccnet/XmlStatusReport.aspx");
            IResolver dashboarResolver = new HttpProjectXmlResolver(aWellKnownUri);

            Assert.That(dashboarResolver.GetProjectStatusList().Count, Is.EqualTo(6));
        }
        public void a_connectivity_exception_will_be_thrown_if_the_uri_isnt_resolveable()
        {
            var       anUnresolveableUri = new Uri("http://a.b.c.d.e.foo/ccnet/xmlstatusreport.aspx");
            IResolver dashboardResolver  = new HttpProjectXmlResolver(anUnresolveableUri);

            dashboardResolver.GetProjectStatusList();
        }
        public void build_status_is_building_if_building_and_last_build_status_was_failure()
        {
            const string ProjectXml = @"<Projects>
                                        <Project name='FooProject' category='' activity='Building' lastBuildStatus='Failure' lastBuildLabel='292' lastBuildTime='2007-11-16T15:03:46.358374-05:00' nextBuildTime='2007-11-16T15:31:00.2683768-05:00' webUrl='http://foo/ccnet'/>
                                    </Projects>";

            _mockWebClient.Stub(w => w.DownloadString(_uri)).Return(ProjectXml);

            IList <ProjectStatus> statuses = _resolver.GetProjectStatusList();

            Assert.That(statuses[0].CurrentBuildStatus, Is.EqualTo("Building"));
        }
        public void explicit_include_only_shows_those_that_match_worded_regex()
        {
            const string ProjectXml = @"<Projects>
                                <Project name='FooProject' category='' activity='Sleeping' lastBuildStatus='Success' lastBuildLabel='292' lastBuildTime='2007-11-16T15:03:46.358374-05:00' nextBuildTime='2007-11-16T15:31:00.2683768-05:00' webUrl='http://foo/ccnet'/>
                                <Project name='BarProject' category='' activity='Sleeping' lastBuildStatus='Failure' lastBuildLabel='8' lastBuildTime='2007-11-16T05:00:00.2127436-05:00' nextBuildTime='2007-11-17T05:00:00-05:00' webUrl='http://foo/ccnet'/>
                                <Project name='One_More_Project' category='' activity='Sleeping' lastBuildStatus='Failure' lastBuildLabel='39' lastBuildTime='2007-11-16T05:50:00.1105168-05:00' nextBuildTime='2007-11-17T05:50:00-05:00' webUrl='http://foo/ccnet'/>
                           </Projects>";

            _mockWebClient.Stub(w => w.DownloadString(_uri)).Return(ProjectXml);

            var resolver = new HttpProjectXmlResolver(new Uri(_uri))
            {
                WebClient = _mockWebClient, ExplicitInclude = new Regex("BarProject")
            };

            IList <ProjectStatus> statuses = resolver.GetProjectStatusList();

            Assert.That(statuses.Count, Is.EqualTo(1));
            Assert.That(statuses[0].Name, Is.EqualTo("BarProject"));
        }
		public void can_get_projects_from_a_uri()
		{
			var aWellKnownUri = new Uri("http://ccnetlive.thoughtworks.com/ccnet/XmlStatusReport.aspx");
			IResolver dashboarResolver = new HttpProjectXmlResolver(aWellKnownUri);
			Assert.That(dashboarResolver.GetProjectStatusList().Count, Is.EqualTo(6));
		}
		public void a_connectivity_exception_will_be_thrown_if_the_uri_isnt_resolveable()
		{
			var anUnresolveableUri = new Uri("http://a.b.c.d.e.foo/ccnet/xmlstatusreport.aspx");
			IResolver dashboardResolver = new HttpProjectXmlResolver(anUnresolveableUri);
			dashboardResolver.GetProjectStatusList();
		}
        public void explicit_include_only_shows_those_that_match_multiple_explicit_regex()
        {
            const string ProjectXml = @"<Projects>
                                <Project name='FooProject' category='' activity='Sleeping' lastBuildStatus='Success' lastBuildLabel='292' lastBuildTime='2007-11-16T15:03:46.358374-05:00' nextBuildTime='2007-11-16T15:31:00.2683768-05:00' webUrl='http://foo/ccnet'/>
                                <Project name='BarProject' category='' activity='Sleeping' lastBuildStatus='Failure' lastBuildLabel='8' lastBuildTime='2007-11-16T05:00:00.2127436-05:00' nextBuildTime='2007-11-17T05:00:00-05:00' webUrl='http://foo/ccnet'/>
                                <Project name='FunProject' category='' activity='Sleeping' lastBuildStatus='Failure' lastBuildLabel='39' lastBuildTime='2007-11-16T05:50:00.1105168-05:00' nextBuildTime='2007-11-17T05:50:00-05:00' webUrl='http://foo/ccnet'/>
                           </Projects>";

            _mockWebClient.Stub(w => w.DownloadString(_uri)).Return(ProjectXml);

            var resolver = new HttpProjectXmlResolver(new Uri(_uri)) { WebClient = _mockWebClient, ExplicitInclude = new Regex("FooProject|BarProject") };

            IList<ProjectStatus> statuses = resolver.GetProjectStatusList();
            Assert.That(statuses.Count, Is.EqualTo(2));
            Assert.That(statuses[0].Name, Is.EqualTo("FooProject"));
            Assert.That(statuses[1].Name, Is.EqualTo("BarProject"));
        }