Files
octokit.net/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs
Haacked a1887837be Implement 403 exception handling
This implements exception handling for the various 403 cases based off
of the Octokit.rb implementation.
https://github.com/octokit/octokit.rb/blob/master/lib/octokit/error.rb

Fixes #85
2013-10-17 22:22:56 -07:00

24 lines
797 B
C#

using System.Net;
using Octokit.Internal;
using Xunit;
namespace Octokit.Tests.Exceptions
{
public class ForbiddenExceptionTests
{
public class TheConstructor
{
[Fact]
public void IdentifiesMaxLoginAttepmtsExceededReason()
{
const string responseBody = "{\"message\":\"YOU SHALL NOT PASS!\"," +
"\"documentation_url\":\"http://developer.github.com/v3\"}";
var response = new ApiResponse<object> { Body = responseBody, StatusCode = HttpStatusCode.Forbidden };
var forbiddenException = new ForbiddenException(response);
Assert.Equal("YOU SHALL NOT PASS!", forbiddenException.ApiError.Message);
}
}
}
}