コード例 #1
0
		public void Can_resolve_uri()
		{
			var url = string.Format("{0}/status?oauth_consumer_key={1}", API_URL, _consumerKey);
			var request = new GetRequest(url, new Dictionary<string, string>());

			var response = new GzipHttpClient().Get(request);
			AssertResponse(response, HttpStatusCode.OK);
		}
コード例 #2
0
		public void Can_resolve_uri_that_returns_gzip()
		{
			var url = string.Format("{0}/release/details?oauth_consumer_key={1}&releaseId=12345", API_URL, _consumerKey);
			var request = new GetRequest(url, new Dictionary<string, string>());

			var response = new GzipHttpClient().Get(request);
			AssertResponse(response, HttpStatusCode.OK);
			AssertCanParseBody(response);
		}
コード例 #3
0
		public void Bad_url_should_return_not_found()
		{
			var url = string.Format("{0}/foo/bar/fish/1234?oauth_consumer_key={1}", API_URL, _consumerKey);
			var request = new GetRequest(url, new Dictionary<string, string>());

			var response = new GzipHttpClient().Get(request);
			AssertResponse(response, HttpStatusCode.NotFound);
		}
コード例 #4
0
		public void bad_url_post__should_return_not_found()
		{
			var url = string.Format("{0}/foo/bar/fish/1234?oauth_consumer_key={1}", API_URL, _consumerKey);
			var parameters = new Dictionary<string, string>
			                 {
			                 	{"foo", "bar"}
			                 };

			var request = new PostRequest(url, new Dictionary<string, string>(), parameters);

			var response = new GzipHttpClient().Post(request);
			AssertResponse(response, HttpStatusCode.NotFound);
		}
コード例 #5
0
		public void Can_cope_with_timeouts()
		{
			const string apiUrl = "http://hanging-web-app.7digital.local";
			var request = new GetRequest(apiUrl, new Dictionary<string, string>());

			var response = new GzipHttpClient().Get(request);
			AssertResponse(response, HttpStatusCode.OK);
		}
コード例 #6
0
		public void No_key_should_return_unauthorized()
		{
			var url = string.Format("{0}/status", API_URL);
			var request = new GetRequest(url, new Dictionary<string, string>());

			var response = new GzipHttpClient().Get(request);
			AssertResponse(response, HttpStatusCode.Unauthorized);
		}