예제 #1
0
        public void should_add_single_segment_url_segments(string url, string result)
        {
            var request = new HttpRequest(url);

            request.AddSegment("seg", "dir");

            request.Url.Should().Be(result);
        }
예제 #2
0
        public List <Episode> GetEpisodeInfo(int tvdbSeriesId)
        {
            var httpRequest = new HttpRequest("http://thetvdb.com/data/series/{tvdbId}/all/");

            httpRequest.AddSegment("tvdbId", tvdbSeriesId.ToString());
            var response = _httpClient.Get(httpRequest);

            var xml      = XDocument.Load(new StringReader(response.Content));
            var episodes = xml.Descendants("Episode").Select(MapEpisode).ToList();

            return(episodes);
        }
예제 #3
0
        public void shouldnt_add_value_for_nonexisting_segment()
        {
            var request = new HttpRequest("http://host/{seg}/some");

            Assert.Throws <InvalidOperationException>(() => request.AddSegment("seg2", "dir"));
        }