port a client to use the new tests

This commit is contained in:
Brendan Forster
2020-03-30 12:14:14 -03:00
parent b86331a640
commit e41b2d19d7

View File

@@ -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);