mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 19:26:51 +00:00
Make Response.StatusCode readonly
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
@@ -43,7 +44,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "repos/foo/bar/assignees/cody"),
|
||||
null, null).Returns(response);
|
||||
@@ -60,7 +61,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "repos/foo/bar/assignees/cody"),
|
||||
null, null).Returns(response);
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Octokit.Tests.Clients
|
||||
client.Put<Authorization>(Args.Uri, Args.Object, Args.String)
|
||||
.ThrowsAsync<Authorization>(
|
||||
new AuthorizationException(
|
||||
new Response { StatusCode = HttpStatusCode.Unauthorized }));
|
||||
new Response(HttpStatusCode.Unauthorized , null, new Dictionary<string, string>(), "application/json")));
|
||||
var authEndpoint = new AuthorizationsClient(client);
|
||||
|
||||
await AssertEx.Throws<TwoFactorChallengeFailedException>(async () =>
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "user/following/alfhenrik"),
|
||||
null, null).Returns(response);
|
||||
@@ -129,7 +129,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "user/following/alfhenrik"),
|
||||
null, null).Returns(response);
|
||||
@@ -159,7 +159,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "users/alfhenrik/following/alfhenrik-test"),
|
||||
null, null).Returns(response);
|
||||
@@ -176,7 +176,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "users/alfhenrik/following/alfhenrik-test"),
|
||||
null, null).Returns(response);
|
||||
@@ -208,7 +208,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Put<object>(Arg.Is<Uri>(u => u.ToString() == "user/following/alfhenrik"),
|
||||
Args.Object).Returns(response);
|
||||
@@ -225,7 +225,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Put<object>(Arg.Is<Uri>(u => u.ToString() == "user/following/alfhenrik"),
|
||||
new { }).Returns(response);
|
||||
|
||||
@@ -195,7 +195,7 @@ public class GistsClientTests
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "gists/1/star"),
|
||||
null, null).Returns(response);
|
||||
@@ -212,7 +212,7 @@ public class GistsClientTests
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "gists/1/star"),
|
||||
null, null).Returns(response);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
@@ -100,7 +101,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/members/username"),
|
||||
null, null).Returns(response);
|
||||
@@ -117,7 +118,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/members/username"),
|
||||
null, null).Returns(response);
|
||||
@@ -148,7 +149,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/public_members/username"),
|
||||
null, null).Returns(response);
|
||||
@@ -165,7 +166,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/public_members/username"),
|
||||
null, null).Returns(response);
|
||||
@@ -220,7 +221,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Put<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/public_members/username"),
|
||||
Args.Object).Returns(response);
|
||||
@@ -237,7 +238,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Put<object>(Arg.Is<Uri>(u => u.ToString() == "orgs/org/public_members/username"),
|
||||
new { }).Returns(response);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
using Octokit.Tests.Helpers;
|
||||
@@ -55,7 +56,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "repos/owner/test/collaborators/user1"),
|
||||
null, null).Returns(response);
|
||||
@@ -72,7 +73,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ThrowsExceptionForInvalidStatusCode()
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Conflict }));
|
||||
new ApiResponse<object>(new Response(HttpStatusCode.Conflict , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "repos/foo/bar/assignees/cody"),
|
||||
null, null).Returns(response);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Octokit.Internal;
|
||||
using System.Collections.Generic;
|
||||
using Octokit.Internal;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
@@ -63,7 +64,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Get<object>(Arg.Is<Uri>(u => u.ToString() == "user/starred/yes/no"), null, null)
|
||||
.Returns(response);
|
||||
@@ -86,7 +87,7 @@ namespace Octokit.Tests.Clients
|
||||
public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected)
|
||||
{
|
||||
var response = Task.Factory.StartNew<IApiResponse<object>>(() =>
|
||||
new ApiResponse<object>(new Response { StatusCode = status }));
|
||||
new ApiResponse<object>(new Response(status , null, new Dictionary<string, string>(), "application/json")));
|
||||
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.Put<object>(Arg.Is<Uri>(u => u.ToString() == "user/starred/yes/no"),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
@@ -77,7 +78,7 @@ namespace Octokit.Tests.Clients
|
||||
var endpoint = new Uri("repos/fight/club/subscription", UriKind.Relative);
|
||||
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var response = new Response { StatusCode = HttpStatusCode.NotFound };
|
||||
var response = new Response(HttpStatusCode.NotFound, null, new Dictionary<string, string>(), "application/json");
|
||||
connection.Get<Subscription>(endpoint).Returns(x =>
|
||||
{
|
||||
throw new NotFoundException(response);
|
||||
|
||||
@@ -32,10 +32,7 @@ namespace Octokit.Tests.Exceptions
|
||||
[Fact]
|
||||
public void ProvidesDefaultMessage()
|
||||
{
|
||||
var response = new Response
|
||||
{
|
||||
StatusCode = (HttpStatusCode)422
|
||||
};
|
||||
var response = new Response((HttpStatusCode)422, null, new Dictionary<string, string>(), "application/json");
|
||||
|
||||
var exception = new ApiValidationException(response);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Octokit.Tests.Exceptions
|
||||
[Fact]
|
||||
public void HasDefaultMessage()
|
||||
{
|
||||
var response = new Response { StatusCode = HttpStatusCode.Forbidden };
|
||||
var response = new Response(HttpStatusCode.Forbidden , null, new Dictionary<string, string>(), "application/json");
|
||||
var forbiddenException = new ForbiddenException(response);
|
||||
|
||||
Assert.Equal("Request Forbidden", forbiddenException.Message);
|
||||
|
||||
@@ -16,10 +16,7 @@ namespace Octokit.Tests.Exceptions
|
||||
[Fact]
|
||||
public void SetsDefaultMessage()
|
||||
{
|
||||
var response = new Response
|
||||
{
|
||||
StatusCode = HttpStatusCode.Forbidden
|
||||
};
|
||||
var response = new Response(HttpStatusCode.Forbidden, null, new Dictionary<string, string>(), "application/json");
|
||||
|
||||
var exception = new LoginAttemptsExceededException(response);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Octokit.Tests.Exceptions
|
||||
{"X-RateLimit-Remaining", "42"},
|
||||
{"X-RateLimit-Reset", "1372700873"}
|
||||
};
|
||||
var response = new Response(headers) { StatusCode = HttpStatusCode.Forbidden };
|
||||
var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json");
|
||||
|
||||
var exception = new RateLimitExceededException(response);
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Octokit.Tests.Exceptions
|
||||
{"X-RateLimit-Remaining", "XXXX"},
|
||||
{"X-RateLimit-Reset", "XXXX"}
|
||||
};
|
||||
var response = new Response(headers) { StatusCode = HttpStatusCode.Forbidden };
|
||||
var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json");
|
||||
|
||||
var exception = new RateLimitExceededException(response);
|
||||
|
||||
@@ -63,10 +63,7 @@ namespace Octokit.Tests.Exceptions
|
||||
[Fact]
|
||||
public void HandlesMissingHeaderValues()
|
||||
{
|
||||
var response = new Response(new Dictionary<string, string>())
|
||||
{
|
||||
StatusCode = HttpStatusCode.Forbidden
|
||||
};
|
||||
var response = new Response(HttpStatusCode.Forbidden, null, new Dictionary<string, string>(), "application/json");
|
||||
var exception = new RateLimitExceededException(response);
|
||||
|
||||
Assert.Equal(HttpStatusCode.Forbidden, exception.StatusCode);
|
||||
@@ -88,7 +85,7 @@ namespace Octokit.Tests.Exceptions
|
||||
{"X-RateLimit-Remaining", "42"},
|
||||
{"X-RateLimit-Reset", "1372700873"}
|
||||
};
|
||||
var response = new Response(headers) { StatusCode = HttpStatusCode.Forbidden };
|
||||
var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json");
|
||||
|
||||
var exception = new RateLimitExceededException(response);
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ namespace Octokit.Tests.Exceptions
|
||||
[Fact]
|
||||
public void SetsDefaultMessage()
|
||||
{
|
||||
var response = new Response
|
||||
{
|
||||
StatusCode = HttpStatusCode.Unauthorized
|
||||
};
|
||||
var response = new Response(HttpStatusCode.Unauthorized, null, new Dictionary<string, string>(), "application/json");
|
||||
|
||||
var exception = new TwoFactorRequiredException(response, TwoFactorType.Sms);
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Octokit.Tests.Http
|
||||
var queuedOperationUrl = new Uri("anything", UriKind.Relative);
|
||||
|
||||
const HttpStatusCode statusCode = HttpStatusCode.OK;
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response {StatusCode = statusCode}, new object());
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response(statusCode, null, new Dictionary<string, string>(), "application/json"), new object());
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl,Args.CancellationToken).Returns(Task.FromResult(response));
|
||||
var apiConnection = new ApiConnection(connection);
|
||||
@@ -324,7 +324,7 @@ namespace Octokit.Tests.Http
|
||||
var queuedOperationUrl = new Uri("anything", UriKind.Relative);
|
||||
|
||||
const HttpStatusCode statusCode = HttpStatusCode.PartialContent;
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response { StatusCode = statusCode }, new object());
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response(statusCode, null, new Dictionary<string, string>(), "application/json"), new object());
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl, Args.CancellationToken).Returns(Task.FromResult(response));
|
||||
var apiConnection = new ApiConnection(connection);
|
||||
@@ -339,7 +339,7 @@ namespace Octokit.Tests.Http
|
||||
|
||||
var result = new object();
|
||||
const HttpStatusCode statusCode = HttpStatusCode.OK;
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response { StatusCode = statusCode }, result);
|
||||
IApiResponse<object> response = new ApiResponse<object>(new Response(statusCode, null, new Dictionary<string, string>(), "application/json"), result);
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl, Args.CancellationToken).Returns(Task.FromResult(response));
|
||||
var apiConnection = new ApiConnection(connection);
|
||||
@@ -354,8 +354,8 @@ namespace Octokit.Tests.Http
|
||||
var queuedOperationUrl = new Uri("anything", UriKind.Relative);
|
||||
|
||||
var result = new object();
|
||||
IApiResponse<object> firstResponse = new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Accepted }, result);
|
||||
IApiResponse<object> completedResponse = new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.OK }, result);
|
||||
IApiResponse<object> firstResponse = new ApiResponse<object>(new Response(HttpStatusCode.Accepted, null, new Dictionary<string, string>(), "application/json"), result);
|
||||
IApiResponse<object> completedResponse = new ApiResponse<object>(new Response(HttpStatusCode.OK, null, new Dictionary<string, string>(), "application/json"), result);
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl, Args.CancellationToken)
|
||||
.Returns(x => Task.FromResult(firstResponse),
|
||||
@@ -374,7 +374,7 @@ namespace Octokit.Tests.Http
|
||||
var queuedOperationUrl = new Uri("anything", UriKind.Relative);
|
||||
|
||||
var result = new object();
|
||||
IApiResponse<object> accepted = new ApiResponse<object>(new Response { StatusCode = HttpStatusCode.Accepted }, result);
|
||||
IApiResponse<object> accepted = new ApiResponse<object>(new Response(HttpStatusCode.Accepted, null, new Dictionary<string, string>(), "application/json"), result);
|
||||
var connection = Substitute.For<IConnection>();
|
||||
connection.GetResponse<object>(queuedOperationUrl, Args.CancellationToken).Returns(x => Task.FromResult(accepted));
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Octokit.Tests.Http
|
||||
public async Task ThrowsAuthorizationExceptionExceptionForUnauthorizedResponse()
|
||||
{
|
||||
var httpClient = Substitute.For<IHttpClient>();
|
||||
IResponse response = new Response { StatusCode = HttpStatusCode.Unauthorized };
|
||||
IResponse response = new Response(HttpStatusCode.Unauthorized, null, new Dictionary<string, string>(), "application/json");
|
||||
httpClient.Send(Args.Request, Args.CancellationToken).Returns(Task.FromResult(response));
|
||||
var connection = new Connection(new ProductHeaderValue("OctokitTests"),
|
||||
_exampleUri,
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Octokit.Internal
|
||||
public object Body { get; private set; }
|
||||
public IReadOnlyDictionary<string, string> Headers { get; private set; }
|
||||
public ApiInfo ApiInfo { get; private set; }
|
||||
public HttpStatusCode StatusCode { get; set; }
|
||||
public HttpStatusCode StatusCode { get; private set; }
|
||||
public string ContentType { get; private set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user