Move error handling to Connection

The adapter shouldn't be responsible for translating errors
into the proper exception.
This commit is contained in:
Haacked
2013-09-30 10:45:03 -07:00
parent a8a5249726
commit 372fd25914
4 changed files with 53 additions and 36 deletions
@@ -74,23 +74,6 @@ namespace Octokit.Tests.Http
Assert.Equal("{}", response.Body);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
[Fact]
public async Task ThrowsExceptionWhenForbidden()
{
var responseMessage = new HttpResponseMessage {
StatusCode = HttpStatusCode.Forbidden,
Headers =
{
{"peanut", "butter"},
}
};
var tester = new HttpClientAdapterTester();
var exception = await AssertEx.Throws<AuthenticationException>(async () =>
await tester.BuildResponseTester<string>(responseMessage));
Assert.Equal(HttpStatusCode.Forbidden, exception.StatusCode);
}
}
sealed class HttpClientAdapterTester : HttpClientAdapter