Fetch() public method

public Fetch ( ) : IEnumerable
return IEnumerable
        public void can_get_projects_from_a_realaddress()
        {
            var fetcher =
                new BuildDataFetcher(new CruiseAddress("http://ccnetlive.thoughtworks.com/ccnet/XmlStatusReport.aspx"),
                                     _configSettings, _factory);

            Assert.That(fetcher.Fetch().Length, Is.GreaterThan(0));
            Assert.That(fetcher.Fetch(), Text.Contains("Ivy").IgnoreCase);
        }
        public void CanUpdateSettings()
        {
            var fetcher = new BuildDataFetcher(new CruiseAddress("http://bla"), new ConfigSettings { URL = "http://bla" }, _webClientFactory);
            fetcher.Fetch();
            _webClient.AssertWasCalled(w => w.DownloadString(new Uri("http://bla")), w=>w.Repeat.Once());
            _webClient.AssertWasNotCalled(w => w.DownloadString(new Uri("http://new")));

            fetcher.ConfigUpdated(new ConfigSettings { URL = "http://new"});
            fetcher.Fetch();
            _webClient.AssertWasCalled(w => w.DownloadString(new Uri("http://new")), w=>w.Repeat.Once());
        }
        public void a_connectivity_exception_will_be_thrown_if_the_uri_isnt_resolveable()
        {
            Assert.Throws<FetchException>(() =>
                                          {
                                          	var fetcher = new BuildDataFetcher(
                                          		new CruiseAddress("http://a.b.c.d.e.foo/ccnet/XmlStatusReport.aspx"), _configSettings, _factory);

                                          	fetcher.Fetch();
                                          }, "Unable to contact http://a.b.c.d.e.foo/ccnet/XmlStatusReport.aspx");
        }
        public void can_get_projects_from_a_realaddress()
        {
            var fetcher =
                new BuildDataFetcher(new ViewUrl("http://ccnetlive.thoughtworks.com/ccnet/XmlStatusReport.aspx"),
                                     _configSettings, _factory);

            var fetch = fetcher.Fetch();
            fetch.Count().ShouldBeGreaterThan(0);
            fetch.ShouldContain(@"Project name=""CCNet""");
        }
        public void CanFetch()
        {
            const string Hello = "hello";

            _webClient.Expect(w => w.DownloadString(Arg<Uri>.Is.Anything)).Return(Hello);

            var fetcher = new BuildDataFetcher(new CruiseAddress("http://test"), new ConfigSettings(), _webClientFactory);
            var fetchValue = fetcher.Fetch();

            Assert.That(fetchValue, Is.EqualTo(Hello));
        }
        public void CanFetch()
        {
            const string Hello = "hello";

            _webClient.Expect(w => w.DownloadString(Arg<string>.Is.Anything)).Return(Hello);

            var fetcher = new BuildDataFetcher(new ViewUrl("http://test"), new ConfigSettings(), _webClientFactory);
            var fetchValue = fetcher.Fetch();

            fetchValue.First().ShouldBe(Hello);
        }
        public void can_fetch_multiple_urls()
        {
            _webClient.Expect(w => w.DownloadString(Arg<string>.Is.Anything)).Return("url1").Repeat.Once();
            _webClient.Expect(w => w.DownloadString(Arg<string>.Is.Anything)).Return("url2").Repeat.Once();

            var fetcher = new BuildDataFetcher(new ViewUrl("http://url1 http://url2"),
                new ConfigSettings(), _webClientFactory);

            var xmlResults = fetcher.Fetch().ToList();

            xmlResults.Count.ShouldBe(2);
            xmlResults[0].ShouldBe("url1");
            xmlResults[1].ShouldBe("url2");

            _webClient.AssertWasCalled(w => w.DownloadString(Arg<string>.Is.Equal(new Uri("http://url1"))));
            _webClient.AssertWasCalled(w => w.DownloadString(Arg<string>.Is.Equal(new Uri("http://url2"))));
        }
 public void CanThrow_If_Invalid()
 {
     var fetcher = new BuildDataFetcher(new CruiseAddress(""), new ConfigSettings(), _webClientFactory);
     Assert.Throws<FetchException>(() => fetcher.Fetch());
 }
示例#9
0
 void FetchData(object sender, DoWorkEventArgs e)
 {
     e.Result = _fetcher.Fetch();
 }