mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
port a client to use the new tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using Octokit.Internal;
|
using Octokit.Internal;
|
||||||
@@ -231,7 +232,9 @@ namespace Octokit.Tests.Clients
|
|||||||
var endpoint = new Uri("repos/fight/club/subscription", UriKind.Relative);
|
var endpoint = new Uri("repos/fight/club/subscription", UriKind.Relative);
|
||||||
|
|
||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var response = new Response(HttpStatusCode.NotFound, null, new Dictionary<string, string>(), "application/json");
|
var response = new HttpResponseMessage();
|
||||||
|
response.StatusCode = HttpStatusCode.NotFound;
|
||||||
|
response.Headers.Add("Content-Type", "application/json");
|
||||||
connection.Get<Subscription>(endpoint).Returns<Task<Subscription>>(x =>
|
connection.Get<Subscription>(endpoint).Returns<Task<Subscription>>(x =>
|
||||||
{
|
{
|
||||||
throw new NotFoundException(response);
|
throw new NotFoundException(response);
|
||||||
@@ -250,7 +253,11 @@ namespace Octokit.Tests.Clients
|
|||||||
var endpoint = new Uri("repositories/1/subscription", UriKind.Relative);
|
var endpoint = new Uri("repositories/1/subscription", UriKind.Relative);
|
||||||
|
|
||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var response = new Response(HttpStatusCode.NotFound, null, new Dictionary<string, string>(), "application/json");
|
|
||||||
|
var response = new HttpResponseMessage();
|
||||||
|
response.StatusCode = HttpStatusCode.NotFound;
|
||||||
|
response.Headers.Add("Content-Type", "application/json");
|
||||||
|
|
||||||
connection.Get<Subscription>(endpoint).Returns<Task<Subscription>>(x =>
|
connection.Get<Subscription>(endpoint).Returns<Task<Subscription>>(x =>
|
||||||
{
|
{
|
||||||
throw new NotFoundException(response);
|
throw new NotFoundException(response);
|
||||||
|
|||||||
Reference in New Issue
Block a user