mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 04:40:54 +00:00
rewrite the setup of responses to use a standard helper function (#2177)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NSubstitute;
|
||||
@@ -7,6 +8,8 @@ using Octokit.Internal;
|
||||
using Octokit.Reactive;
|
||||
using Xunit;
|
||||
|
||||
using static Octokit.Internal.TestSetup;
|
||||
|
||||
namespace Octokit.Tests.Reactive
|
||||
{
|
||||
public class ObservableIssueTimelineClientTests
|
||||
@@ -33,10 +36,8 @@ namespace Octokit.Tests.Reactive
|
||||
var client = new ObservableIssueTimelineClient(gitHubClient);
|
||||
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(
|
||||
new Response
|
||||
{
|
||||
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
|
||||
}, result);
|
||||
CreateResponse(HttpStatusCode.OK),
|
||||
result);
|
||||
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview+json")
|
||||
.Returns(Task.FromResult(response));
|
||||
|
||||
@@ -58,11 +59,7 @@ namespace Octokit.Tests.Reactive
|
||||
var gitHubClient = new GitHubClient(connection);
|
||||
var client = new ObservableIssueTimelineClient(gitHubClient);
|
||||
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(
|
||||
new Response
|
||||
{
|
||||
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
|
||||
}, result);
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(CreateResponse(HttpStatusCode.OK), result);
|
||||
gitHubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview+json")
|
||||
.Returns(Task.FromResult(response));
|
||||
|
||||
@@ -83,11 +80,7 @@ namespace Octokit.Tests.Reactive
|
||||
var githubClient = new GitHubClient(connection);
|
||||
var client = new ObservableIssueTimelineClient(githubClient);
|
||||
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(
|
||||
new Response
|
||||
{
|
||||
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
|
||||
}, result);
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(CreateResponse(HttpStatusCode.OK), result);
|
||||
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Args.EmptyDictionary, "application/vnd.github.mockingbird-preview+json")
|
||||
.Returns(Task.FromResult(response));
|
||||
|
||||
@@ -108,11 +101,7 @@ namespace Octokit.Tests.Reactive
|
||||
var githubClient = new GitHubClient(connection);
|
||||
var client = new ObservableIssueTimelineClient(githubClient);
|
||||
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(
|
||||
new Response
|
||||
{
|
||||
ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
|
||||
}, result);
|
||||
IApiResponse<List<TimelineEventInfo>> response = new ApiResponse<List<TimelineEventInfo>>(CreateResponse(HttpStatusCode.OK), result);
|
||||
githubClient.Connection.Get<List<TimelineEventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 1), "application/vnd.github.mockingbird-preview+json")
|
||||
.Returns(Task.FromResult(response));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user