Fix xUnit Warnings (#2906)

* Fix xUnit Warnings

* Fix

* Fix formatting in AsyncPaginationExtensionGenerator.cs

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
This commit is contained in:
Tom Longhurst
2024-04-15 21:19:26 +01:00
committed by GitHub
parent 4ca8f1cd2c
commit cd1835326b
83 changed files with 543 additions and 538 deletions

View File

@@ -26,8 +26,8 @@ namespace Octokit.Generators
class AsyncPaginationExtensionsGenerator class AsyncPaginationExtensionsGenerator
{ {
private const string HEADER = ( private const string HEADER = (
@"using System; @"using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Octokit.AsyncPaginationExtension namespace Octokit.AsyncPaginationExtension
@@ -44,8 +44,8 @@ namespace Octokit.AsyncPaginationExtension
private const int DEFAULT_PAGE_SIZE = 30; private const int DEFAULT_PAGE_SIZE = 30;
"); ");
private const string FOOTER = ( private const string FOOTER = (
@" @"
} }
}"); }");
@@ -63,15 +63,17 @@ namespace Octokit.AsyncPaginationExtension
var enumOptions = new EnumerationOptions { RecurseSubdirectories = true }; var enumOptions = new EnumerationOptions { RecurseSubdirectories = true };
var paginatedCallRegex = new Regex(@".*Task<IReadOnlyList<(?<returnType>\w+)>>\s*(?<name>\w+)(?<template><.*>)?\((?<arg>.*?)(, )?ApiOptions \w*\);"); var paginatedCallRegex = new Regex(@".*Task<IReadOnlyList<(?<returnType>\w+)>>\s*(?<name>\w+)(?<template><.*>)?\((?<arg>.*?)(, )?ApiOptions \w*\);");
foreach (var file in Directory.EnumerateFiles(root, "I*.cs", enumOptions)) { foreach (var file in Directory.EnumerateFiles(root, "I*.cs", enumOptions))
var type = Path.GetFileNameWithoutExtension(file); {
var type = Path.GetFileNameWithoutExtension(file);
foreach (var line in File.ReadAllLines(file)) { foreach (var line in File.ReadAllLines(file))
var match = paginatedCallRegex.Match(line); {
var match = paginatedCallRegex.Match(line);
if (!match.Success) { continue; } if (!match.Success) { continue; }
sb.Append(BuildBodyFromTemplate(match, type)); sb.Append(BuildBodyFromTemplate(match, type));
} }
} }
sb.Append(FOOTER); sb.Append(FOOTER);
@@ -101,12 +103,14 @@ namespace Octokit.AsyncPaginationExtension
: $"options => t.{name}{templateStr}({string.Join(' ', splitArgs.Where((_, i) => i % 2 == 1))}, options)"; : $"options => t.{name}{templateStr}({string.Join(' ', splitArgs.Where((_, i) => i % 2 == 1))}, options)";
var docArgs = string.Join(", ", splitArgs.Where((_, i) => i % 2 == 0)).Replace('<', '{').Replace('>', '}'); var docArgs = string.Join(", ", splitArgs.Where((_, i) => i % 2 == 0)).Replace('<', '{').Replace('>', '}');
if (docArgs.Length != 0) { if (docArgs.Length != 0)
docArgs += ", "; {
docArgs += ", ";
} }
if (arg.Length != 0) { if (arg.Length != 0)
arg += ", "; {
arg += ", ";
} }
return ($@" return ($@"

View File

@@ -421,7 +421,7 @@ namespace Octokit.Tests.Integration.Clients
var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryOwner, repoContext.RepositoryName, created.Id); var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryOwner, repoContext.RepositoryName, created.Id);
// Check result // Check result
Assert.Equal(1, annotations.Count); Assert.Single(annotations);
Assert.Equal("this is a warning", annotations.First().Message); Assert.Equal("this is a warning", annotations.First().Message);
Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel); Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel);
} }
@@ -454,7 +454,7 @@ namespace Octokit.Tests.Integration.Clients
var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryId, created.Id); var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryId, created.Id);
// Check result // Check result
Assert.Equal(1, annotations.Count); Assert.Single(annotations);
Assert.Equal("this is a warning", annotations.First().Message); Assert.Equal("this is a warning", annotations.First().Message);
Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel); Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel);
} }

View File

@@ -97,7 +97,7 @@ public class CommitCommentReactionsClientTests
}; };
var reactions = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options); var reactions = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Id, reactions[0].Id);
Assert.Equal(reaction.Content, reactions[0].Content); Assert.Equal(reaction.Content, reactions[0].Content);
@@ -132,7 +132,7 @@ public class CommitCommentReactionsClientTests
}; };
var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options); var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id);
Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content);
@@ -173,8 +173,8 @@ public class CommitCommentReactionsClientTests
}; };
var secondPage = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, skipStartOptions); var secondPage = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }
@@ -225,7 +225,7 @@ public class CommitCommentReactionsClientTests
}; };
var reactions = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options); var reactions = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Id, reactions[0].Id);
Assert.Equal(reaction.Content, reactions[0].Content); Assert.Equal(reaction.Content, reactions[0].Content);
@@ -260,7 +260,7 @@ public class CommitCommentReactionsClientTests
}; };
var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options); var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id);
Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content);
@@ -301,8 +301,8 @@ public class CommitCommentReactionsClientTests
}; };
var secondPage = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, skipStartOptions); var secondPage = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }

View File

@@ -57,7 +57,7 @@ public class CommitStatusClientTests
var statuses = await github.Repository.Status.GetAll("rails", "rails", var statuses = await github.Repository.Status.GetAll("rails", "rails",
"94b857899506612956bb542e28e292308accb908", options); "94b857899506612956bb542e28e292308accb908", options);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
} }
[IntegrationTest] [IntegrationTest]
@@ -75,7 +75,7 @@ public class CommitStatusClientTests
var statuses = await github.Repository.Status.GetAll("rails", "rails", var statuses = await github.Repository.Status.GetAll("rails", "rails",
"94b857899506612956bb542e28e292308accb908", options); "94b857899506612956bb542e28e292308accb908", options);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
} }
[IntegrationTest] [IntegrationTest]
@@ -101,8 +101,8 @@ public class CommitStatusClientTests
var secondPage = await github.Repository.Status.GetAll("rails", "rails", "94b857899506612956bb542e28e292308accb908", skipStartOptions); var secondPage = await github.Repository.Status.GetAll("rails", "rails", "94b857899506612956bb542e28e292308accb908", skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
} }
@@ -120,7 +120,7 @@ public class CommitStatusClientTests
var statuses = await github.Repository.Status.GetAll(8514, var statuses = await github.Repository.Status.GetAll(8514,
"94b857899506612956bb542e28e292308accb908", options); "94b857899506612956bb542e28e292308accb908", options);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
} }
[IntegrationTest] [IntegrationTest]
@@ -138,7 +138,7 @@ public class CommitStatusClientTests
var statuses = await github.Repository.Status.GetAll(8514, var statuses = await github.Repository.Status.GetAll(8514,
"94b857899506612956bb542e28e292308accb908", options); "94b857899506612956bb542e28e292308accb908", options);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
} }
[IntegrationTest] [IntegrationTest]
@@ -164,8 +164,8 @@ public class CommitStatusClientTests
var secondPage = await github.Repository.Status.GetAll(8514, "94b857899506612956bb542e28e292308accb908", skipStartOptions); var secondPage = await github.Repository.Status.GetAll(8514, "94b857899506612956bb542e28e292308accb908", skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
} }
} }
@@ -247,7 +247,7 @@ public class CommitStatusClientTests
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha); var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
Assert.Equal(CommitState.Pending, statuses[0].State); Assert.Equal(CommitState.Pending, statuses[0].State);
} }
@@ -289,7 +289,7 @@ public class CommitStatusClientTests
var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha); var statuses = await _github.Repository.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, commit.Sha);
Assert.Equal(1, statuses.Count); Assert.Single(statuses);
Assert.Equal("default", statuses[0].Context); Assert.Equal("default", statuses[0].Context);
} }

View File

@@ -168,7 +168,7 @@ public class DeploymentStatusClientTests : IDisposable
var deploymentStatuses = await _deploymentsClient.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id, options); var deploymentStatuses = await _deploymentsClient.Status.GetAll(_context.RepositoryOwner, _context.RepositoryName, _deployment.Id, options);
Assert.Equal(1, deploymentStatuses.Count); Assert.Single(deploymentStatuses);
} }
[IntegrationTest] [IntegrationTest]
@@ -190,7 +190,7 @@ public class DeploymentStatusClientTests : IDisposable
var deploymentStatuses = await _deploymentsClient.Status.GetAll(_context.Repository.Id, _deployment.Id, options); var deploymentStatuses = await _deploymentsClient.Status.GetAll(_context.Repository.Id, _deployment.Id, options);
Assert.Equal(1, deploymentStatuses.Count); Assert.Single(deploymentStatuses);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -50,7 +50,7 @@ public class EnterpriseLdapClientTests : IDisposable
// Check response message indicates LDAP sync was queued // Check response message indicates LDAP sync was queued
Assert.NotNull(response); Assert.NotNull(response);
Assert.NotNull(response.Status); Assert.NotNull(response.Status);
Assert.True(response.Status == "queued"); Assert.Equal("queued", response.Status);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -79,7 +79,7 @@ public class EnterpriseLdapClientTests : IDisposable
// Check response message indicates LDAP sync was queued // Check response message indicates LDAP sync was queued
Assert.NotNull(response); Assert.NotNull(response);
Assert.NotNull(response.Status); Assert.NotNull(response.Status);
Assert.True(response.Status == "queued"); Assert.Equal("queued", response.Status);
} }
public void Dispose() public void Dispose()

View File

@@ -54,7 +54,7 @@ public class EnterprisePreReceiveEnvironmentsClientTests
var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options); var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options);
Assert.Equal(1, preReceiveEnvironments.Count); Assert.Single(preReceiveEnvironments);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -69,7 +69,7 @@ public class EnterprisePreReceiveEnvironmentsClientTests
var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options); var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options);
Assert.Equal(1, preReceiveEnvironments.Count); Assert.Single(preReceiveEnvironments);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]

View File

@@ -54,7 +54,7 @@ public class EnterprisePreReceiveHooksClientTests
var preReceiveHooks = await _preReceiveHooksClient.GetAll(options); var preReceiveHooks = await _preReceiveHooksClient.GetAll(options);
Assert.Equal(1, preReceiveHooks.Count); Assert.Single(preReceiveHooks);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -69,7 +69,7 @@ public class EnterprisePreReceiveHooksClientTests
var preReceiveHooks = await _preReceiveHooksClient.GetAll(options); var preReceiveHooks = await _preReceiveHooksClient.GetAll(options);
Assert.Equal(1, preReceiveHooks.Count); Assert.Single(preReceiveHooks);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]

View File

@@ -332,7 +332,7 @@ namespace Octokit.Tests.Integration.Clients
var pushPayload = pushEvent.Payload as PushEventPayload; var pushPayload = pushEvent.Payload as PushEventPayload;
Assert.NotNull(pushPayload); Assert.NotNull(pushPayload);
Assert.NotNull(pushPayload.Commits); Assert.NotNull(pushPayload.Commits);
Assert.Equal(1, pushPayload.Commits.Count); Assert.Single(pushPayload.Commits);
Assert.Equal("3cdcba0ccbea0e6d13ae94249fbb294d71648321", pushPayload.Commits.FirstOrDefault().Sha); Assert.Equal("3cdcba0ccbea0e6d13ae94249fbb294d71648321", pushPayload.Commits.FirstOrDefault().Sha);
Assert.Equal("3cdcba0ccbea0e6d13ae94249fbb294d71648321", pushPayload.Head); Assert.Equal("3cdcba0ccbea0e6d13ae94249fbb294d71648321", pushPayload.Head);
Assert.Equal("refs/heads/release-candidate", pushPayload.Ref); Assert.Equal("refs/heads/release-candidate", pushPayload.Ref);

View File

@@ -26,7 +26,7 @@ public class GitHubClientTests
var result = github.GetLastApiInfo(); var result = github.GetLastApiInfo();
Assert.True(result.Links.Count == 0); Assert.Equal(0, result.Links.Count);
Assert.True(result.AcceptedOauthScopes.Count > -1); Assert.True(result.AcceptedOauthScopes.Count > -1);
Assert.True(result.OauthScopes.Count > -1); Assert.True(result.OauthScopes.Count > -1);
Assert.False(string.IsNullOrEmpty(result.Etag)); Assert.False(string.IsNullOrEmpty(result.Etag));
@@ -67,8 +67,8 @@ public class GitHubClientTests
var result = github.GetLastApiInfo(); var result = github.GetLastApiInfo();
Assert.True(result.Links.Count == 0); Assert.Equal(0, result.Links.Count);
Assert.True(result.AcceptedOauthScopes.Count == 0); Assert.Equal(0, result.AcceptedOauthScopes.Count);
Assert.True(result.OauthScopes.Count > 0); Assert.True(result.OauthScopes.Count > 0);
Assert.False(string.IsNullOrEmpty(result.Etag)); Assert.False(string.IsNullOrEmpty(result.Etag));
Assert.True(result.RateLimit.Limit > 0); Assert.True(result.RateLimit.Limit > 0);

View File

@@ -68,7 +68,7 @@ public class IssueCommentReactionsClientTests
var reactions = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, options); var reactions = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reactions[0].Id, issueCommentReaction.Id); Assert.Equal(reactions[0].Id, issueCommentReaction.Id);
Assert.Equal(reactions[0].Content, issueCommentReaction.Content); Assert.Equal(reactions[0].Content, issueCommentReaction.Content);
@@ -103,7 +103,7 @@ public class IssueCommentReactionsClientTests
var reactionsInfo = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, options); var reactionsInfo = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactionsInfo[0].Id, reactions.Last().Id); Assert.Equal(reactionsInfo[0].Id, reactions.Last().Id);
Assert.Equal(reactionsInfo[0].Content, reactions.Last().Content); Assert.Equal(reactionsInfo[0].Content, reactions.Last().Content);
@@ -143,8 +143,8 @@ public class IssueCommentReactionsClientTests
}; };
var secondPage = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, skipStartOptions); var secondPage = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }
@@ -194,7 +194,7 @@ public class IssueCommentReactionsClientTests
var reactions = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, options); var reactions = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reactions[0].Id, issueCommentReaction.Id); Assert.Equal(reactions[0].Id, issueCommentReaction.Id);
Assert.Equal(reactions[0].Content, issueCommentReaction.Content); Assert.Equal(reactions[0].Content, issueCommentReaction.Content);
@@ -229,7 +229,7 @@ public class IssueCommentReactionsClientTests
var reactionsInfo = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, options); var reactionsInfo = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactionsInfo[0].Id, reactions.Last().Id); Assert.Equal(reactionsInfo[0].Id, reactions.Last().Id);
Assert.Equal(reactionsInfo[0].Content, reactions.Last().Content); Assert.Equal(reactionsInfo[0].Content, reactions.Last().Content);
@@ -269,8 +269,8 @@ public class IssueCommentReactionsClientTests
}; };
var secondPage = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, skipStartOptions); var secondPage = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }

View File

@@ -61,7 +61,7 @@ public class IssueReactionsClientTests
var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
Assert.Equal(1, issueReactions.Count); Assert.Single(issueReactions);
Assert.Equal(issueReaction.Id, issueReactions[0].Id); Assert.Equal(issueReaction.Id, issueReactions[0].Id);
Assert.Equal(issueReaction.Content, issueReactions[0].Content); Assert.Equal(issueReaction.Content, issueReactions[0].Content);
@@ -92,7 +92,7 @@ public class IssueReactionsClientTests
var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
Assert.Equal(1, issueReactions.Count); Assert.Single(issueReactions);
Assert.Equal(reactions.Last().Id, issueReactions[0].Id); Assert.Equal(reactions.Last().Id, issueReactions[0].Id);
Assert.Equal(reactions.Last().Content, issueReactions[0].Content); Assert.Equal(reactions.Last().Content, issueReactions[0].Content);
@@ -130,8 +130,8 @@ public class IssueReactionsClientTests
}; };
var secondPage = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions); var secondPage = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }
@@ -172,7 +172,7 @@ public class IssueReactionsClientTests
var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options); var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options);
Assert.Equal(1, issueReactions.Count); Assert.Single(issueReactions);
Assert.Equal(issueReaction.Id, issueReactions[0].Id); Assert.Equal(issueReaction.Id, issueReactions[0].Id);
Assert.Equal(issueReaction.Content, issueReactions[0].Content); Assert.Equal(issueReaction.Content, issueReactions[0].Content);
@@ -203,7 +203,7 @@ public class IssueReactionsClientTests
var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options); var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options);
Assert.Equal(1, issueReactions.Count); Assert.Single(issueReactions);
Assert.Equal(reactions.Last().Id, issueReactions[0].Id); Assert.Equal(reactions.Last().Id, issueReactions[0].Id);
Assert.Equal(reactions.Last().Content, issueReactions[0].Content); Assert.Equal(reactions.Last().Content, issueReactions[0].Content);
@@ -241,8 +241,8 @@ public class IssueReactionsClientTests
}; };
var secondPage = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, skipStartOptions); var secondPage = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content);
} }

View File

@@ -29,7 +29,7 @@ namespace Octokit.Tests.Integration.Clients
{ {
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503);
Assert.NotEmpty(timelineEventInfos); Assert.NotEmpty(timelineEventInfos);
Assert.NotEqual(0, timelineEventInfos.Count); Assert.NotEmpty(timelineEventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -48,7 +48,7 @@ namespace Octokit.Tests.Integration.Clients
timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions); timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
Assert.NotEmpty(timelineEventInfos); Assert.NotEmpty(timelineEventInfos);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -125,7 +125,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal("A test issue", renamed.Title); Assert.Equal("A test issue", renamed.Title);
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From);
Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To);
} }
@@ -140,7 +140,7 @@ namespace Octokit.Tests.Integration.Clients
var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue); var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue);
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
} }
@@ -157,7 +157,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.NotNull(closed); Assert.NotNull(closed);
timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number); timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event); Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
} }
@@ -172,7 +172,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.Equal("A test issue", renamed.Title); Assert.Equal("A test issue", renamed.Title);
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From);
Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To);
} }
@@ -187,7 +187,7 @@ namespace Octokit.Tests.Integration.Clients
var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue); var anotherNewIssue = await _issuesClient.Create(_context.Repository.Id, newIssue);
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number); var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
} }

View File

@@ -197,7 +197,7 @@ public class IssuesClientTests : IDisposable
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved); Assert.NotNull(retrieved);
Assert.True(retrieved.Assignees.Count == 1); Assert.Equal(1, retrieved.Assignees.Count);
Assert.True(retrieved.Assignees[0].Login == _context.RepositoryOwner); Assert.True(retrieved.Assignees[0].Login == _context.RepositoryOwner);
var all = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName); var all = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
Assert.Contains(all, i => i.Number == retrieved.Number); Assert.Contains(all, i => i.Number == retrieved.Number);
@@ -208,7 +208,7 @@ public class IssuesClientTests : IDisposable
{ {
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }).Result; var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }).Result;
Assert.NotNull(closed); Assert.NotNull(closed);
Assert.Equal(1, closed.Assignees.Count); Assert.Single(closed.Assignees);
Assert.Equal(_context.RepositoryOwner, closed.Assignees[0].Login); Assert.Equal(_context.RepositoryOwner, closed.Assignees[0].Login);
} }
} }
@@ -226,7 +226,7 @@ public class IssuesClientTests : IDisposable
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.NotNull(retrieved); Assert.NotNull(retrieved);
Assert.True(retrieved.Assignees.Count == 1); Assert.Equal(1, retrieved.Assignees.Count);
Assert.True(retrieved.Assignees[0].Login == _context.RepositoryOwner); Assert.True(retrieved.Assignees[0].Login == _context.RepositoryOwner);
var update = retrieved.ToUpdate(); var update = retrieved.ToUpdate();
@@ -438,7 +438,7 @@ public class IssuesClientTests : IDisposable
var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { State = ItemStateFilter.Closed }); new RepositoryIssueRequest { State = ItemStateFilter.Closed });
Assert.Equal(1, issues.Count); Assert.Single(issues);
Assert.Equal("A closed issue", issues[0].Title); Assert.Equal("A closed issue", issues[0].Title);
} }
@@ -456,7 +456,7 @@ public class IssuesClientTests : IDisposable
var issues = await _issuesClient.GetAllForRepository(_context.Repository.Id, var issues = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { State = ItemStateFilter.Closed }); new RepositoryIssueRequest { State = ItemStateFilter.Closed });
Assert.Equal(1, issues.Count); Assert.Single(issues);
Assert.Equal("A closed issue", issues[0].Title); Assert.Equal("A closed issue", issues[0].Title);
} }
@@ -472,7 +472,7 @@ public class IssuesClientTests : IDisposable
var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Milestone = milestone.Number.ToString(CultureInfo.InvariantCulture) }); new RepositoryIssueRequest { Milestone = milestone.Number.ToString(CultureInfo.InvariantCulture) });
Assert.Equal(1, issues.Count); Assert.Single(issues);
Assert.Equal("A milestone issue", issues[0].Title); Assert.Equal("A milestone issue", issues[0].Title);
} }
@@ -488,7 +488,7 @@ public class IssuesClientTests : IDisposable
var issues = await _issuesClient.GetAllForRepository(_context.Repository.Id, var issues = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Milestone = milestone.Number.ToString(CultureInfo.InvariantCulture) }); new RepositoryIssueRequest { Milestone = milestone.Number.ToString(CultureInfo.InvariantCulture) });
Assert.Equal(1, issues.Count); Assert.Single(issues);
Assert.Equal("A milestone issue", issues[0].Title); Assert.Equal("A milestone issue", issues[0].Title);
} }
@@ -576,7 +576,7 @@ public class IssuesClientTests : IDisposable
var retrieved = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, request, options); var retrieved = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, request, options);
Assert.Equal(1, retrieved.Count); Assert.Single(retrieved);
Assert.Contains(retrieved, i => i.Number == issue4.Number); Assert.Contains(retrieved, i => i.Number == issue4.Number);
} }
@@ -604,7 +604,7 @@ public class IssuesClientTests : IDisposable
var retrieved = await _issuesClient.GetAllForRepository(_context.Repository.Id, request, options); var retrieved = await _issuesClient.GetAllForRepository(_context.Repository.Id, request, options);
Assert.Equal(1, retrieved.Count); Assert.Single(retrieved);
Assert.Contains(retrieved, i => i.Number == issue4.Number); Assert.Contains(retrieved, i => i.Number == issue4.Number);
} }
@@ -735,13 +735,13 @@ public class IssuesClientTests : IDisposable
var assignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var assignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Assignee = _context.RepositoryOwner }); new RepositoryIssueRequest { Assignee = _context.RepositoryOwner });
Assert.Equal(1, assignedIssues.Count); Assert.Single(assignedIssues);
Assert.Equal("An assigned issue", assignedIssues[0].Title); Assert.Equal("An assigned issue", assignedIssues[0].Title);
var unassignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var unassignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Assignee = "none" }); new RepositoryIssueRequest { Assignee = "none" });
Assert.Equal(1, unassignedIssues.Count); Assert.Single(unassignedIssues);
Assert.Equal("An unassigned issue", unassignedIssues[0].Title); Assert.Equal("An unassigned issue", unassignedIssues[0].Title);
} }
@@ -763,13 +763,13 @@ public class IssuesClientTests : IDisposable
var assignedIssues = await _issuesClient.GetAllForRepository(_context.Repository.Id, var assignedIssues = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Assignee = _context.RepositoryOwner }); new RepositoryIssueRequest { Assignee = _context.RepositoryOwner });
Assert.Equal(1, assignedIssues.Count); Assert.Single(assignedIssues);
Assert.Equal("An assigned issue", assignedIssues[0].Title); Assert.Equal("An assigned issue", assignedIssues[0].Title);
var unassignedIssues = await _issuesClient.GetAllForRepository(_context.Repository.Id, var unassignedIssues = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Assignee = "none" }); new RepositoryIssueRequest { Assignee = "none" });
Assert.Equal(1, unassignedIssues.Count); Assert.Single(unassignedIssues);
Assert.Equal("An unassigned issue", unassignedIssues[0].Title); Assert.Equal("An unassigned issue", unassignedIssues[0].Title);
} }
@@ -794,7 +794,7 @@ public class IssuesClientTests : IDisposable
var issuesCreatedByExternalUser = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var issuesCreatedByExternalUser = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Creator = "shiftkey" }); new RepositoryIssueRequest { Creator = "shiftkey" });
Assert.Equal(0, issuesCreatedByExternalUser.Count); Assert.Empty(issuesCreatedByExternalUser);
} }
[IntegrationTest] [IntegrationTest]
@@ -818,7 +818,7 @@ public class IssuesClientTests : IDisposable
var issuesCreatedByExternalUser = await _issuesClient.GetAllForRepository(_context.Repository.Id, var issuesCreatedByExternalUser = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Creator = "shiftkey" }); new RepositoryIssueRequest { Creator = "shiftkey" });
Assert.Equal(0, issuesCreatedByExternalUser.Count); Assert.Empty(issuesCreatedByExternalUser);
} }
[IntegrationTest] [IntegrationTest]
@@ -837,12 +837,12 @@ public class IssuesClientTests : IDisposable
var mentionsWithShiftkey = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var mentionsWithShiftkey = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Mentioned = "shiftkey" }); new RepositoryIssueRequest { Mentioned = "shiftkey" });
Assert.Equal(1, mentionsWithShiftkey.Count); Assert.Single(mentionsWithShiftkey);
var mentionsWithHaacked = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var mentionsWithHaacked = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new RepositoryIssueRequest { Mentioned = "haacked" }); new RepositoryIssueRequest { Mentioned = "haacked" });
Assert.Equal(0, mentionsWithHaacked.Count); Assert.Empty(mentionsWithHaacked);
} }
[IntegrationTest] [IntegrationTest]
@@ -861,12 +861,12 @@ public class IssuesClientTests : IDisposable
var mentionsWithShiftkey = await _issuesClient.GetAllForRepository(_context.Repository.Id, var mentionsWithShiftkey = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Mentioned = "shiftkey" }); new RepositoryIssueRequest { Mentioned = "shiftkey" });
Assert.Equal(1, mentionsWithShiftkey.Count); Assert.Single(mentionsWithShiftkey);
var mentionsWithHaacked = await _issuesClient.GetAllForRepository(_context.Repository.Id, var mentionsWithHaacked = await _issuesClient.GetAllForRepository(_context.Repository.Id,
new RepositoryIssueRequest { Mentioned = "haacked" }); new RepositoryIssueRequest { Mentioned = "haacked" });
Assert.Equal(0, mentionsWithHaacked.Count); Assert.Empty(mentionsWithHaacked);
} }
[IntegrationTest] [IntegrationTest]
@@ -948,7 +948,7 @@ public class IssuesClientTests : IDisposable
var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
Assert.Equal(1, updatedIssue.Labels.Count); Assert.Single(updatedIssue.Labels);
} }
[IntegrationTest] [IntegrationTest]
@@ -968,7 +968,7 @@ public class IssuesClientTests : IDisposable
var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate); var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
Assert.Equal(1, updatedIssue.Labels.Count); Assert.Single(updatedIssue.Labels);
} }
[IntegrationTest] [IntegrationTest]
@@ -1128,7 +1128,7 @@ public class IssuesClientTests : IDisposable
var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
Assert.Equal(1, updatedIssue.Assignees.Count); Assert.Single(updatedIssue.Assignees);
Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login); Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
} }
@@ -1147,7 +1147,7 @@ public class IssuesClientTests : IDisposable
var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate); var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
Assert.Equal(1, updatedIssue.Assignees.Count); Assert.Single(updatedIssue.Assignees);
Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login); Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
} }
@@ -1236,7 +1236,7 @@ public class IssuesClientTests : IDisposable
newIssue.Assignees.Add(_context.RepositoryOwner); newIssue.Assignees.Add(_context.RepositoryOwner);
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.Equal(1, issue.Assignees.Count); Assert.Single(issue.Assignees);
// update the issue // update the issue
var issueUpdate = issue.ToUpdate(); var issueUpdate = issue.ToUpdate();
@@ -1258,7 +1258,7 @@ public class IssuesClientTests : IDisposable
newIssue.Assignees.Add(_context.RepositoryOwner); newIssue.Assignees.Add(_context.RepositoryOwner);
var issue = await _issuesClient.Create(_context.Repository.Id, newIssue); var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
Assert.Equal(1, issue.Assignees.Count); Assert.Single(issue.Assignees);
// update the issue // update the issue
var issueUpdate = issue.ToUpdate(); var issueUpdate = issue.ToUpdate();

View File

@@ -37,7 +37,7 @@ public class IssuesEventsClientTests : IDisposable
Assert.NotNull(closed); Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, issueEventInfo.Count); Assert.Single(issueEventInfo);
Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event); Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event);
} }
@@ -54,7 +54,7 @@ public class IssuesEventsClientTests : IDisposable
Assert.NotNull(closed); Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number); issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, issueEventInfo.Count); Assert.Single(issueEventInfo);
Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event); Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event);
} }
@@ -116,7 +116,7 @@ public class IssuesEventsClientTests : IDisposable
var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -137,7 +137,7 @@ public class IssuesEventsClientTests : IDisposable
var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options); var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -312,7 +312,7 @@ public class IssuesEventsClientTests : IDisposable
var eventInfos = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var eventInfos = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -333,7 +333,7 @@ public class IssuesEventsClientTests : IDisposable
var eventInfos = await _issuesEventsClient.GetAllForRepository(_context.Repository.Id, options); var eventInfos = await _issuesEventsClient.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -44,7 +44,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
Assert.Equal(newLabel.Description, issueLabelsInfo[0].Description); Assert.Equal(newLabel.Description, issueLabelsInfo[0].Description);
} }
@@ -68,7 +68,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
Assert.Equal(newLabel.Description, issueLabelsInfo[0].Description); Assert.Equal(newLabel.Description, issueLabelsInfo[0].Description);
} }
@@ -98,7 +98,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
} }
@@ -127,7 +127,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
} }
@@ -161,7 +161,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(labels.Last().Color, issueLabelsInfo.First().Color); Assert.Equal(labels.Last().Color, issueLabelsInfo.First().Color);
} }
@@ -195,7 +195,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options); issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(labels.Last().Color, issueLabelsInfo.First().Color); Assert.Equal(labels.Last().Color, issueLabelsInfo.First().Color);
} }
@@ -235,8 +235,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }
@@ -276,8 +276,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }
@@ -339,7 +339,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -368,7 +368,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -398,7 +398,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -428,7 +428,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -467,8 +467,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }
@@ -508,8 +508,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForRepository(_context.Repository.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }
@@ -535,7 +535,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number); issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(label.Color, issueLabelsInfo[0].Color); Assert.Equal(label.Color, issueLabelsInfo[0].Color);
} }
@@ -561,7 +561,7 @@ public class IssuesLabelsClientTests : IDisposable
issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number); issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
Assert.Equal(label.Color, issueLabelsInfo[0].Color); Assert.Equal(label.Color, issueLabelsInfo[0].Color);
} }
@@ -594,7 +594,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -626,7 +626,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -659,7 +659,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -692,7 +692,7 @@ public class IssuesLabelsClientTests : IDisposable
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, options); var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, options);
Assert.Equal(1, issueLabelsInfo.Count); Assert.Single(issueLabelsInfo);
} }
[IntegrationTest] [IntegrationTest]
@@ -734,8 +734,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }
@@ -778,8 +778,8 @@ public class IssuesLabelsClientTests : IDisposable
var secondPage = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, skipStartOptions); var secondPage = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Color, secondPage.First().Color); Assert.NotEqual(firstPage.First().Color, secondPage.First().Color);
} }

View File

@@ -64,7 +64,7 @@ public class MigrationsClientTests : IDisposable
var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName); var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName);
Assert.NotNull(migrations); Assert.NotNull(migrations);
Assert.NotEqual(0, migrations.Count); Assert.NotEmpty(migrations);
} }
[IntegrationTest] [IntegrationTest]
@@ -78,7 +78,7 @@ public class MigrationsClientTests : IDisposable
var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options);
Assert.Equal(1, migrations.Count); Assert.Single(migrations);
} }
[IntegrationTest] [IntegrationTest]
@@ -93,7 +93,7 @@ public class MigrationsClientTests : IDisposable
var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options);
Assert.Equal(1, migrations.Count); Assert.Single(migrations);
} }
[IntegrationTest] [IntegrationTest]
@@ -116,8 +116,8 @@ public class MigrationsClientTests : IDisposable
}; };
var secondPage = await _gitHub.Migration.Migrations.GetAll(_orgName, skipStartOptions); var secondPage = await _gitHub.Migration.Migrations.GetAll(_orgName, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[0].Repositories, secondPage[0].Repositories); Assert.NotEqual(firstPage[0].Repositories, secondPage[0].Repositories);
} }

View File

@@ -199,7 +199,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
new MilestoneRequest { State = ItemStateFilter.Closed }); new MilestoneRequest { State = ItemStateFilter.Closed });
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
Assert.Equal("milestone 3", milestones[0].Title); Assert.Equal("milestone 3", milestones[0].Title);
} }
@@ -216,7 +216,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id, var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id,
new MilestoneRequest { State = ItemStateFilter.Closed }); new MilestoneRequest { State = ItemStateFilter.Closed });
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
Assert.Equal("milestone 3", milestones[0].Title); Assert.Equal("milestone 3", milestones[0].Title);
} }
@@ -281,7 +281,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
} }
[IntegrationTest] [IntegrationTest]
@@ -303,7 +303,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id, options); var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
} }
[IntegrationTest] [IntegrationTest]
@@ -433,7 +433,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new MilestoneRequest { State = ItemStateFilter.Closed }, options); var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new MilestoneRequest { State = ItemStateFilter.Closed }, options);
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
} }
[IntegrationTest] [IntegrationTest]
@@ -457,7 +457,7 @@ public class MilestonesClientTests : IDisposable
var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id, new MilestoneRequest { State = ItemStateFilter.Closed }, options); var milestones = await _milestonesClient.GetAllForRepository(_context.Repository.Id, new MilestoneRequest { State = ItemStateFilter.Closed }, options);
Assert.Equal(1, milestones.Count); Assert.Single(milestones);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -151,7 +151,7 @@ namespace Octokit.Tests.Integration.Clients
var organizations = await _organizationsClient.GetAllForCurrent(options); var organizations = await _organizationsClient.GetAllForCurrent(options);
Assert.Equal(1, organizations.Count); Assert.Single(organizations);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]

View File

@@ -61,7 +61,7 @@ namespace Octokit.Tests.Integration.Clients
var hooks = await github.Organization.Hook.GetAll(_fixture.org, options); var hooks = await github.Organization.Hook.GetAll(_fixture.org, options);
Assert.Equal(1, hooks.Count); Assert.Single(hooks);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -39,7 +39,7 @@ namespace Octokit.Tests.Integration.Clients
var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options); var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options);
Assert.Equal(1, members.Count); Assert.Single(members);
} }
[OrganizationTest] [OrganizationTest]
@@ -54,7 +54,7 @@ namespace Octokit.Tests.Integration.Clients
var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options); var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options);
Assert.Equal(1, members.Count); Assert.Single(members);
} }
[OrganizationTest] [OrganizationTest]
@@ -78,8 +78,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _gitHub.Organization.Member.GetAll(_organizationFixture, skipStartOptions); var secondPage = await _gitHub.Organization.Member.GetAll(_organizationFixture, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -328,7 +328,7 @@ namespace Octokit.Tests.Integration.Clients
var pendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, options); var pendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, options);
Assert.NotEmpty(pendingInvitations); Assert.NotEmpty(pendingInvitations);
Assert.Equal(1, pendingInvitations.Count); Assert.Single(pendingInvitations);
} }
} }
@@ -349,7 +349,7 @@ namespace Octokit.Tests.Integration.Clients
var firstPagePendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, firstPageOptions); var firstPagePendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, firstPageOptions);
Assert.NotEmpty(firstPagePendingInvitations); Assert.NotEmpty(firstPagePendingInvitations);
Assert.Equal(1, firstPagePendingInvitations.Count); Assert.Single(firstPagePendingInvitations);
var secondPageOptions = new ApiOptions var secondPageOptions = new ApiOptions
{ {
@@ -360,7 +360,7 @@ namespace Octokit.Tests.Integration.Clients
var secondPagePendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, secondPageOptions); var secondPagePendingInvitations = await _gitHub.Organization.Member.GetAllPendingInvitations(Helper.Organization, secondPageOptions);
Assert.NotEmpty(secondPagePendingInvitations); Assert.NotEmpty(secondPagePendingInvitations);
Assert.Equal(1, secondPagePendingInvitations.Count); Assert.Single(secondPagePendingInvitations);
Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login); Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login);
} }
@@ -412,7 +412,7 @@ namespace Octokit.Tests.Integration.Clients
var memberships = await _gitHub.Organization.Member.GetAllOrganizationMembershipsForCurrent(options); var memberships = await _gitHub.Organization.Member.GetAllOrganizationMembershipsForCurrent(options);
Assert.Equal(1, memberships.Count); Assert.Single(memberships);
} }
} }

View File

@@ -44,7 +44,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization); .GetAll(Helper.Organization);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -67,7 +67,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization, options); .GetAll(Helper.Organization, options);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -92,7 +92,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization, options); .GetAll(Helper.Organization, options);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -134,7 +134,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization, OrganizationMembersFilter.All, options); .GetAll(Helper.Organization, OrganizationMembersFilter.All, options);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -169,8 +169,8 @@ namespace Octokit.Tests.Integration.Clients
.OutsideCollaborator .OutsideCollaborator
.GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions); .GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions);
Assert.Equal(1, firstPageOfOutsideCollaborators.Count); Assert.Single(firstPageOfOutsideCollaborators);
Assert.Equal(1, secondPageOfOutsideCollaborators.Count); Assert.Single(secondPageOfOutsideCollaborators);
Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login); Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login);
} }
} }
@@ -189,7 +189,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled); .GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login); Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
} }
} }
@@ -214,7 +214,7 @@ namespace Octokit.Tests.Integration.Clients
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options); .GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options);
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login); Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
} }
} }
@@ -283,7 +283,7 @@ namespace Octokit.Tests.Integration.Clients
var outsideCollaborators = await _gitHub.Organization.OutsideCollaborator.GetAll(Helper.Organization); var outsideCollaborators = await _gitHub.Organization.OutsideCollaborator.GetAll(Helper.Organization);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login); Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
} }

View File

@@ -23,7 +23,7 @@ namespace Octokit.Tests.Integration.Clients
var key = await github.Organization.Actions.Secrets.GetPublicKey(Helper.Organization); var key = await github.Organization.Actions.Secrets.GetPublicKey(Helper.Organization);
Assert.True(!string.IsNullOrWhiteSpace(key.KeyId)); Assert.False(string.IsNullOrWhiteSpace(key.KeyId));
} }
} }
@@ -53,7 +53,7 @@ namespace Octokit.Tests.Integration.Clients
var secret = await github.Organization.Actions.Secrets.Get(Helper.Organization, "TEST"); var secret = await github.Organization.Actions.Secrets.Get(Helper.Organization, "TEST");
Assert.NotNull(secret); Assert.NotNull(secret);
Assert.True(secret.Name == "TEST"); Assert.Equal("TEST", secret.Name);
} }
} }

View File

@@ -47,7 +47,7 @@ public class ProjectCardsClientTests
var result = await _github.Repository.Project.Card.GetAll(column.Id, request); var result = await _github.Repository.Project.Card.GetAll(column.Id, request);
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Contains(result, x => x.Id == card2.Id); Assert.Contains(result, x => x.Id == card2.Id);
} }
@@ -63,7 +63,7 @@ public class ProjectCardsClientTests
var result = await _github.Repository.Project.Card.GetAll(column.Id, request); var result = await _github.Repository.Project.Card.GetAll(column.Id, request);
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Contains(result, x => x.Id == card1.Id); Assert.Contains(result, x => x.Id == card1.Id);
} }
@@ -101,7 +101,7 @@ public class ProjectCardsClientTests
var cards = await _github.Repository.Project.Card.GetAll(column.Id, options); var cards = await _github.Repository.Project.Card.GetAll(column.Id, options);
// NOTE: cards are returned in reverse order // NOTE: cards are returned in reverse order
Assert.Equal(1, cards.Count); Assert.Single(cards);
Assert.Equal(card2.Id, cards[0].Id); Assert.Equal(card2.Id, cards[0].Id);
} }
@@ -123,7 +123,7 @@ public class ProjectCardsClientTests
var cards = await _github.Repository.Project.Card.GetAll(column.Id, options); var cards = await _github.Repository.Project.Card.GetAll(column.Id, options);
// NOTE: cards are returned in reverse order // NOTE: cards are returned in reverse order
Assert.Equal(1, cards.Count); Assert.Single(cards);
Assert.Equal(card1.Id, cards[0].Id); Assert.Equal(card1.Id, cards[0].Id);
} }

View File

@@ -51,7 +51,7 @@ public class ProjectColumnsClientTests
var columns = await _github.Repository.Project.Column.GetAll(project.Id, options); var columns = await _github.Repository.Project.Column.GetAll(project.Id, options);
Assert.Equal(1, columns.Count); Assert.Single(columns);
Assert.Equal(column1.Id, columns[0].Id); Assert.Equal(column1.Id, columns[0].Id);
} }
@@ -71,7 +71,7 @@ public class ProjectColumnsClientTests
var columns = await _github.Repository.Project.Column.GetAll(project.Id, options); var columns = await _github.Repository.Project.Column.GetAll(project.Id, options);
Assert.Equal(1, columns.Count); Assert.Single(columns);
Assert.Equal(column2.Id, columns[0].Id); Assert.Equal(column2.Id, columns[0].Id);
} }

View File

@@ -59,7 +59,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new ProjectRequest(ItemStateFilter.Closed)); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new ProjectRequest(ItemStateFilter.Closed));
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id); Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id);
} }
@@ -74,7 +74,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, new ProjectRequest(ItemStateFilter.Closed)); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, new ProjectRequest(ItemStateFilter.Closed));
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id); Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id);
} }
@@ -92,7 +92,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project1.Id, projects[0].Id); Assert.Equal(project1.Id, projects[0].Id);
} }
@@ -110,7 +110,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options);
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project1.Id, projects[0].Id); Assert.Equal(project1.Id, projects[0].Id);
} }
@@ -129,7 +129,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project2.Id, projects[0].Id); Assert.Equal(project2.Id, projects[0].Id);
} }
@@ -148,7 +148,7 @@ public class ProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options);
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project2.Id, projects[0].Id); Assert.Equal(project2.Id, projects[0].Id);
} }

View File

@@ -75,7 +75,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
var reactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, options); var reactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Id, reactions[0].Id);
Assert.Equal(reaction.Content, reactions[0].Content); Assert.Equal(reaction.Content, reactions[0].Content);
} }
@@ -111,7 +111,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
var reactionsInfo = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, options); var reactionsInfo = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id);
Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content);
} }
@@ -152,8 +152,8 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
}; };
var secondPage = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, skipStartOptions); var secondPage = await _github.Reaction.PullRequestReviewComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.Equal(firstPage[0].Id, secondPage[0].Id); Assert.Equal(firstPage[0].Id, secondPage[0].Id);
Assert.Equal(firstPage[0].Content, secondPage[0].Content); Assert.Equal(firstPage[0].Content, secondPage[0].Content);
} }
@@ -205,7 +205,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
var reactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, options); var reactions = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, options);
Assert.Equal(1, reactions.Count); Assert.Single(reactions);
Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Id, reactions[0].Id);
Assert.Equal(reaction.Content, reactions[0].Content); Assert.Equal(reaction.Content, reactions[0].Content);
} }
@@ -241,7 +241,7 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
var reactionsInfo = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, options); var reactionsInfo = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, options);
Assert.Equal(1, reactionsInfo.Count); Assert.Single(reactionsInfo);
Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id);
Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content);
} }
@@ -282,8 +282,8 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
}; };
var secondPage = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, skipStartOptions); var secondPage = await _github.Reaction.PullRequestReviewComment.GetAll(_context.Repository.Id, commentFromGitHub.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.Equal(firstPage[0].Id, secondPage[0].Id); Assert.Equal(firstPage[0].Id, secondPage[0].Id);
Assert.Equal(firstPage[0].Content, secondPage[0].Content); Assert.Equal(firstPage[0].Content, secondPage[0].Content);
} }

View File

@@ -293,7 +293,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAll(Helper.UserName, _context.RepositoryName, pullRequest.Number, options); var pullRequestComments = await _client.GetAll(Helper.UserName, _context.RepositoryName, pullRequest.Number, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]
@@ -315,7 +315,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAll(_context.Repository.Id, pullRequest.Number, options); var pullRequestComments = await _client.GetAll(_context.Repository.Id, pullRequest.Number, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]
@@ -469,7 +469,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _context.RepositoryName, options); var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _context.RepositoryName, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]
@@ -491,7 +491,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id, options); var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]
@@ -689,7 +689,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _context.RepositoryName, pullRequestReviewCommentRequest, options); var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _context.RepositoryName, pullRequestReviewCommentRequest, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]
@@ -713,7 +713,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id, pullRequestReviewCommentRequest, options); var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id, pullRequestReviewCommentRequest, options);
Assert.Equal(1, pullRequestComments.Count); Assert.Single(pullRequestComments);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -42,7 +42,7 @@ public class PullRequestReviewsClientTests
var reviews = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, options); var reviews = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, options);
Assert.Equal(1, reviews.Count); Assert.Single(reviews);
} }
[IntegrationTest] [IntegrationTest]
@@ -57,7 +57,7 @@ public class PullRequestReviewsClientTests
var reviews = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, options); var reviews = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, options);
Assert.Equal(1, reviews.Count); Assert.Single(reviews);
} }
[IntegrationTest] [IntegrationTest]
@@ -81,8 +81,8 @@ public class PullRequestReviewsClientTests
var secondPage = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, skipStartOptions); var secondPage = await _github.PullRequest.Review.GetAll("octokit", "octokit.net", 1648, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
} }
@@ -502,7 +502,7 @@ public class PullRequestReviewsClientTests
var comments = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, options); var comments = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, options);
Assert.Equal(1, comments.Count); Assert.Single(comments);
} }
[IntegrationTest] [IntegrationTest]
@@ -517,7 +517,7 @@ public class PullRequestReviewsClientTests
var comments = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, options); var comments = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, options);
Assert.Equal(1, comments.Count); Assert.Single(comments);
} }
[IntegrationTest] [IntegrationTest]
@@ -541,8 +541,8 @@ public class PullRequestReviewsClientTests
var secondPage = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, skipStartOptions); var secondPage = await _github.PullRequest.Review.GetAllComments("octokit", "octokit.net", 1648, 54646850, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
} }

View File

@@ -104,7 +104,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.True(pullRequests[0].Id > 0); Assert.True(pullRequests[0].Id > 0);
} }
@@ -119,7 +119,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(result.Draft, pullRequests[0].Draft); Assert.Equal(result.Draft, pullRequests[0].Draft);
Assert.True(pullRequests[0].Id > 0); Assert.True(pullRequests[0].Id > 0);
@@ -135,7 +135,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -149,7 +149,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(result.Draft, pullRequests[0].Draft); Assert.Equal(result.Draft, pullRequests[0].Draft);
Assert.True(pullRequests[0].Id > 0); Assert.True(pullRequests[0].Id > 0);
@@ -171,10 +171,10 @@ public class PullRequestsClientTests : IDisposable
// Retrieve the Pull Requests // Retrieve the Pull Requests
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login); Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
Assert.Equal(1, pullRequests[0].Assignees.Count); Assert.Single(pullRequests[0].Assignees);
Assert.Contains(pullRequests[0].Assignees, x => x.Login == Helper.UserName); Assert.Contains(pullRequests[0].Assignees, x => x.Login == Helper.UserName);
} }
@@ -194,10 +194,10 @@ public class PullRequestsClientTests : IDisposable
// Retrieve the Pull Requests // Retrieve the Pull Requests
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login); Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
Assert.Equal(1, pullRequests[0].Assignees.Count); Assert.Single(pullRequests[0].Assignees);
Assert.Contains(pullRequests[0].Assignees, x => x.Login == Helper.UserName); Assert.Contains(pullRequests[0].Assignees, x => x.Login == Helper.UserName);
} }
@@ -217,10 +217,10 @@ public class PullRequestsClientTests : IDisposable
// Retrieve the Pull Requests // Retrieve the Pull Requests
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login); Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
Assert.Equal(1, pullRequests[0].Labels.Count); Assert.Single(pullRequests[0].Labels);
Assert.Contains(pullRequests[0].Labels, x => x.Name == labelName); Assert.Contains(pullRequests[0].Labels, x => x.Name == labelName);
} }
@@ -240,10 +240,10 @@ public class PullRequestsClientTests : IDisposable
// Retrieve the Pull Requests // Retrieve the Pull Requests
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login); Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
Assert.Equal(1, pullRequests[0].Labels.Count); Assert.Single(pullRequests[0].Labels);
Assert.Contains(pullRequests[0].Labels, x => x.Name == labelName); Assert.Contains(pullRequests[0].Labels, x => x.Name == labelName);
} }
@@ -263,7 +263,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, options); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -283,7 +283,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, options); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -306,7 +306,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, options); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -329,7 +329,7 @@ public class PullRequestsClientTests : IDisposable
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, options); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -404,7 +404,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -419,7 +419,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -440,7 +440,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests, options); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -461,7 +461,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests, options); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -485,7 +485,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests, options); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -509,7 +509,7 @@ public class PullRequestsClientTests : IDisposable
var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open };
var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests, options); var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id, openPullRequests, options);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
Assert.Equal(result.Title, pullRequests[0].Title); Assert.Equal(result.Title, pullRequests[0].Title);
} }
@@ -686,7 +686,7 @@ public class PullRequestsClientTests : IDisposable
var closedPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; var closedPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed };
var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, closedPullRequests); var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, closedPullRequests);
Assert.Equal(1, pullRequests.Count); Assert.Single(pullRequests);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -115,7 +115,7 @@ public class ReleasesClientTests
var release = await _releaseClient.Get("git-tfs", "git-tfs", 2276624); var release = await _releaseClient.Get("git-tfs", "git-tfs", 2276624);
Assert.NotNull(release); Assert.NotNull(release);
Assert.Equal(1, release.Assets.Count); Assert.Single(release.Assets);
Assert.Equal("GitTfs-0.24.1.zip", release.Assets.First().Name); Assert.Equal("GitTfs-0.24.1.zip", release.Assets.First().Name);
Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/tarball/v0.24.1", release.TarballUrl); Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/tarball/v0.24.1", release.TarballUrl);
Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/zipball/v0.24.1", release.ZipballUrl); Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/zipball/v0.24.1", release.ZipballUrl);
@@ -127,7 +127,7 @@ public class ReleasesClientTests
var release = await _releaseClient.Get(252774, 2276624); var release = await _releaseClient.Get(252774, 2276624);
Assert.NotNull(release); Assert.NotNull(release);
Assert.Equal(1, release.Assets.Count); Assert.Single(release.Assets);
Assert.Equal("GitTfs-0.24.1.zip", release.Assets.First().Name); Assert.Equal("GitTfs-0.24.1.zip", release.Assets.First().Name);
Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/tarball/v0.24.1", release.TarballUrl); Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/tarball/v0.24.1", release.TarballUrl);
Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/zipball/v0.24.1", release.ZipballUrl); Assert.Equal("https://api.github.com/repos/git-tfs/git-tfs/zipball/v0.24.1", release.ZipballUrl);
@@ -160,7 +160,7 @@ public class ReleasesClientTests
var releases = await _releaseClient.GetAll(_context.RepositoryOwner, _context.RepositoryName); var releases = await _releaseClient.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.True(releases.Count == 1); Assert.Equal(1, releases.Count);
Assert.False(releases.First().PublishedAt.HasValue); Assert.False(releases.First().PublishedAt.HasValue);
} }
@@ -173,7 +173,7 @@ public class ReleasesClientTests
var releases = await _releaseClient.GetAll(_context.Repository.Id); var releases = await _releaseClient.GetAll(_context.Repository.Id);
Assert.True(releases.Count == 1); Assert.Equal(1, releases.Count);
Assert.False(releases.First().PublishedAt.HasValue); Assert.False(releases.First().PublishedAt.HasValue);
} }
@@ -521,7 +521,7 @@ public class ReleasesClientTests
var assets = await _releaseClient.GetAllAssets(_context.RepositoryOwner, _context.RepositoryName, release.Id); var assets = await _releaseClient.GetAllAssets(_context.RepositoryOwner, _context.RepositoryName, release.Id);
Assert.Equal(1, assets.Count); Assert.Single(assets);
var asset = assets[0]; var asset = assets[0];
Assert.Equal(result.Id, asset.Id); Assert.Equal(result.Id, asset.Id);
Assert.NotNull(asset.Url); Assert.NotNull(asset.Url);
@@ -544,7 +544,7 @@ public class ReleasesClientTests
var assets = await _releaseClient.GetAllAssets(_context.Repository.Id, release.Id); var assets = await _releaseClient.GetAllAssets(_context.Repository.Id, release.Id);
Assert.Equal(1, assets.Count); Assert.Single(assets);
var asset = assets[0]; var asset = assets[0];
Assert.Equal(result.Id, asset.Id); Assert.Equal(result.Id, asset.Id);
Assert.NotNull(asset.Url); Assert.NotNull(asset.Url);
@@ -716,7 +716,7 @@ public class ReleasesClientTests
var assets = await _releaseClient.GetAllAssets(owner, name, releaseId, options); var assets = await _releaseClient.GetAllAssets(owner, name, releaseId, options);
Assert.Equal(1, assets.Count); Assert.Single(assets);
} }
[IntegrationTest] [IntegrationTest]
@@ -731,7 +731,7 @@ public class ReleasesClientTests
var assets = await _releaseClient.GetAllAssets(repositoryId, releaseId, options); var assets = await _releaseClient.GetAllAssets(repositoryId, releaseId, options);
Assert.Equal(1, assets.Count); Assert.Single(assets);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -347,14 +347,14 @@ namespace Octokit.Tests.Integration.Clients
Assert.True(protection.RequiredStatusChecks.Strict); Assert.True(protection.RequiredStatusChecks.Strict);
Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count); Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count);
Assert.Equal(1, protection.RequiredPullRequestReviews.DismissalRestrictions.Teams.Count); Assert.Single(protection.RequiredPullRequestReviews.DismissalRestrictions.Teams);
Assert.Equal(0, protection.RequiredPullRequestReviews.DismissalRestrictions.Users.Count); Assert.Empty(protection.RequiredPullRequestReviews.DismissalRestrictions.Users);
Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews); Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireLastPushApproval); Assert.True(protection.RequiredPullRequestReviews.RequireLastPushApproval);
Assert.Equal(1, protection.Restrictions.Teams.Count); Assert.Single(protection.Restrictions.Teams);
Assert.Equal(0, protection.Restrictions.Users.Count); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.EnforceAdmins.Enabled); Assert.True(protection.EnforceAdmins.Enabled);
} }
@@ -372,14 +372,14 @@ namespace Octokit.Tests.Integration.Clients
Assert.True(protection.RequiredStatusChecks.Strict); Assert.True(protection.RequiredStatusChecks.Strict);
Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count); Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count);
Assert.Equal(1, protection.RequiredPullRequestReviews.DismissalRestrictions.Teams.Count); Assert.Single(protection.RequiredPullRequestReviews.DismissalRestrictions.Teams);
Assert.Equal(0, protection.RequiredPullRequestReviews.DismissalRestrictions.Users.Count); Assert.Empty(protection.RequiredPullRequestReviews.DismissalRestrictions.Users);
Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews); Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireLastPushApproval); Assert.True(protection.RequiredPullRequestReviews.RequireLastPushApproval);
Assert.Equal(1, protection.Restrictions.Teams.Count); Assert.Single(protection.Restrictions.Teams);
Assert.Equal(0, protection.Restrictions.Users.Count); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.EnforceAdmins.Enabled); Assert.True(protection.EnforceAdmins.Enabled);
} }
@@ -403,7 +403,7 @@ namespace Octokit.Tests.Integration.Clients
var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update); var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -432,7 +432,7 @@ namespace Octokit.Tests.Integration.Clients
var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update); var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -462,7 +462,7 @@ namespace Octokit.Tests.Integration.Clients
var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update); var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -492,7 +492,7 @@ namespace Octokit.Tests.Integration.Clients
var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update); var protection = await _github.Repository.Branch.UpdateBranchProtection(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -612,7 +612,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.NotNull(requiredStatusChecks.Contexts); Assert.NotNull(requiredStatusChecks.Contexts);
Assert.Contains("new", requiredStatusChecks.Contexts); Assert.Contains("new", requiredStatusChecks.Contexts);
Assert.True(requiredStatusChecks.Strict); Assert.True(requiredStatusChecks.Strict);
Assert.Equal(1, requiredStatusChecks.Contexts.Count); Assert.Single(requiredStatusChecks.Contexts);
} }
} }
@@ -630,7 +630,7 @@ namespace Octokit.Tests.Integration.Clients
Assert.NotNull(requiredStatusChecks.Contexts); Assert.NotNull(requiredStatusChecks.Contexts);
Assert.Contains("new", requiredStatusChecks.Contexts); Assert.Contains("new", requiredStatusChecks.Contexts);
Assert.True(requiredStatusChecks.Strict); Assert.True(requiredStatusChecks.Strict);
Assert.Equal(1, requiredStatusChecks.Contexts.Count); Assert.Single(requiredStatusChecks.Contexts);
} }
} }
} }
@@ -707,7 +707,7 @@ namespace Octokit.Tests.Integration.Clients
var update = new List<string>() { "build2" }; var update = new List<string>() { "build2" };
var requiredStatusChecksContexts = await _github.Repository.Branch.UpdateRequiredStatusChecksContexts(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update); var requiredStatusChecksContexts = await _github.Repository.Branch.UpdateRequiredStatusChecksContexts(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, update);
Assert.Equal(1, requiredStatusChecksContexts.Count); Assert.Single(requiredStatusChecksContexts);
} }
} }
@@ -721,7 +721,7 @@ namespace Octokit.Tests.Integration.Clients
var update = new List<string>() { "build2" }; var update = new List<string>() { "build2" };
var requiredStatusChecksContexts = await _github.Repository.Branch.UpdateRequiredStatusChecksContexts(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update); var requiredStatusChecksContexts = await _github.Repository.Branch.UpdateRequiredStatusChecksContexts(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, update);
Assert.Equal(1, requiredStatusChecksContexts.Count); Assert.Single(requiredStatusChecksContexts);
} }
} }
} }
@@ -835,8 +835,8 @@ namespace Octokit.Tests.Integration.Clients
var requiredReviews = await _github.Repository.Branch.GetReviewEnforcement(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch); var requiredReviews = await _github.Repository.Branch.GetReviewEnforcement(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
Assert.Equal(1, requiredReviews.DismissalRestrictions.Teams.Count); Assert.Single(requiredReviews.DismissalRestrictions.Teams);
Assert.Equal(0, requiredReviews.DismissalRestrictions.Users.Count); Assert.Empty(requiredReviews.DismissalRestrictions.Users);
Assert.True(requiredReviews.DismissStaleReviews); Assert.True(requiredReviews.DismissStaleReviews);
Assert.True(requiredReviews.RequireCodeOwnerReviews); Assert.True(requiredReviews.RequireCodeOwnerReviews);
Assert.True(requiredReviews.RequireLastPushApproval); Assert.True(requiredReviews.RequireLastPushApproval);
@@ -852,8 +852,8 @@ namespace Octokit.Tests.Integration.Clients
var requiredReviews = await _github.Repository.Branch.GetReviewEnforcement(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch); var requiredReviews = await _github.Repository.Branch.GetReviewEnforcement(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
Assert.Equal(1, requiredReviews.DismissalRestrictions.Teams.Count); Assert.Single(requiredReviews.DismissalRestrictions.Teams);
Assert.Equal(0, requiredReviews.DismissalRestrictions.Users.Count); Assert.Empty(requiredReviews.DismissalRestrictions.Users);
Assert.True(requiredReviews.DismissStaleReviews); Assert.True(requiredReviews.DismissStaleReviews);
Assert.True(requiredReviews.RequireCodeOwnerReviews); Assert.True(requiredReviews.RequireCodeOwnerReviews);
Assert.True(requiredReviews.RequireLastPushApproval); Assert.True(requiredReviews.RequireLastPushApproval);
@@ -1165,8 +1165,8 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
Assert.Equal(1, restrictions.Teams.Count); Assert.Single(restrictions.Teams);
Assert.Equal(0, restrictions.Users.Count); Assert.Empty(restrictions.Users);
} }
} }
@@ -1179,8 +1179,8 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetProtectedBranchRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
Assert.Equal(1, restrictions.Teams.Count); Assert.Single(restrictions.Teams);
Assert.Equal(0, restrictions.Users.Count); Assert.Empty(restrictions.Users);
} }
} }
} }
@@ -1226,7 +1226,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetAllProtectedBranchTeamRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetAllProtectedBranchTeamRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
@@ -1240,7 +1240,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetAllProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetAllProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
} }
@@ -1291,7 +1291,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.UpdateProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newTeam); var restrictions = await _github.Repository.Branch.UpdateProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newTeam);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
} }
@@ -1360,7 +1360,7 @@ namespace Octokit.Tests.Integration.Clients
var deleted = await _github.Repository.Branch.DeleteProtectedBranchTeamRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, teamToRemove); var deleted = await _github.Repository.Branch.DeleteProtectedBranchTeamRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, teamToRemove);
Assert.NotNull(deleted); Assert.NotNull(deleted);
Assert.Equal(0, deleted.Count); Assert.Empty(deleted);
} }
} }
@@ -1375,7 +1375,7 @@ namespace Octokit.Tests.Integration.Clients
var deleted = await _github.Repository.Branch.DeleteProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, teamToRemove); var deleted = await _github.Repository.Branch.DeleteProtectedBranchTeamRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, teamToRemove);
Assert.NotNull(deleted); Assert.NotNull(deleted);
Assert.Equal(0, deleted.Count); Assert.Empty(deleted);
} }
} }
} }
@@ -1392,7 +1392,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetAllProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetAllProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(0, restrictions.Count); Assert.Empty(restrictions);
} }
} }
@@ -1406,7 +1406,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.GetAllProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch); var restrictions = await _github.Repository.Branch.GetAllProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(0, restrictions.Count); Assert.Empty(restrictions);
} }
} }
} }
@@ -1425,7 +1425,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.UpdateProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, newUser); var restrictions = await _github.Repository.Branch.UpdateProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, newUser);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
@@ -1441,7 +1441,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.UpdateProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newUser); var restrictions = await _github.Repository.Branch.UpdateProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newUser);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
} }
@@ -1460,7 +1460,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, newUser); var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, newUser);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
@@ -1476,7 +1476,7 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newUser); var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, newUser);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
} }
} }
} }
@@ -1494,12 +1494,12 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, user); var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, user);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
var deleted = await _github.Repository.Branch.DeleteProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, user); var deleted = await _github.Repository.Branch.DeleteProtectedBranchUserRestrictions(repoContext.RepositoryOwner, repoContext.RepositoryName, repoContext.RepositoryDefaultBranch, user);
Assert.NotNull(deleted); Assert.NotNull(deleted);
Assert.Equal(0, deleted.Count); Assert.Empty(deleted);
} }
} }
@@ -1514,12 +1514,12 @@ namespace Octokit.Tests.Integration.Clients
var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, user); var restrictions = await _github.Repository.Branch.AddProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, user);
Assert.NotNull(restrictions); Assert.NotNull(restrictions);
Assert.Equal(1, restrictions.Count); Assert.Single(restrictions);
var deleted = await _github.Repository.Branch.DeleteProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, user); var deleted = await _github.Repository.Branch.DeleteProtectedBranchUserRestrictions(repoContext.RepositoryId, repoContext.RepositoryDefaultBranch, user);
Assert.NotNull(deleted); Assert.NotNull(deleted);
Assert.Equal(0, deleted.Count); Assert.Empty(deleted);
} }
} }
} }

View File

@@ -22,7 +22,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -41,7 +41,7 @@ public class RepositoryCollaboratorClientTests
new RepositoryCollaboratorListRequest() { Permission = CollaboratorPermission.Admin }); new RepositoryCollaboratorListRequest() { Permission = CollaboratorPermission.Admin });
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -58,7 +58,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.Repository.Id); var collaborators = await fixture.GetAll(context.Repository.Id);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -81,7 +81,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -104,7 +104,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.Repository.Id, options); var collaborators = await fixture.GetAll(context.Repository.Id, options);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -128,7 +128,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(0, collaborators.Count); Assert.Empty(collaborators);
} }
} }
@@ -152,7 +152,7 @@ public class RepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.Repository.Id, options); var collaborators = await fixture.GetAll(context.Repository.Id, options);
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(0, collaborators.Count); Assert.Empty(collaborators);
} }
} }
@@ -183,8 +183,8 @@ public class RepositoryCollaboratorClientTests
var secondPage = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, skipStartOptions); var secondPage = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(0, secondPage.Count); Assert.Empty(secondPage);
} }
} }
@@ -215,8 +215,8 @@ public class RepositoryCollaboratorClientTests
var secondPage = await fixture.GetAll(context.Repository.Id, skipStartOptions); var secondPage = await fixture.GetAll(context.Repository.Id, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(0, secondPage.Count); Assert.Empty(secondPage);
} }
} }
} }

View File

@@ -317,7 +317,7 @@ public class RepositoryCommitsClientTests
const string head = "7349ecd6685c370ba84eb13f4c39f75f33"; const string head = "7349ecd6685c370ba84eb13f4c39f75f33";
var compareResult = await _fixture.Compare(octokitNetRepositoryId, head, head, new ApiOptions { PageSize = 100 }); var compareResult = await _fixture.Compare(octokitNetRepositoryId, head, head, new ApiOptions { PageSize = 100 });
Assert.Equal(0, compareResult.Commits.Count); Assert.Empty(compareResult.Commits);
} }
} }
@@ -344,7 +344,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "main", "my-branch"); var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "main", "my-branch");
Assert.Equal(1, result.TotalCommits); Assert.Equal(1, result.TotalCommits);
Assert.Equal(1, result.Commits.Count); Assert.Single(result.Commits);
Assert.Equal(1, result.AheadBy); Assert.Equal(1, result.AheadBy);
Assert.Equal(0, result.BehindBy); Assert.Equal(0, result.BehindBy);
} }
@@ -357,7 +357,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(_context.Repository.Id, "main", "my-branch"); var result = await _fixture.Compare(_context.Repository.Id, "main", "my-branch");
Assert.Equal(1, result.TotalCommits); Assert.Equal(1, result.TotalCommits);
Assert.Equal(1, result.Commits.Count); Assert.Single(result.Commits);
Assert.Equal(1, result.AheadBy); Assert.Equal(1, result.AheadBy);
Assert.Equal(0, result.BehindBy); Assert.Equal(0, result.BehindBy);
} }
@@ -370,7 +370,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "main"); var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, "my-branch", "main");
Assert.Equal(0, result.TotalCommits); Assert.Equal(0, result.TotalCommits);
Assert.Equal(0, result.Commits.Count); Assert.Empty(result.Commits);
Assert.Equal(0, result.AheadBy); Assert.Equal(0, result.AheadBy);
Assert.Equal(1, result.BehindBy); Assert.Equal(1, result.BehindBy);
} }
@@ -383,7 +383,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "main"); var result = await _fixture.Compare(_context.Repository.Id, "my-branch", "main");
Assert.Equal(0, result.TotalCommits); Assert.Equal(0, result.TotalCommits);
Assert.Equal(0, result.Commits.Count); Assert.Empty(result.Commits);
Assert.Equal(0, result.AheadBy); Assert.Equal(0, result.AheadBy);
Assert.Equal(1, result.BehindBy); Assert.Equal(1, result.BehindBy);
} }
@@ -424,7 +424,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, main.Object.Sha, branch.Object.Sha); var result = await _fixture.Compare(Helper.UserName, _context.RepositoryName, main.Object.Sha, branch.Object.Sha);
Assert.Equal(1, result.Commits.Count); Assert.Single(result.Commits);
Assert.Equal(1, result.AheadBy); Assert.Equal(1, result.AheadBy);
Assert.Equal(0, result.BehindBy); Assert.Equal(0, result.BehindBy);
} }
@@ -439,7 +439,7 @@ public class RepositoryCommitsClientTests
var result = await _fixture.Compare(_context.Repository.Id, main.Object.Sha, branch.Object.Sha); var result = await _fixture.Compare(_context.Repository.Id, main.Object.Sha, branch.Object.Sha);
Assert.Equal(1, result.Commits.Count); Assert.Single(result.Commits);
Assert.Equal(1, result.AheadBy); Assert.Equal(1, result.AheadBy);
Assert.Equal(0, result.BehindBy); Assert.Equal(0, result.BehindBy);
} }

View File

@@ -71,7 +71,7 @@ namespace Octokit.Tests.Integration.Clients
.Content .Content
.GetAllContents("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs"); .GetAllContents("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs");
Assert.Equal(1, contents.Count); Assert.Single(contents);
Assert.Equal(ContentType.File, contents.First().Type); Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl); Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
} }
@@ -86,7 +86,7 @@ namespace Octokit.Tests.Integration.Clients
.Content .Content
.GetAllContents(7528679, "Octokit.Reactive/ObservableGitHubClient.cs"); .GetAllContents(7528679, "Octokit.Reactive/ObservableGitHubClient.cs");
Assert.Equal(1, contents.Count); Assert.Single(contents);
Assert.Equal(ContentType.File, contents.First().Type); Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl); Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
} }
@@ -188,7 +188,7 @@ namespace Octokit.Tests.Integration.Clients
.Content .Content
.GetAllContentsByRef("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs", "main"); .GetAllContentsByRef("octokit", "octokit.net", "Octokit.Reactive/ObservableGitHubClient.cs", "main");
Assert.Equal(1, contents.Count); Assert.Single(contents);
Assert.Equal(ContentType.File, contents.First().Type); Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl); Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
} }
@@ -203,7 +203,7 @@ namespace Octokit.Tests.Integration.Clients
.Content .Content
.GetAllContentsByRef(7528679, "Octokit.Reactive/ObservableGitHubClient.cs", "main"); .GetAllContentsByRef(7528679, "Octokit.Reactive/ObservableGitHubClient.cs", "main");
Assert.Equal(1, contents.Count); Assert.Single(contents);
Assert.Equal(ContentType.File, contents.First().Type); Assert.Equal(ContentType.File, contents.First().Type);
Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl); Assert.Equal("https://github.com/octokit/octokit.net/blob/main/Octokit.Reactive/ObservableGitHubClient.cs", contents.First().HtmlUrl);
} }

View File

@@ -56,7 +56,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
public async Task CanRetrieveAllDeployKeys() public async Task CanRetrieveAllDeployKeys()
{ {
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
var deployKey = new NewDeployKey var deployKey = new NewDeployKey
{ {
@@ -67,7 +67,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, deployKey); await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, deployKey);
deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);
} }
@@ -76,7 +76,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
public async Task CanRetrieveAllDeployKeysWithRepositoryId() public async Task CanRetrieveAllDeployKeysWithRepositoryId()
{ {
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
var deployKey = new NewDeployKey var deployKey = new NewDeployKey
{ {
@@ -87,7 +87,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
await _fixture.Create(_context.Repository.Id, deployKey); await _fixture.Create(_context.Repository.Id, deployKey);
deployKeys = await _fixture.GetAll(_context.Repository.Id); deployKeys = await _fixture.GetAll(_context.Repository.Id);
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);
} }
@@ -96,7 +96,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
public async Task ReturnsCorrectCountOfDeployKeysWithoutStart() public async Task ReturnsCorrectCountOfDeployKeysWithoutStart()
{ {
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
var list = new List<NewDeployKey>(); var list = new List<NewDeployKey>();
var deployKeysCount = 5; var deployKeysCount = 5;
@@ -130,7 +130,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
public async Task ReturnsCorrectCountOfDeployKeysWithStart() public async Task ReturnsCorrectCountOfDeployKeysWithStart()
{ {
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
var list = new List<NewDeployKey>(); var list = new List<NewDeployKey>();
var deployKeysCount = 5; var deployKeysCount = 5;
@@ -158,7 +158,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName, options); deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName, options);
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
} }
[IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1003 for investigating this failing test")] [IntegrationTest(Skip = "See https://github.com/octokit/octokit.net/issues/1003 for investigating this failing test")]
@@ -287,13 +287,13 @@ public class RepositoryDeployKeysClientTests : IDisposable
await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployKey); await _fixture.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployKey);
var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); var deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);
await _fixture.Delete(_context.RepositoryOwner, _context.RepositoryName, deployKeys[0].Id); await _fixture.Delete(_context.RepositoryOwner, _context.RepositoryName, deployKeys[0].Id);
deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName); deployKeys = await _fixture.GetAll(_context.RepositoryOwner, _context.RepositoryName);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
} }
[IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")] [IntegrationTest(Skip = "see https://github.com/octokit/octokit.net/issues/533 for the resolution to this failing test")]
@@ -308,13 +308,13 @@ public class RepositoryDeployKeysClientTests : IDisposable
await _fixture.Create(_context.Repository.Id, newDeployKey); await _fixture.Create(_context.Repository.Id, newDeployKey);
var deployKeys = await _fixture.GetAll(_context.Repository.Id); var deployKeys = await _fixture.GetAll(_context.Repository.Id);
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);
await _fixture.Delete(_context.Repository.Id, deployKeys[0].Id); await _fixture.Delete(_context.Repository.Id, deployKeys[0].Id);
deployKeys = await _fixture.GetAll(_context.Repository.Id); deployKeys = await _fixture.GetAll(_context.Repository.Id);
Assert.Equal(0, deployKeys.Count); Assert.Empty(deployKeys);
} }
public void Dispose() public void Dispose()

View File

@@ -45,7 +45,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", options); var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -61,7 +61,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll(7528679, options); var forks = await github.Repository.Forks.GetAll(7528679, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -78,7 +78,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", options); var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -95,7 +95,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll(7528679, options); var forks = await github.Repository.Forks.GetAll(7528679, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -173,7 +173,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", repositoryForksListRequest, options); var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", repositoryForksListRequest, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -191,7 +191,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll(7528679, repositoryForksListRequest, options); var forks = await github.Repository.Forks.GetAll(7528679, repositoryForksListRequest, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -210,7 +210,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", repositoryForksListRequest, options); var forks = await github.Repository.Forks.GetAll("octokit", "octokit.net", repositoryForksListRequest, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]
@@ -229,7 +229,7 @@ namespace Octokit.Tests.Integration.Clients
var forks = await github.Repository.Forks.GetAll(7528679, repositoryForksListRequest, options); var forks = await github.Repository.Forks.GetAll(7528679, repositoryForksListRequest, options);
Assert.Equal(1, forks.Count); Assert.Single(forks);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -90,7 +90,7 @@ namespace Octokit.Tests.Integration.Clients
var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options); var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options);
Assert.Equal(1, hooks.Count); Assert.Single(hooks);
} }
[IntegrationTest] [IntegrationTest]
@@ -107,7 +107,7 @@ namespace Octokit.Tests.Integration.Clients
var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryId, options); var hooks = await github.Repository.Hooks.GetAll(_fixture.RepositoryId, options);
Assert.Equal(1, hooks.Count); Assert.Single(hooks);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -30,7 +30,7 @@ public class RepositoryInvitationsClientTests
var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id); var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id);
Assert.Equal(1, invitations.Count); Assert.Single(invitations);
Assert.Equal(invitations[0].CreatedAt, response.CreatedAt); Assert.Equal(invitations[0].CreatedAt, response.CreatedAt);
Assert.Equal(invitations[0].Id, response.Id); Assert.Equal(invitations[0].Id, response.Id);
Assert.Equal(invitations[0].Invitee.Login, response.Invitee.Login); Assert.Equal(invitations[0].Invitee.Login, response.Invitee.Login);
@@ -72,7 +72,7 @@ public class RepositoryInvitationsClientTests
var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id, options); var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id, options);
Assert.Equal(1, invitations.Count); Assert.Single(invitations);
} }
} }
@@ -102,7 +102,7 @@ public class RepositoryInvitationsClientTests
var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id, options); var invitations = await github.Repository.Invitation.GetAllForRepository(context.Repository.Id, options);
Assert.Equal(1, invitations.Count); Assert.Single(invitations);
} }
} }
@@ -215,7 +215,7 @@ public class RepositoryInvitationsClientTests
var invitations = await github.Repository.Invitation.GetAllForCurrent(startOptions); var invitations = await github.Repository.Invitation.GetAllForCurrent(startOptions);
Assert.Equal(1, invitations.Count); Assert.Single(invitations);
} }
finally finally
{ {
@@ -262,7 +262,7 @@ public class RepositoryInvitationsClientTests
var invitations = await github.Repository.Invitation.GetAllForCurrent(startOptions); var invitations = await github.Repository.Invitation.GetAllForCurrent(startOptions);
Assert.Equal(1, invitations.Count); Assert.Single(invitations);
} }
finally finally
{ {

View File

@@ -34,7 +34,7 @@ namespace Octokit.Tests.Integration.Clients
var key = await github.Repository.Actions.Secrets.GetPublicKey(OWNER, REPO); var key = await github.Repository.Actions.Secrets.GetPublicKey(OWNER, REPO);
Assert.True(!string.IsNullOrWhiteSpace(key.KeyId)); Assert.False(string.IsNullOrWhiteSpace(key.KeyId));
} }
} }
@@ -64,7 +64,7 @@ namespace Octokit.Tests.Integration.Clients
var secret = await github.Repository.Actions.Secrets.Get(OWNER, REPO, "TEST"); var secret = await github.Repository.Actions.Secrets.Get(OWNER, REPO, "TEST");
Assert.NotNull(secret); Assert.NotNull(secret);
Assert.True(secret.Name == "TEST"); Assert.Equal("TEST", secret.Name);
} }
} }

View File

@@ -47,7 +47,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrent(options); var repositories = await _fixture.GetAllForCurrent(options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -61,7 +61,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrent(options); var repositories = await _fixture.GetAllForCurrent(options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -85,8 +85,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForCurrent(skipStartOptions); var secondPage = await _fixture.GetAllForCurrent(skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -111,7 +111,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrent(starredRequest, options); var repositories = await _fixture.GetAllForCurrent(starredRequest, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -127,7 +127,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrent(starredRequest, options); var repositories = await _fixture.GetAllForCurrent(starredRequest, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -154,8 +154,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForCurrent(starredRequestSecondPage, skipStartOptions); var secondPage = await _fixture.GetAllForCurrent(starredRequestSecondPage, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -181,7 +181,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrentWithTimestamps(options); var repositories = await _fixture.GetAllForCurrentWithTimestamps(options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -195,7 +195,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForCurrentWithTimestamps(options); var repositories = await _fixture.GetAllForCurrentWithTimestamps(options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -219,8 +219,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForCurrentWithTimestamps(skipStartOptions); var secondPage = await _fixture.GetAllForCurrentWithTimestamps(skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id); Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
} }
@@ -255,7 +255,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options); var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
for (int i = 1; i < stars.Count; i++) for (int i = 1; i < stars.Count; i++)
{ {
@@ -276,7 +276,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options); var stars = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
for (int i = 1; i < stars.Count; i++) for (int i = 1; i < stars.Count; i++)
{ {
@@ -307,8 +307,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, skipStartOptions); var secondPage = await _fixture.GetAllForCurrentWithTimestamps(starredRequest, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id); Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
for (int i = 1; i < firstPage.Count; i++) for (int i = 1; i < firstPage.Count; i++)
@@ -337,7 +337,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForUser(Helper.UserName, options); var repositories = await _fixture.GetAllForUser(Helper.UserName, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -351,7 +351,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForUser(Helper.UserName, options); var repositories = await _fixture.GetAllForUser(Helper.UserName, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -375,8 +375,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForUser(Helper.UserName, skipStartOptions); var secondPage = await _fixture.GetAllForUser(Helper.UserName, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -404,7 +404,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options); var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -420,7 +420,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options); var repositories = await _fixture.GetAllForUser(Helper.UserName, starredRequest, options);
Assert.Equal(1, repositories.Count); Assert.Single(repositories);
} }
[IntegrationTest] [IntegrationTest]
@@ -447,8 +447,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForUser(Helper.UserName, starredRequestSecondPage, skipStartOptions); var secondPage = await _fixture.GetAllForUser(Helper.UserName, starredRequestSecondPage, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -474,7 +474,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options); var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
} }
[IntegrationTest] [IntegrationTest]
@@ -488,7 +488,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options); var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
} }
[IntegrationTest] [IntegrationTest]
@@ -512,8 +512,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, skipStartOptions); var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id); Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
} }
@@ -548,7 +548,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options); var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
for (int i = 1; i < stars.Count; i++) for (int i = 1; i < stars.Count; i++)
{ {
@@ -569,7 +569,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options); var stars = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, options);
Assert.Equal(1, stars.Count); Assert.Single(stars);
for (int i = 1; i < stars.Count; i++) for (int i = 1; i < stars.Count; i++)
{ {
@@ -600,8 +600,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, skipStartOptions); var secondPage = await _fixture.GetAllForUserWithTimestamps(Helper.UserName, starredRequest, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id); Assert.NotEqual(firstPage.First().Repo.Id, secondPage.First().Repo.Id);
for (int i = 0; i < firstPage.Count; i++) for (int i = 0; i < firstPage.Count; i++)
@@ -640,7 +640,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options); var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options);
Assert.Equal(1, users.Count); Assert.Single(users);
} }
[IntegrationTest] [IntegrationTest]
@@ -653,7 +653,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var users = await _fixture.GetAllStargazers(7528679, options); var users = await _fixture.GetAllStargazers(7528679, options);
Assert.Equal(1, users.Count); Assert.Single(users);
} }
[IntegrationTest] [IntegrationTest]
@@ -667,7 +667,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options); var users = await _fixture.GetAllStargazers("octokit", "octokit.net", options);
Assert.Equal(1, users.Count); Assert.Single(users);
} }
[IntegrationTest] [IntegrationTest]
@@ -681,7 +681,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var users = await _fixture.GetAllStargazers(7528679, options); var users = await _fixture.GetAllStargazers(7528679, options);
Assert.Equal(1, users.Count); Assert.Single(users);
} }
[IntegrationTest] [IntegrationTest]
@@ -705,8 +705,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllStargazers("octokit", "octokit.net", skipStartOptions); var secondPage = await _fixture.GetAllStargazers("octokit", "octokit.net", skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -731,8 +731,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllStargazers(7528679, skipStartOptions); var secondPage = await _fixture.GetAllStargazers(7528679, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().Id, secondPage.First().Id); Assert.NotEqual(firstPage.First().Id, secondPage.First().Id);
} }
@@ -773,7 +773,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options); var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options);
Assert.Equal(1, userStars.Count); Assert.Single(userStars);
} }
[IntegrationTest] [IntegrationTest]
@@ -786,7 +786,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var userStars = await _fixture.GetAllStargazersWithTimestamps(7528679, options); var userStars = await _fixture.GetAllStargazersWithTimestamps(7528679, options);
Assert.Equal(1, userStars.Count); Assert.Single(userStars);
} }
[IntegrationTest] [IntegrationTest]
@@ -800,7 +800,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options); var userStars = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", options);
Assert.Equal(1, userStars.Count); Assert.Single(userStars);
} }
[IntegrationTest] [IntegrationTest]
@@ -814,7 +814,7 @@ namespace Octokit.Tests.Integration.Clients
}; };
var userStars = await _fixture.GetAllStargazersWithTimestamps(7528679, options); var userStars = await _fixture.GetAllStargazersWithTimestamps(7528679, options);
Assert.Equal(1, userStars.Count); Assert.Single(userStars);
} }
[IntegrationTest] [IntegrationTest]
@@ -838,8 +838,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", skipStartOptions); var secondPage = await _fixture.GetAllStargazersWithTimestamps("octokit", "octokit.net", skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().StarredAt, secondPage.First().StarredAt); Assert.NotEqual(firstPage.First().StarredAt, secondPage.First().StarredAt);
} }
@@ -864,8 +864,8 @@ namespace Octokit.Tests.Integration.Clients
var secondPage = await _fixture.GetAllStargazersWithTimestamps(7528679, skipStartOptions); var secondPage = await _fixture.GetAllStargazersWithTimestamps(7528679, skipStartOptions);
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(1, secondPage.Count); Assert.Single(secondPage);
Assert.NotEqual(firstPage.First().StarredAt, secondPage.First().StarredAt); Assert.NotEqual(firstPage.First().StarredAt, secondPage.First().StarredAt);
} }

View File

@@ -26,13 +26,13 @@ namespace Octokit.Tests.Integration.Clients
var contributors = await _client.Repository.Statistics.GetContributors(repository.Owner, repository.Name); var contributors = await _client.Repository.Statistics.GetContributors(repository.Owner, repository.Name);
Assert.NotNull(contributors); Assert.NotNull(contributors);
Assert.Equal(1, contributors.Count); Assert.Single(contributors);
var soleContributor = contributors.First(); var soleContributor = contributors.First();
Assert.NotNull(soleContributor.Author); Assert.NotNull(soleContributor.Author);
Assert.True(soleContributor.Author.Login == repository.Owner); Assert.True(soleContributor.Author.Login == repository.Owner);
Assert.Equal(1, soleContributor.Weeks.Count); Assert.Single(soleContributor.Weeks);
Assert.Equal(1, soleContributor.Total); Assert.Equal(1, soleContributor.Total);
} }
} }
@@ -47,13 +47,13 @@ namespace Octokit.Tests.Integration.Clients
var contributors = await _client.Repository.Statistics.GetContributors(context.Repository.Id); var contributors = await _client.Repository.Statistics.GetContributors(context.Repository.Id);
Assert.NotNull(contributors); Assert.NotNull(contributors);
Assert.Equal(1, contributors.Count); Assert.Single(contributors);
var soleContributor = contributors.First(); var soleContributor = contributors.First();
Assert.NotNull(soleContributor.Author); Assert.NotNull(soleContributor.Author);
Assert.True(soleContributor.Author.Login == repository.Owner); Assert.True(soleContributor.Author.Login == repository.Owner);
Assert.Equal(1, soleContributor.Weeks.Count); Assert.Single(soleContributor.Weeks);
Assert.Equal(1, soleContributor.Total); Assert.Equal(1, soleContributor.Total);
} }
} }

View File

@@ -94,7 +94,7 @@ public class TeamsClientTests
var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options); var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options);
Assert.Equal(1, teams.Count); Assert.Single(teams);
Assert.Equal(team1.Id, teams[0].Id); Assert.Equal(team1.Id, teams[0].Id);
} }
} }
@@ -116,7 +116,7 @@ public class TeamsClientTests
var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options); var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options);
Assert.Equal(1, teams.Count); Assert.Single(teams);
Assert.Equal(team2.Id, teams[0].Id); Assert.Equal(team2.Id, teams[0].Id);
} }
} }
@@ -333,7 +333,7 @@ public class TeamsClientTests
var addedRepo = await _github.Organization.Team.GetAllRepositories(team.Id); var addedRepo = await _github.Organization.Team.GetAllRepositories(team.Id);
//Check if permission was correctly applied //Check if permission was correctly applied
Assert.True(addedRepo.First(x => x.Id == repo.Id).Permissions.Admin == true); Assert.True(addedRepo.First(x => x.Id == repo.Id).Permissions.Admin);
} }
} }
} }
@@ -390,7 +390,7 @@ public class TeamsClientTests
var pendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, options); var pendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, options);
Assert.NotEmpty(pendingInvitations); Assert.NotEmpty(pendingInvitations);
Assert.Equal(1, pendingInvitations.Count); Assert.Single(pendingInvitations);
} }
} }
@@ -411,7 +411,7 @@ public class TeamsClientTests
var firstPagePendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, firstPageOptions); var firstPagePendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, firstPageOptions);
Assert.NotEmpty(firstPagePendingInvitations); Assert.NotEmpty(firstPagePendingInvitations);
Assert.Equal(1, firstPagePendingInvitations.Count); Assert.Single(firstPagePendingInvitations);
var secondPageOptions = new ApiOptions var secondPageOptions = new ApiOptions
{ {
@@ -422,7 +422,7 @@ public class TeamsClientTests
var secondPagePendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, secondPageOptions); var secondPagePendingInvitations = await _gitHub.Organization.Team.GetAllPendingInvitations(teamContext.TeamId, secondPageOptions);
Assert.NotEmpty(secondPagePendingInvitations); Assert.NotEmpty(secondPagePendingInvitations);
Assert.Equal(1, secondPagePendingInvitations.Count); Assert.Single(secondPagePendingInvitations);
Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login); Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login);
} }
@@ -604,7 +604,7 @@ public class TeamsClientTests
{ {
var teamRepositories = await github.Organization.Team.GetAllRepositories(teamContext.TeamId); var teamRepositories = await github.Organization.Team.GetAllRepositories(teamContext.TeamId);
Assert.Equal(0, teamRepositories.Count); Assert.Empty(teamRepositories);
await github.Organization.Team.AddOrUpdateTeamRepositoryPermissions( await github.Organization.Team.AddOrUpdateTeamRepositoryPermissions(
Helper.Organization, Helper.Organization,
@@ -678,7 +678,7 @@ public class TeamsClientTests
var addedRepo = await github.Organization.Team.GetAllRepositories(teamContext.TeamId); var addedRepo = await github.Organization.Team.GetAllRepositories(teamContext.TeamId);
Assert.Equal(0, addedRepo.Count); Assert.Empty(addedRepo);
} }
} }
} }

View File

@@ -113,7 +113,7 @@ public class TreeClientTests : IDisposable
var result = await _fixture.Get(_context.RepositoryOwner, _context.RepositoryName, tree.Sha); var result = await _fixture.Get(_context.RepositoryOwner, _context.RepositoryName, tree.Sha);
Assert.NotNull(result); Assert.NotNull(result);
Assert.Equal(1, result.Tree.Count); Assert.Single(result.Tree);
} }
[IntegrationTest] [IntegrationTest]
@@ -141,7 +141,7 @@ public class TreeClientTests : IDisposable
var result = await _fixture.Get(_context.Repository.Id, tree.Sha); var result = await _fixture.Get(_context.Repository.Id, tree.Sha);
Assert.NotNull(result); Assert.NotNull(result);
Assert.Equal(1, result.Tree.Count); Assert.Single(result.Tree);
} }
public void Dispose() public void Dispose()

View File

@@ -54,7 +54,7 @@ namespace Octokit.Tests.Integration
// Check response message indicates LDAP sync was queued // Check response message indicates LDAP sync was queued
Assert.NotNull(response); Assert.NotNull(response);
Assert.NotNull(response.Status); Assert.NotNull(response.Status);
Assert.True(response.Status == "queued"); Assert.Equal("queued", response.Status);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -85,7 +85,7 @@ namespace Octokit.Tests.Integration
// Check response message indicates LDAP sync was queued // Check response message indicates LDAP sync was queued
Assert.NotNull(response); Assert.NotNull(response);
Assert.NotNull(response.Status); Assert.NotNull(response.Status);
Assert.True(response.Status == "queued"); Assert.Equal("queued", response.Status);
} }
public void Dispose() public void Dispose()

View File

@@ -56,7 +56,7 @@ public class ObservableEnterprisePreReceiveEnvironmentsClientTests
var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options).ToList(); var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options).ToList();
Assert.Equal(1, preReceiveEnvironments.Count); Assert.Single(preReceiveEnvironments);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -71,7 +71,7 @@ public class ObservableEnterprisePreReceiveEnvironmentsClientTests
var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options).ToList(); var preReceiveEnvironments = await _preReceiveEnvironmentsClient.GetAll(options).ToList();
Assert.Equal(1, preReceiveEnvironments.Count); Assert.Single(preReceiveEnvironments);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]

View File

@@ -56,7 +56,7 @@ public class ObservableEnterprisePreReceiveHooksClientTests
var preReceiveHooks = await _preReceiveHooksClient.GetAll(options).ToList(); var preReceiveHooks = await _preReceiveHooksClient.GetAll(options).ToList();
Assert.Equal(1, preReceiveHooks.Count); Assert.Single(preReceiveHooks);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]
@@ -71,7 +71,7 @@ public class ObservableEnterprisePreReceiveHooksClientTests
var preReceiveHooks = await _preReceiveHooksClient.GetAll(options).ToList(); var preReceiveHooks = await _preReceiveHooksClient.GetAll(options).ToList();
Assert.Equal(1, preReceiveHooks.Count); Assert.Single(preReceiveHooks);
} }
[GitHubEnterpriseTest] [GitHubEnterpriseTest]

View File

@@ -422,7 +422,7 @@ namespace Octokit.Tests.Integration.Reactive
var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryOwner, repoContext.RepositoryName, created.Id).ToList(); var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryOwner, repoContext.RepositoryName, created.Id).ToList();
// Check result // Check result
Assert.Equal(1, annotations.Count); Assert.Single(annotations);
Assert.Equal("this is a warning", annotations.First().Message); Assert.Equal("this is a warning", annotations.First().Message);
Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel); Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel);
} }
@@ -455,7 +455,7 @@ namespace Octokit.Tests.Integration.Reactive
var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryId, created.Id).ToList(); var annotations = await _githubAppInstallation.Check.Run.GetAllAnnotations(repoContext.RepositoryId, created.Id).ToList();
// Check result // Check result
Assert.Equal(1, annotations.Count); Assert.Single(annotations);
Assert.Equal("this is a warning", annotations.First().Message); Assert.Equal("this is a warning", annotations.First().Message);
Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel); Assert.Equal(CheckAnnotationLevel.Warning, annotations.First().AnnotationLevel);
} }

View File

@@ -38,7 +38,7 @@ namespace Octokit.Tests.Integration.Reactive
var followers = await _followersClient.GetAllForCurrent(options).ToList(); var followers = await _followersClient.GetAllForCurrent(options).ToList();
Assert.Equal(1, followers.Count); Assert.Single(followers);
} }
[IntegrationTest] [IntegrationTest]
@@ -53,7 +53,7 @@ namespace Octokit.Tests.Integration.Reactive
var followers = await _followersClient.GetAllForCurrent(options).ToList(); var followers = await _followersClient.GetAllForCurrent(options).ToList();
Assert.Equal(1, followers.Count); Assert.Single(followers);
} }
[IntegrationTest] [IntegrationTest]
@@ -188,7 +188,7 @@ namespace Octokit.Tests.Integration.Reactive
var following = await _followersClient.GetAllFollowingForCurrent(options).ToList(); var following = await _followersClient.GetAllFollowingForCurrent(options).ToList();
Assert.Equal(1, following.Count); Assert.Single(following);
} }
[IntegrationTest] [IntegrationTest]
@@ -203,7 +203,7 @@ namespace Octokit.Tests.Integration.Reactive
var following = await _followersClient.GetAllFollowingForCurrent(options).ToList(); var following = await _followersClient.GetAllFollowingForCurrent(options).ToList();
Assert.Equal(1, following.Count); Assert.Single(following);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -27,7 +27,7 @@ namespace Octokit.Tests.Integration.Reactive
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503); var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503);
var timelineEventInfos = await observableTimeline.ToList(); var timelineEventInfos = await observableTimeline.ToList();
Assert.NotEmpty(timelineEventInfos); Assert.NotEmpty(timelineEventInfos);
Assert.NotEqual(0, timelineEventInfos.Count); Assert.NotEmpty(timelineEventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -47,7 +47,7 @@ namespace Octokit.Tests.Integration.Reactive
observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions); observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
timelineEventInfos = await observableTimeline.ToList(); timelineEventInfos = await observableTimeline.ToList();
Assert.NotEmpty(timelineEventInfos); Assert.NotEmpty(timelineEventInfos);
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
} }
[IntegrationTest] [IntegrationTest]
@@ -64,7 +64,7 @@ namespace Octokit.Tests.Integration.Reactive
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var timelineEventInfos = await observableTimeline.ToList(); var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From);
Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To);
} }
@@ -82,7 +82,7 @@ namespace Octokit.Tests.Integration.Reactive
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var timelineEventInfos = await observableTimeline.ToList(); var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
} }
@@ -103,7 +103,7 @@ namespace Octokit.Tests.Integration.Reactive
observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number);
timelineEventInfos = await observableTimeline.ToList(); timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event); Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
} }
@@ -121,7 +121,7 @@ namespace Octokit.Tests.Integration.Reactive
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number);
var timelineEventInfos = await observableTimeline.ToList(); var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal("a test issue", timelineEventInfos[0].Rename.From); Assert.Equal("a test issue", timelineEventInfos[0].Rename.From);
Assert.Equal("A test issue", timelineEventInfos[0].Rename.To); Assert.Equal("A test issue", timelineEventInfos[0].Rename.To);
} }
@@ -139,7 +139,7 @@ namespace Octokit.Tests.Integration.Reactive
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number); var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number);
var timelineEventInfos = await observableTimeline.ToList(); var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count); Assert.Single(timelineEventInfos);
Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id); Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
} }
} }

View File

@@ -223,7 +223,7 @@ namespace Octokit.Tests.Integration.Reactive
var pendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, options).ToList(); var pendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, options).ToList();
Assert.NotEmpty(pendingInvitations); Assert.NotEmpty(pendingInvitations);
Assert.Equal(1, pendingInvitations.Count); Assert.Single(pendingInvitations);
} }
} }
@@ -244,7 +244,7 @@ namespace Octokit.Tests.Integration.Reactive
var firstPagePendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, firstPageOptions).ToList(); var firstPagePendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, firstPageOptions).ToList();
Assert.NotEmpty(firstPagePendingInvitations); Assert.NotEmpty(firstPagePendingInvitations);
Assert.Equal(1, firstPagePendingInvitations.Count); Assert.Single(firstPagePendingInvitations);
var secondPageOptions = new ApiOptions var secondPageOptions = new ApiOptions
@@ -256,7 +256,7 @@ namespace Octokit.Tests.Integration.Reactive
var secondPagePendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, secondPageOptions).ToList(); var secondPagePendingInvitations = await _client.GetAllPendingInvitations(Helper.Organization, secondPageOptions).ToList();
Assert.NotEmpty(secondPagePendingInvitations); Assert.NotEmpty(secondPagePendingInvitations);
Assert.Equal(1, secondPagePendingInvitations.Count); Assert.Single(secondPagePendingInvitations);
Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login); Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login);
} }

View File

@@ -42,7 +42,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization).ToList(); .GetAll(Helper.Organization).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -64,7 +64,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization, options).ToList(); .GetAll(Helper.Organization, options).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -88,7 +88,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization, options).ToList(); .GetAll(Helper.Organization, options).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -128,7 +128,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization, OrganizationMembersFilter.All, options).ToList(); .GetAll(Helper.Organization, OrganizationMembersFilter.All, options).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
} }
} }
@@ -161,8 +161,8 @@ namespace Octokit.Tests.Integration.Reactive
var secondPageOfOutsideCollaborators = await _client var secondPageOfOutsideCollaborators = await _client
.GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions).ToList(); .GetAll(Helper.Organization, OrganizationMembersFilter.All, secondPageOptions).ToList();
Assert.Equal(1, firstPageOfOutsideCollaborators.Count); Assert.Single(firstPageOfOutsideCollaborators);
Assert.Equal(1, secondPageOfOutsideCollaborators.Count); Assert.Single(secondPageOfOutsideCollaborators);
Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login); Assert.NotEqual(firstPageOfOutsideCollaborators[0].Login, secondPageOfOutsideCollaborators[0].Login);
} }
} }
@@ -180,7 +180,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled).ToList(); .GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal("octokitnet-test1", outsideCollaborators[0].Login); Assert.Equal("octokitnet-test1", outsideCollaborators[0].Login);
} }
} }
@@ -204,7 +204,7 @@ namespace Octokit.Tests.Integration.Reactive
.GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options).ToList(); .GetAll(Helper.Organization, OrganizationMembersFilter.TwoFactorAuthenticationDisabled, options).ToList();
Assert.NotNull(outsideCollaborators); Assert.NotNull(outsideCollaborators);
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal("octokitnet-test1", outsideCollaborators[0].Login); Assert.Equal("octokitnet-test1", outsideCollaborators[0].Login);
} }
} }
@@ -262,7 +262,7 @@ namespace Octokit.Tests.Integration.Reactive
var outsideCollaborators = await _client var outsideCollaborators = await _client
.GetAll(Helper.Organization).ToList(); .GetAll(Helper.Organization).ToList();
Assert.Equal(1, outsideCollaborators.Count); Assert.Single(outsideCollaborators);
Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login); Assert.Equal(_fixtureCollaborator, outsideCollaborators[0].Login);
} }
} }

View File

@@ -27,7 +27,7 @@ namespace Octokit.Tests.Integration.Reactive
var keyObservable = clients.GetPublicKey(Helper.Organization); var keyObservable = clients.GetPublicKey(Helper.Organization);
var key = await keyObservable; var key = await keyObservable;
Assert.True(!string.IsNullOrWhiteSpace(key.KeyId)); Assert.False(string.IsNullOrWhiteSpace(key.KeyId));
} }
} }
@@ -61,7 +61,7 @@ namespace Octokit.Tests.Integration.Reactive
var secret = await secretObservable; var secret = await secretObservable;
Assert.NotNull(secret); Assert.NotNull(secret);
Assert.True(secret.Name == "TEST"); Assert.Equal("TEST", secret.Name);
} }
} }

View File

@@ -50,7 +50,7 @@ public class ObservableProjectCardsClientTests
var result = await _github.Repository.Project.Card.GetAll(column.Id, request).ToList(); var result = await _github.Repository.Project.Card.GetAll(column.Id, request).ToList();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Contains(result, x => x.Id == card2.Id); Assert.Contains(result, x => x.Id == card2.Id);
} }
@@ -66,7 +66,7 @@ public class ObservableProjectCardsClientTests
var result = await _github.Repository.Project.Card.GetAll(column.Id, request).ToList(); var result = await _github.Repository.Project.Card.GetAll(column.Id, request).ToList();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Contains(result, x => x.Id == card1.Id); Assert.Contains(result, x => x.Id == card1.Id);
} }
@@ -104,7 +104,7 @@ public class ObservableProjectCardsClientTests
var cards = await _github.Repository.Project.Card.GetAll(column.Id, options).ToList(); var cards = await _github.Repository.Project.Card.GetAll(column.Id, options).ToList();
// NOTE: cards are returned in reverse order // NOTE: cards are returned in reverse order
Assert.Equal(1, cards.Count); Assert.Single(cards);
Assert.Equal(card2.Id, cards[0].Id); Assert.Equal(card2.Id, cards[0].Id);
} }
@@ -126,7 +126,7 @@ public class ObservableProjectCardsClientTests
var cards = await _github.Repository.Project.Card.GetAll(column.Id, options).ToList(); var cards = await _github.Repository.Project.Card.GetAll(column.Id, options).ToList();
// NOTE: cards are returned in reverse order // NOTE: cards are returned in reverse order
Assert.Equal(1, cards.Count); Assert.Single(cards);
Assert.Equal(card1.Id, cards[0].Id); Assert.Equal(card1.Id, cards[0].Id);
} }

View File

@@ -53,7 +53,7 @@ public class ObservableProjectColumnsClientTests
var columns = await _github.Repository.Project.Column.GetAll(project.Id, options).ToList(); var columns = await _github.Repository.Project.Column.GetAll(project.Id, options).ToList();
Assert.Equal(1, columns.Count); Assert.Single(columns);
Assert.Equal(column1.Id, columns[0].Id); Assert.Equal(column1.Id, columns[0].Id);
} }
@@ -73,7 +73,7 @@ public class ObservableProjectColumnsClientTests
var columns = await _github.Repository.Project.Column.GetAll(project.Id, options).ToList(); var columns = await _github.Repository.Project.Column.GetAll(project.Id, options).ToList();
Assert.Equal(1, columns.Count); Assert.Single(columns);
Assert.Equal(column2.Id, columns[0].Id); Assert.Equal(column2.Id, columns[0].Id);
} }

View File

@@ -61,7 +61,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new ProjectRequest(ItemStateFilter.Closed)).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new ProjectRequest(ItemStateFilter.Closed)).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id); Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id);
} }
@@ -76,7 +76,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, new ProjectRequest(ItemStateFilter.Closed)).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, new ProjectRequest(ItemStateFilter.Closed)).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id); Assert.True(projects.FirstOrDefault(x => x.Name == project2.Name).Id == project2.Id);
} }
@@ -94,7 +94,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project1.Id, projects[0].Id); Assert.Equal(project1.Id, projects[0].Id);
} }
@@ -112,7 +112,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project1.Id, projects[0].Id); Assert.Equal(project1.Id, projects[0].Id);
} }
@@ -131,7 +131,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, options).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project2.Id, projects[0].Id); Assert.Equal(project2.Id, projects[0].Id);
} }
@@ -150,7 +150,7 @@ public class ObservableProjectsClientTests
var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options).ToList(); var projects = await _github.Repository.Project.GetAllForRepository(_context.RepositoryId, options).ToList();
Assert.Equal(1, projects.Count); Assert.Single(projects);
Assert.Equal(project2.Id, projects[0].Id); Assert.Equal(project2.Id, projects[0].Id);
} }

View File

@@ -76,14 +76,14 @@ namespace Octokit.Tests.Integration.Reactive
Assert.True(protection.RequiredStatusChecks.Strict); Assert.True(protection.RequiredStatusChecks.Strict);
Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count); Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count);
Assert.Equal(1, protection.RequiredPullRequestReviews.DismissalRestrictions.Teams.Count); Assert.Single(protection.RequiredPullRequestReviews.DismissalRestrictions.Teams);
Assert.Equal(0, protection.RequiredPullRequestReviews.DismissalRestrictions.Users.Count); Assert.Empty(protection.RequiredPullRequestReviews.DismissalRestrictions.Users);
Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews); Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews);
Assert.Equal(3, protection.RequiredPullRequestReviews.RequiredApprovingReviewCount); Assert.Equal(3, protection.RequiredPullRequestReviews.RequiredApprovingReviewCount);
Assert.Equal(1, protection.Restrictions.Teams.Count); Assert.Single(protection.Restrictions.Teams);
Assert.Equal(0, protection.Restrictions.Users.Count); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.EnforceAdmins.Enabled); Assert.True(protection.EnforceAdmins.Enabled);
} }
@@ -100,14 +100,14 @@ namespace Octokit.Tests.Integration.Reactive
Assert.True(protection.RequiredStatusChecks.Strict); Assert.True(protection.RequiredStatusChecks.Strict);
Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count); Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count);
Assert.Equal(1, protection.RequiredPullRequestReviews.DismissalRestrictions.Teams.Count); Assert.Single(protection.RequiredPullRequestReviews.DismissalRestrictions.Teams);
Assert.Equal(0, protection.RequiredPullRequestReviews.DismissalRestrictions.Users.Count); Assert.Empty(protection.RequiredPullRequestReviews.DismissalRestrictions.Users);
Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.True(protection.RequiredPullRequestReviews.DismissStaleReviews);
Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews); Assert.True(protection.RequiredPullRequestReviews.RequireCodeOwnerReviews);
Assert.Equal(3, protection.RequiredPullRequestReviews.RequiredApprovingReviewCount); Assert.Equal(3, protection.RequiredPullRequestReviews.RequiredApprovingReviewCount);
Assert.Equal(1, protection.Restrictions.Teams.Count); Assert.Single(protection.Restrictions.Teams);
Assert.Equal(0, protection.Restrictions.Users.Count); Assert.Empty(protection.Restrictions.Users);
Assert.True(protection.EnforceAdmins.Enabled); Assert.True(protection.EnforceAdmins.Enabled);
} }
@@ -140,7 +140,7 @@ namespace Octokit.Tests.Integration.Reactive
var protection = await _client.UpdateBranchProtection(repoOwner, repoName, "main", update); var protection = await _client.UpdateBranchProtection(repoOwner, repoName, "main", update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -167,7 +167,7 @@ namespace Octokit.Tests.Integration.Reactive
var protection = await _client.UpdateBranchProtection(repoId, "main", update); var protection = await _client.UpdateBranchProtection(repoId, "main", update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -202,7 +202,7 @@ namespace Octokit.Tests.Integration.Reactive
var protection = await _client.UpdateBranchProtection(repoOwner, repoName, "main", update); var protection = await _client.UpdateBranchProtection(repoOwner, repoName, "main", update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -243,7 +243,7 @@ namespace Octokit.Tests.Integration.Reactive
var protection = await _client.UpdateBranchProtection(repoId, "main", update); var protection = await _client.UpdateBranchProtection(repoId, "main", update);
Assert.False(protection.RequiredStatusChecks.Strict); Assert.False(protection.RequiredStatusChecks.Strict);
Assert.Equal(1, protection.RequiredStatusChecks.Contexts.Count); Assert.Single(protection.RequiredStatusChecks.Contexts);
Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions); Assert.Null(protection.RequiredPullRequestReviews.DismissalRestrictions);
Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews); Assert.False(protection.RequiredPullRequestReviews.DismissStaleReviews);
@@ -375,8 +375,8 @@ namespace Octokit.Tests.Integration.Reactive
var repoName = context.RepositoryContext.RepositoryName; var repoName = context.RepositoryContext.RepositoryName;
var requiredReviews = await _client.GetReviewEnforcement(repoOwner, repoName, "main"); var requiredReviews = await _client.GetReviewEnforcement(repoOwner, repoName, "main");
Assert.Equal(1, requiredReviews.DismissalRestrictions.Teams.Count); Assert.Single(requiredReviews.DismissalRestrictions.Teams);
Assert.Equal(0, requiredReviews.DismissalRestrictions.Users.Count); Assert.Empty(requiredReviews.DismissalRestrictions.Users);
Assert.True(requiredReviews.DismissStaleReviews); Assert.True(requiredReviews.DismissStaleReviews);
Assert.True(requiredReviews.RequireCodeOwnerReviews); Assert.True(requiredReviews.RequireCodeOwnerReviews);
} }
@@ -390,8 +390,8 @@ namespace Octokit.Tests.Integration.Reactive
var repoId = context.RepositoryContext.RepositoryId; var repoId = context.RepositoryContext.RepositoryId;
var requiredReviews = await _client.GetReviewEnforcement(repoId, "main"); var requiredReviews = await _client.GetReviewEnforcement(repoId, "main");
Assert.Equal(1, requiredReviews.DismissalRestrictions.Teams.Count); Assert.Single(requiredReviews.DismissalRestrictions.Teams);
Assert.Equal(0, requiredReviews.DismissalRestrictions.Users.Count); Assert.Empty(requiredReviews.DismissalRestrictions.Users);
Assert.True(requiredReviews.DismissStaleReviews); Assert.True(requiredReviews.DismissStaleReviews);
Assert.True(requiredReviews.RequireCodeOwnerReviews); Assert.True(requiredReviews.RequireCodeOwnerReviews);
} }

View File

@@ -24,7 +24,7 @@ public class ObservableRepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName).ToList(); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName).ToList();
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -47,7 +47,7 @@ public class ObservableRepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options).ToList(); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options).ToList();
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(1, collaborators.Count); Assert.Single(collaborators);
} }
} }
@@ -71,7 +71,7 @@ public class ObservableRepositoryCollaboratorClientTests
var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options).ToList(); var collaborators = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, options).ToList();
Assert.NotNull(collaborators); Assert.NotNull(collaborators);
Assert.Equal(0, collaborators.Count); Assert.Empty(collaborators);
} }
} }
@@ -102,8 +102,8 @@ public class ObservableRepositoryCollaboratorClientTests
var secondPage = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, skipStartOptions).ToList(); var secondPage = await fixture.GetAll(context.RepositoryOwner, context.RepositoryName, skipStartOptions).ToList();
Assert.Equal(1, firstPage.Count); Assert.Single(firstPage);
Assert.Equal(0, secondPage.Count); Assert.Empty(secondPage);
} }
} }
} }

View File

@@ -56,7 +56,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
await _client.Create(_owner, _repository.Name, deployKey); await _client.Create(_owner, _repository.Name, deployKey);
deployKeys = await _client.GetAll(_owner, _repository.Name).ToList(); deployKeys = await _client.GetAll(_owner, _repository.Name).ToList();
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);
} }
@@ -90,7 +90,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
await _client.Create(_owner, _repository.Name, newDeployKey); await _client.Create(_owner, _repository.Name, newDeployKey);
var deployKeys = await _client.GetAll(_owner, _repository.Name).ToList(); var deployKeys = await _client.GetAll(_owner, _repository.Name).ToList();
Assert.Equal(1, deployKeys.Count); Assert.Single(deployKeys);
Assert.Equal(_key, deployKeys[0].Key); Assert.Equal(_key, deployKeys[0].Key);
Assert.Equal(_keyTitle, deployKeys[0].Title); Assert.Equal(_keyTitle, deployKeys[0].Title);

View File

@@ -67,7 +67,7 @@ namespace Octokit.Tests.Integration.Reactive
var hooks = await client.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options).ToList(); var hooks = await client.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, options).ToList();
Assert.Equal(1, hooks.Count); Assert.Single(hooks);
} }
[IntegrationTest] [IntegrationTest]

View File

@@ -31,7 +31,7 @@ namespace Octokit.Tests.Integration.Reactive.Clients
var keyObservable = client.GetPublicKey(OWNER, REPO); var keyObservable = client.GetPublicKey(OWNER, REPO);
var key = await keyObservable; var key = await keyObservable;
Assert.True(!string.IsNullOrWhiteSpace(key.KeyId)); Assert.False(string.IsNullOrWhiteSpace(key.KeyId));
} }
} }

View File

@@ -51,7 +51,7 @@ public class ObservableTeamsClientTests
var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options).ToList(); var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options).ToList();
Assert.Equal(1, teams.Count); Assert.Single(teams);
Assert.Equal(team1.Id, teams[0].Id); Assert.Equal(team1.Id, teams[0].Id);
} }
} }
@@ -73,7 +73,7 @@ public class ObservableTeamsClientTests
var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options).ToList(); var teams = await _github.Organization.Team.GetAllChildTeams(parentTeamContext.TeamId, options).ToList();
Assert.Equal(1, teams.Count); Assert.Single(teams);
Assert.Equal(team2.Id, teams[0].Id); Assert.Equal(team2.Id, teams[0].Id);
} }
} }
@@ -323,7 +323,7 @@ public class ObservableTeamsClientTests
var observable = _client.GetAllPendingInvitations(teamContext.TeamId, options); var observable = _client.GetAllPendingInvitations(teamContext.TeamId, options);
var pendingInvitations = await observable.ToList(); var pendingInvitations = await observable.ToList();
Assert.NotEmpty(pendingInvitations); Assert.NotEmpty(pendingInvitations);
Assert.Equal(1, pendingInvitations.Count); Assert.Single(pendingInvitations);
} }
} }
@@ -344,7 +344,7 @@ public class ObservableTeamsClientTests
var firstObservable = _client.GetAllPendingInvitations(teamContext.TeamId, firstPageOptions); var firstObservable = _client.GetAllPendingInvitations(teamContext.TeamId, firstPageOptions);
var firstPagePendingInvitations = await firstObservable.ToList(); var firstPagePendingInvitations = await firstObservable.ToList();
Assert.NotEmpty(firstPagePendingInvitations); Assert.NotEmpty(firstPagePendingInvitations);
Assert.Equal(1, firstPagePendingInvitations.Count); Assert.Single(firstPagePendingInvitations);
var secondPageOptions = new ApiOptions var secondPageOptions = new ApiOptions
{ {
@@ -355,7 +355,7 @@ public class ObservableTeamsClientTests
var secondObservable = _client.GetAllPendingInvitations(teamContext.TeamId, secondPageOptions); var secondObservable = _client.GetAllPendingInvitations(teamContext.TeamId, secondPageOptions);
var secondPagePendingInvitations = await secondObservable.ToList(); var secondPagePendingInvitations = await secondObservable.ToList();
Assert.NotEmpty(secondPagePendingInvitations); Assert.NotEmpty(secondPagePendingInvitations);
Assert.Equal(1, secondPagePendingInvitations.Count); Assert.Single(secondPagePendingInvitations);
Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login); Assert.NotEqual(firstPagePendingInvitations[0].Login, secondPagePendingInvitations[0].Login);
} }
@@ -618,7 +618,7 @@ public class ObservableTeamsClientTests
var addedRepo = await github.Organization.Team.GetAllRepositories(teamContext.TeamId).ToList(); var addedRepo = await github.Organization.Team.GetAllRepositories(teamContext.TeamId).ToList();
Assert.Equal(0, addedRepo.Count); Assert.Empty(addedRepo);
} }
} }
} }

View File

@@ -594,7 +594,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var activity = activities.FirstOrDefault(); var activity = activities.FirstOrDefault();
Assert.Equal(kvp.Value, activity.Payload.GetType()); Assert.Equal(kvp.Value, activity.Payload.GetType());
Assert.NotNull(activity.Payload.Repository); Assert.NotNull(activity.Payload.Repository);
@@ -623,7 +623,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as CommitCommentPayload; var payload = activities.FirstOrDefault().Payload as CommitCommentPayload;
Assert.Equal(1337, payload.Comment.Id); Assert.Equal(1337, payload.Comment.Id);
@@ -646,7 +646,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as CreateEventPayload; var payload = activities.FirstOrDefault().Payload as CreateEventPayload;
Assert.Equal(GitHubConstants.DefaultBranchName, payload.Ref); Assert.Equal(GitHubConstants.DefaultBranchName, payload.Ref);
@@ -670,7 +670,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as DeleteEventPayload; var payload = activities.FirstOrDefault().Payload as DeleteEventPayload;
Assert.Equal(GitHubConstants.DefaultBranchName, payload.Ref); Assert.Equal(GitHubConstants.DefaultBranchName, payload.Ref);
@@ -696,7 +696,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as ForkEventPayload; var payload = activities.FirstOrDefault().Payload as ForkEventPayload;
Assert.Equal(1337, payload.Forkee.Id); Assert.Equal(1337, payload.Forkee.Id);
@@ -726,7 +726,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as IssueCommentPayload; var payload = activities.FirstOrDefault().Payload as IssueCommentPayload;
Assert.Equal("created", payload.Action); Assert.Equal("created", payload.Action);
@@ -762,7 +762,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as IssueEventPayload; var payload = activities.FirstOrDefault().Payload as IssueEventPayload;
Assert.Equal("created", payload.Action); Assert.Equal("created", payload.Action);
@@ -792,7 +792,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as PullRequestEventPayload; var payload = activities.FirstOrDefault().Payload as PullRequestEventPayload;
Assert.Equal("assigned", payload.Action); Assert.Equal("assigned", payload.Action);
@@ -826,7 +826,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as PullRequestReviewEventPayload; var payload = activities.FirstOrDefault().Payload as PullRequestReviewEventPayload;
Assert.Equal("submitted", payload.Action); Assert.Equal("submitted", payload.Action);
@@ -861,7 +861,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as PullRequestCommentPayload; var payload = activities.FirstOrDefault().Payload as PullRequestCommentPayload;
Assert.Equal("assigned", payload.Action); Assert.Equal("assigned", payload.Action);
@@ -897,14 +897,14 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as PushEventPayload; var payload = activities.FirstOrDefault().Payload as PushEventPayload;
Assert.Equal("head", payload.Head); Assert.Equal("head", payload.Head);
Assert.Equal("ref", payload.Ref); Assert.Equal("ref", payload.Ref);
Assert.Equal(1337, payload.Size); Assert.Equal(1337, payload.Size);
Assert.NotNull(payload.Commits); Assert.NotNull(payload.Commits);
Assert.Equal(1, payload.Commits.Count); Assert.Single(payload.Commits);
Assert.Equal("message", payload.Commits.FirstOrDefault().Message); Assert.Equal("message", payload.Commits.FirstOrDefault().Message);
Assert.Equal("before", payload.Before); Assert.Equal("before", payload.Before);
Assert.Equal(1337, payload.DistinctSize); Assert.Equal(1337, payload.DistinctSize);
@@ -977,7 +977,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as StatusEventPayload; var payload = activities.FirstOrDefault().Payload as StatusEventPayload;
Assert.Equal(214015194, payload.Id); Assert.Equal(214015194, payload.Id);
@@ -987,7 +987,7 @@ namespace Octokit.Tests.Clients
Assert.Equal("default", payload.Context); Assert.Equal("default", payload.Context);
Assert.Equal("some human readable text", payload.Description); Assert.Equal("some human readable text", payload.Description);
Assert.Equal(CommitState.Success, payload.State.Value); Assert.Equal(CommitState.Success, payload.State.Value);
Assert.Equal(1, payload.Branches.Count); Assert.Single(payload.Branches);
Assert.Equal(new DateTimeOffset(2015, 05, 05, 23, 40, 39, TimeSpan.Zero), payload.CreatedAt); Assert.Equal(new DateTimeOffset(2015, 05, 05, 23, 40, 39, TimeSpan.Zero), payload.CreatedAt);
} }
@@ -1007,7 +1007,7 @@ namespace Octokit.Tests.Clients
var client = GetTestingEventsClient(jsonObj); var client = GetTestingEventsClient(jsonObj);
var activities = await client.GetAll(); var activities = await client.GetAll();
Assert.Equal(1, activities.Count); Assert.Single(activities);
var payload = activities.FirstOrDefault().Payload as StarredEventPayload; var payload = activities.FirstOrDefault().Payload as StarredEventPayload;
Assert.Equal("started", payload.Action); Assert.Equal("started", payload.Action);

View File

@@ -147,7 +147,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContents("fake", "repo", "readme.md"); var contents = await contentsClient.GetAllContents("fake", "repo", "readme.md");
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/readme.md")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/readme.md"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -162,7 +162,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContents(1, "readme.md"); var contents = await contentsClient.GetAllContents(1, "readme.md");
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/readme.md")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/readme.md"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -177,7 +177,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContents("fake", "repo"); var contents = await contentsClient.GetAllContents("fake", "repo");
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -192,7 +192,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContents(1); var contents = await contentsClient.GetAllContents(1);
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -266,7 +266,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContentsByRef("fake", "repo", "readme.md", GitHubConstants.DefaultBranchName); var contents = await contentsClient.GetAllContentsByRef("fake", "repo", "readme.md", GitHubConstants.DefaultBranchName);
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/readme.md?ref={GitHubConstants.DefaultBranchName}")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -281,7 +281,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContentsByRef(1, "readme.md", GitHubConstants.DefaultBranchName); var contents = await contentsClient.GetAllContentsByRef(1, "readme.md", GitHubConstants.DefaultBranchName);
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/readme.md?ref={GitHubConstants.DefaultBranchName}")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -296,7 +296,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName); var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName);
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/?ref={GitHubConstants.DefaultBranchName}")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/?ref={GitHubConstants.DefaultBranchName}"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -311,7 +311,7 @@ namespace Octokit.Tests.Clients
var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName); var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName);
connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/?ref={GitHubConstants.DefaultBranchName}")); connection.Received().GetAll<RepositoryContent>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/?ref={GitHubConstants.DefaultBranchName}"));
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]

View File

@@ -35,7 +35,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetContributors("owner", "name"); var result = await client.GetContributors("owner", "name");
Assert.Equal(1, result.Count); Assert.Single(result);
} }
[Fact] [Fact]
@@ -52,7 +52,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetContributors(1); var result = await client.GetContributors(1);
Assert.Equal(1, result.Count); Assert.Single(result);
} }
[Fact] [Fact]
@@ -71,7 +71,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetContributors("owner", "name", cancellationToken); var result = await client.GetContributors("owner", "name", cancellationToken);
Assert.Equal(1, result.Count); Assert.Single(result);
} }
[Fact] [Fact]
@@ -90,7 +90,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetContributors(1, cancellationToken); var result = await client.GetContributors(1, cancellationToken);
Assert.Equal(1, result.Count); Assert.Single(result);
} }
[Fact] [Fact]
@@ -424,7 +424,7 @@ namespace Octokit.Tests.Clients
var result = await statisticsClient.GetPunchCard("owner", "name"); var result = await statisticsClient.GetPunchCard("owner", "name");
Assert.Equal(1, result.PunchPoints.Count); Assert.Single(result.PunchPoints);
Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek); Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek);
Assert.Equal(8, result.PunchPoints[0].HourOfTheDay); Assert.Equal(8, result.PunchPoints[0].HourOfTheDay);
Assert.Equal(42, result.PunchPoints[0].CommitCount); Assert.Equal(42, result.PunchPoints[0].CommitCount);
@@ -443,7 +443,7 @@ namespace Octokit.Tests.Clients
var result = await statisticsClient.GetPunchCard(1); var result = await statisticsClient.GetPunchCard(1);
Assert.Equal(1, result.PunchPoints.Count); Assert.Single(result.PunchPoints);
Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek); Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek);
Assert.Equal(8, result.PunchPoints[0].HourOfTheDay); Assert.Equal(8, result.PunchPoints[0].HourOfTheDay);
Assert.Equal(42, result.PunchPoints[0].CommitCount); Assert.Equal(42, result.PunchPoints[0].CommitCount);
@@ -464,7 +464,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetPunchCard("owner", "name", cancellationToken); var result = await client.GetPunchCard("owner", "name", cancellationToken);
Assert.Equal(1, result.PunchPoints.Count); Assert.Single(result.PunchPoints);
Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek); Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek);
Assert.Equal(8, result.PunchPoints[0].HourOfTheDay); Assert.Equal(8, result.PunchPoints[0].HourOfTheDay);
Assert.Equal(42, result.PunchPoints[0].CommitCount); Assert.Equal(42, result.PunchPoints[0].CommitCount);
@@ -485,7 +485,7 @@ namespace Octokit.Tests.Clients
var result = await client.GetPunchCard(1, cancellationToken); var result = await client.GetPunchCard(1, cancellationToken);
Assert.Equal(1, result.PunchPoints.Count); Assert.Single(result.PunchPoints);
Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek); Assert.Equal(DayOfWeek.Tuesday, result.PunchPoints[0].DayOfWeek);
Assert.Equal(8, result.PunchPoints[0].HourOfTheDay); Assert.Equal(8, result.PunchPoints[0].HourOfTheDay);
Assert.Equal(42, result.PunchPoints[0].CommitCount); Assert.Equal(42, result.PunchPoints[0].CommitCount);

View File

@@ -28,7 +28,7 @@ namespace Octokit.Tests.Exceptions
var apiError = serializer.Deserialize<ApiError>(json); var apiError = serializer.Deserialize<ApiError>(json);
Assert.Equal("Validation Failed", apiError.Message); Assert.Equal("Validation Failed", apiError.Message);
Assert.Equal(1, apiError.Errors.Count); Assert.Single(apiError.Errors);
Assert.Equal("Issue", apiError.Errors[0].Resource); Assert.Equal("Issue", apiError.Errors[0].Resource);
Assert.Equal("title", apiError.Errors[0].Field); Assert.Equal("title", apiError.Errors[0].Field);
Assert.Equal("missing_field", apiError.Errors[0].Code); Assert.Equal("missing_field", apiError.Errors[0].Code);

View File

@@ -98,7 +98,7 @@ namespace Octokit.Tests.Http
var data = await apiConnection.GetAll<object>(getAllUri); var data = await apiConnection.GetAll<object>(getAllUri);
Assert.Equal(0, data.Count); Assert.Empty(data);
connection.Received().Get<List<object>>(getAllUri, Args.EmptyDictionary, null, CancellationToken.None, null); connection.Received().Get<List<object>>(getAllUri, Args.EmptyDictionary, null, CancellationToken.None, null);
} }

View File

@@ -69,7 +69,7 @@ namespace Octokit.Tests
var apiInfo = ApiInfoParser.ParseResponseHeaders(headers); var apiInfo = ApiInfoParser.ParseResponseHeaders(headers);
Assert.NotNull(apiInfo); Assert.NotNull(apiInfo);
Assert.Equal(0, apiInfo.Links.Count); Assert.Empty(apiInfo.Links);
} }
[Fact] [Fact]

View File

@@ -127,8 +127,8 @@ namespace Octokit.Tests.Http
Assert.NotNull(clone); Assert.NotNull(clone);
Assert.Equal(4, clone.Links.Count); Assert.Equal(4, clone.Links.Count);
Assert.Equal(1, clone.OauthScopes.Count); Assert.Single(clone.OauthScopes);
Assert.Equal(0, clone.AcceptedOauthScopes.Count); Assert.Empty(clone.AcceptedOauthScopes);
Assert.Null(clone.Etag); Assert.Null(clone.Etag);
Assert.Equal(100, clone.RateLimit.Limit); Assert.Equal(100, clone.RateLimit.Limit);
Assert.Equal(75, clone.RateLimit.Remaining); Assert.Equal(75, clone.RateLimit.Remaining);
@@ -171,8 +171,8 @@ namespace Octokit.Tests.Http
Assert.NotNull(clone); Assert.NotNull(clone);
Assert.Equal(4, clone.Links.Count); Assert.Equal(4, clone.Links.Count);
Assert.Equal(1, clone.OauthScopes.Count); Assert.Single(clone.OauthScopes);
Assert.Equal(0, clone.AcceptedOauthScopes.Count); Assert.Empty(clone.AcceptedOauthScopes);
Assert.Equal("123abc", clone.Etag); Assert.Equal("123abc", clone.Etag);
Assert.Null(clone.RateLimit); Assert.Null(clone.RateLimit);
} }

View File

@@ -964,7 +964,7 @@ namespace Octokit.Tests.Http
// No point checking all of the values as they are tested elsewhere // No point checking all of the values as they are tested elsewhere
// Just provde that the ApiInfo is populated // Just provde that the ApiInfo is populated
Assert.Equal(4, result.Links.Count); Assert.Equal(4, result.Links.Count);
Assert.Equal(1, result.OauthScopes.Count); Assert.Single(result.OauthScopes);
Assert.Equal(4, result.AcceptedOauthScopes.Count); Assert.Equal(4, result.AcceptedOauthScopes.Count);
Assert.Equal("5634b0b187fd2e91e3126a75006cc4fa", result.Etag); Assert.Equal("5634b0b187fd2e91e3126a75006cc4fa", result.Etag);
Assert.Equal(100, result.RateLimit.Limit); Assert.Equal(100, result.RateLimit.Limit);

View File

@@ -44,7 +44,7 @@ namespace Octokit.Tests.Models
Assert.Equal(1, actual.Id); Assert.Equal(1, actual.Id);
Assert.Equal("https://api.github.com/repos/octocat/example/deployments/1/statuses/42", actual.Url); Assert.Equal("https://api.github.com/repos/octocat/example/deployments/1/statuses/42", actual.Url);
Assert.Equal(DeploymentState.Success, actual.State); Assert.Equal(DeploymentState.Success, actual.State);
Assert.Equal(1, actual.Payload.Count); Assert.Single(actual.Payload);
Assert.Equal("production", actual.Payload["environment"]); Assert.Equal("production", actual.Payload["environment"]);
Assert.Equal("https://gist.github.com/628b2736d379f", actual.TargetUrl); Assert.Equal("https://gist.github.com/628b2736d379f", actual.TargetUrl);
Assert.Equal(DateTimeOffset.Parse("2012-07-20T01:19:13Z"), actual.CreatedAt); Assert.Equal(DateTimeOffset.Parse("2012-07-20T01:19:13Z"), actual.CreatedAt);

View File

@@ -69,10 +69,9 @@ namespace Octokit.Tests.Models
Assert.NotNull(installations); Assert.NotNull(installations);
Assert.NotEmpty(installations); Assert.NotEmpty(installations);
Assert.Equal(1, installations.Count); Assert.Single(installations);
Assert.Null(installations.First().SuspendedAt); Assert.Null(installations.First().SuspendedAt);
Assert.Null(installations.First().SuspendedBy); Assert.Null(installations.First().SuspendedBy);
} }
[Fact] [Fact]
@@ -156,7 +155,7 @@ namespace Octokit.Tests.Models
Assert.NotNull(installations); Assert.NotNull(installations);
Assert.NotEmpty(installations); Assert.NotEmpty(installations);
Assert.Equal(1, installations.Count); Assert.Single(installations);
Assert.NotNull(installations.First().SuspendedAt); Assert.NotNull(installations.First().SuspendedAt);
Assert.NotNull(installations.First().SuspendedBy); Assert.NotNull(installations.First().SuspendedBy);

View File

@@ -119,7 +119,7 @@ namespace Octokit.Tests.Models
Assert.Equal(79, _migration.Id); Assert.Equal(79, _migration.Id);
Assert.Equal("0b989ba4-242f-11e5-81e1-c7b6966d2516", _migration.Guid); Assert.Equal("0b989ba4-242f-11e5-81e1-c7b6966d2516", _migration.Guid);
Assert.Equal(1, _migration.Repositories.Count); Assert.Single(_migration.Repositories);
Assert.Equal(1296269, _migration.Repositories[0].Id); Assert.Equal(1296269, _migration.Repositories[0].Id);
Assert.Equal(Migration.MigrationState.Pending, _migration.State); Assert.Equal(Migration.MigrationState.Pending, _migration.State);
} }
@@ -151,7 +151,7 @@ namespace Octokit.Tests.Models
var _migrationReuqest = serializer.Deserialize<StartMigrationRequest>(migrationRequestJson); var _migrationReuqest = serializer.Deserialize<StartMigrationRequest>(migrationRequestJson);
Assert.Equal("octocat/Hello-World", _migrationReuqest.Repositories[0]); Assert.Equal("octocat/Hello-World", _migrationReuqest.Repositories[0]);
Assert.Equal(1, _migrationReuqest.Repositories.Count); Assert.Single(_migrationReuqest.Repositories);
Assert.True(_migrationReuqest.LockRepositories); Assert.True(_migrationReuqest.LockRepositories);
} }
} }

View File

@@ -4,7 +4,8 @@ using Octokit;
using Octokit.Internal; using Octokit.Internal;
using Xunit; using Xunit;
public class PullRequestCommitTests { public class PullRequestCommitTests
{
// the following JSON is taken from the documentation available at https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request // the following JSON is taken from the documentation available at https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request
const string jsonPayload = @" const string jsonPayload = @"
@@ -91,7 +92,8 @@ public class PullRequestCommitTests {
"; ";
[Fact] [Fact]
public void AuthorAndCommitterDeserializedCorrectly() { public void AuthorAndCommitterDeserializedCorrectly()
{
var serializer = new SimpleJsonSerializer(); var serializer = new SimpleJsonSerializer();
var commits = serializer.Deserialize<List<PullRequestCommit>>(jsonPayload); var commits = serializer.Deserialize<List<PullRequestCommit>>(jsonPayload);

View File

@@ -29,7 +29,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.DoesNotContain("foo", result.Keys); Assert.DoesNotContain("foo", result.Keys);
Assert.Equal("123", result["bar"]); Assert.Equal("123", result["bar"]);
} }
@@ -41,7 +41,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("yuck", result["nom"]); Assert.Equal("yuck", result["nom"]);
} }
@@ -52,7 +52,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("bland", result["nom"]); Assert.Equal("bland", result["nom"]);
} }
@@ -63,7 +63,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("noms", result["nom"]); Assert.Equal("noms", result["nom"]);
} }
@@ -78,7 +78,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("2013-01-23T16:30:00Z", result["when"]); Assert.Equal("2013-01-23T16:30:00Z", result["when"]);
} }
@@ -89,7 +89,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(0, result.Count); Assert.Empty(result);
} }
[Fact] [Fact]
@@ -99,7 +99,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("one,two", result["strings"]); Assert.Equal("one,two", result["strings"]);
} }
@@ -110,7 +110,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(0, result.Count); Assert.Empty(result);
} }
[Fact] [Fact]
@@ -120,7 +120,7 @@ namespace Octokit.Tests.Models
var result = model.ToParametersDictionary(); var result = model.ToParametersDictionary();
Assert.Equal(1, result.Count); Assert.Single(result);
Assert.Equal("verbose", result["prop"]); Assert.Equal("verbose", result["prop"]);
} }

View File

@@ -34,7 +34,7 @@ public class SearchIssuesRequestExclusionsTests
property.Value(request, "blah"); property.Value(request, "blah");
// Ensure the specified parameter now exists // Ensure the specified parameter now exists
Assert.True(request.MergedQualifiers().Count(x => x.Contains(property.Key)) == 1); Assert.Equal(1, request.MergedQualifiers().Count(x => x.Contains(property.Key)));
} }
} }

View File

@@ -58,7 +58,7 @@ public class SearchIssuesRequestTests
property.Value(request, "blah"); property.Value(request, "blah");
// Ensure the specified parameter now exists // Ensure the specified parameter now exists
Assert.True(request.MergedQualifiers().Count(x => x.Contains(property.Key)) == 1); Assert.Equal(1, request.MergedQualifiers().Count(x => x.Contains(property.Key)));
} }
} }
@@ -84,7 +84,7 @@ public class SearchIssuesRequestTests
property.Value(request, DateRange.GreaterThan(new DateTimeOffset(DateTime.Today.AddDays(-7)))); property.Value(request, DateRange.GreaterThan(new DateTimeOffset(DateTime.Today.AddDays(-7))));
// Ensure the specified parameter now exists // Ensure the specified parameter now exists
Assert.True(request.MergedQualifiers().Count(x => x.Contains(property.Key)) == 1); Assert.Equal(1, request.MergedQualifiers().Count(x => x.Contains(property.Key)));
} }
} }

View File

@@ -128,7 +128,7 @@ namespace Octokit.Tests.Models
Assert.Equal(1, payload.TotalCount); Assert.Equal(1, payload.TotalCount);
Assert.NotNull(payload.Jobs); Assert.NotNull(payload.Jobs);
Assert.NotEmpty(payload.Jobs); Assert.NotEmpty(payload.Jobs);
Assert.Equal(1, payload.Jobs.Count); Assert.Single(payload.Jobs);
} }
} }
} }

View File

@@ -73,7 +73,7 @@ namespace Octokit.Tests.Models
Assert.Equal(180000, payload.Billable.Ubuntu.TotalMs); Assert.Equal(180000, payload.Billable.Ubuntu.TotalMs);
Assert.Equal(1, payload.Billable.Ubuntu.Jobs); Assert.Equal(1, payload.Billable.Ubuntu.Jobs);
Assert.NotNull(payload.Billable.Ubuntu.JobRuns); Assert.NotNull(payload.Billable.Ubuntu.JobRuns);
Assert.Equal(1, payload.Billable.Ubuntu.JobRuns.Count); Assert.Single(payload.Billable.Ubuntu.JobRuns);
Assert.Equal(240000, payload.Billable.MacOS.TotalMs); Assert.Equal(240000, payload.Billable.MacOS.TotalMs);
Assert.Equal(4, payload.Billable.MacOS.Jobs); Assert.Equal(4, payload.Billable.MacOS.Jobs);
Assert.NotNull(payload.Billable.MacOS.JobRuns); Assert.NotNull(payload.Billable.MacOS.JobRuns);

View File

@@ -46,7 +46,7 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<TimelineEventInfo>>( connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>()); Arg.Any<Dictionary<string, string>>());
Assert.Equal(1, timelineEvents.Count); Assert.Single(timelineEvents);
} }
[Fact] [Fact]
@@ -67,7 +67,7 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<TimelineEventInfo>>( connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/timeline"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30")); Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30"));
Assert.Equal(1, timelineEvents.Count); Assert.Single(timelineEvents);
} }
[Fact] [Fact]
@@ -87,7 +87,7 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<TimelineEventInfo>>( connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"), Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Any<Dictionary<string, string>>()); Arg.Any<Dictionary<string, string>>());
Assert.Equal(1, timelineEvents.Count); Assert.Single(timelineEvents);
} }
[Fact] [Fact]
@@ -107,7 +107,7 @@ namespace Octokit.Tests.Reactive
connection.Received().Get<List<TimelineEventInfo>>( connection.Received().Get<List<TimelineEventInfo>>(
Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"), Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/timeline"),
Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30")); Arg.Is<Dictionary<string, string>>(d => d.Count == 1 && d["per_page"] == "30"));
Assert.Equal(1, timelineEvents.Count); Assert.Single(timelineEvents);
} }
[Fact] [Fact]

View File

@@ -42,7 +42,7 @@ namespace Octokit.Tests.Reactive
var eventInfos = await client.GetAllForIssue("fake", "repo", 42).ToList(); var eventInfos = await client.GetAllForIssue("fake", "repo", 42).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Args.EmptyDictionary); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Args.EmptyDictionary);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[Fact] [Fact]
@@ -61,7 +61,7 @@ namespace Octokit.Tests.Reactive
var eventInfos = await client.GetAllForIssue(1, 42).ToList(); var eventInfos = await client.GetAllForIssue(1, 42).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/events"), Args.EmptyDictionary); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/events"), Args.EmptyDictionary);
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[Fact] [Fact]
@@ -87,7 +87,7 @@ namespace Octokit.Tests.Reactive
var eventInfos = await client.GetAllForIssue("fake", "repo", 42, options).ToList(); var eventInfos = await client.GetAllForIssue("fake", "repo", 42, options).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2)); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2));
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[Fact] [Fact]
@@ -114,7 +114,7 @@ namespace Octokit.Tests.Reactive
var eventInfos = await client.GetAllForIssue(1, 42, options).ToList(); var eventInfos = await client.GetAllForIssue(1, 42, options).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2)); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2));
Assert.Equal(1, eventInfos.Count); Assert.Single(eventInfos);
} }
[Fact] [Fact]
@@ -155,7 +155,7 @@ namespace Octokit.Tests.Reactive
var issueEvents = await client.GetAllForRepository("fake", "repo").ToList(); var issueEvents = await client.GetAllForRepository("fake", "repo").ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Args.EmptyDictionary); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Args.EmptyDictionary);
Assert.Equal(1, issueEvents.Count); Assert.Single(issueEvents);
} }
[Fact] [Fact]
@@ -174,7 +174,7 @@ namespace Octokit.Tests.Reactive
var issueEvents = await client.GetAllForRepository(1).ToList(); var issueEvents = await client.GetAllForRepository(1).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Args.EmptyDictionary); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Args.EmptyDictionary);
Assert.Equal(1, issueEvents.Count); Assert.Single(issueEvents);
} }
[Fact] [Fact]
@@ -200,7 +200,7 @@ namespace Octokit.Tests.Reactive
var issueEvents = await client.GetAllForRepository("fake", "repo", options).ToList(); var issueEvents = await client.GetAllForRepository("fake", "repo", options).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2)); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2));
Assert.Equal(1, issueEvents.Count); Assert.Single(issueEvents);
} }
[Fact] [Fact]
@@ -226,7 +226,7 @@ namespace Octokit.Tests.Reactive
var issueEvents = await client.GetAllForRepository(1, options).ToList(); var issueEvents = await client.GetAllForRepository(1, options).ToList();
connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2)); connection.Received().Get<List<IssueEvent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/issues/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2));
Assert.Equal(1, issueEvents.Count); Assert.Single(issueEvents);
} }
[Fact] [Fact]

View File

@@ -647,7 +647,7 @@ namespace Octokit.Tests.Reactive
var commits = await client.Commits("fake", "repo", 42).ToList(); var commits = await client.Commits("fake", "repo", 42).ToList();
Assert.Equal(1, commits.Count); Assert.Single(commits);
Assert.Same(commit, commits[0]); Assert.Same(commit, commits[0]);
connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null); connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null);
} }
@@ -671,7 +671,7 @@ namespace Octokit.Tests.Reactive
var commits = await client.Commits(1, 42).ToList(); var commits = await client.Commits(1, 42).ToList();
Assert.Equal(1, commits.Count); Assert.Single(commits);
Assert.Same(commit, commits[0]); Assert.Same(commit, commits[0]);
connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null); connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null);
} }
@@ -711,7 +711,7 @@ namespace Octokit.Tests.Reactive
var files = await client.Files("fake", "repo", 42).ToList(); var files = await client.Files("fake", "repo", 42).ToList();
Assert.Equal(1, files.Count); Assert.Single(files);
Assert.Same(file, files[0]); Assert.Same(file, files[0]);
connection.Received().Get<List<PullRequestFile>>(new Uri(expectedUrl, UriKind.Relative), Arg.Any<IDictionary<string, string>>()); connection.Received().Get<List<PullRequestFile>>(new Uri(expectedUrl, UriKind.Relative), Arg.Any<IDictionary<string, string>>());
} }
@@ -735,7 +735,7 @@ namespace Octokit.Tests.Reactive
var files = await client.Files(1, 42).ToList(); var files = await client.Files(1, 42).ToList();
Assert.Equal(1, files.Count); Assert.Single(files);
Assert.Same(file, files[0]); Assert.Same(file, files[0]);
connection.Received().Get<List<PullRequestFile>>(new Uri(expectedUrl, UriKind.Relative), Arg.Any<IDictionary<string, string>>()); connection.Received().Get<List<PullRequestFile>>(new Uri(expectedUrl, UriKind.Relative), Arg.Any<IDictionary<string, string>>());
} }

View File

@@ -179,7 +179,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContents("fake", "repo").ToList(); var contents = await contentsClient.GetAllContents("fake", "repo").ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -198,7 +198,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContents(1).ToList(); var contents = await contentsClient.GetAllContents(1).ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -217,7 +217,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContents("fake", "repo").ToList(); var contents = await contentsClient.GetAllContents("fake", "repo").ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/contents/"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -235,7 +235,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContents(1).ToList(); var contents = await contentsClient.GetAllContents(1).ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contents/"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -315,7 +315,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName, "readme.md").ToList(); var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName, "readme.md").ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -333,7 +333,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName, "readme.md").ToList(); var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName, "readme.md").ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/readme.md?ref={GitHubConstants.DefaultBranchName}"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -351,7 +351,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName).ToList(); var contents = await contentsClient.GetAllContentsByRef("fake", "repo", GitHubConstants.DefaultBranchName).ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/?ref={GitHubConstants.DefaultBranchName}"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repos/fake/repo/contents/?ref={GitHubConstants.DefaultBranchName}"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]
@@ -369,7 +369,7 @@ namespace Octokit.Tests.Reactive
var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName).ToList(); var contents = await contentsClient.GetAllContentsByRef(1, GitHubConstants.DefaultBranchName).ToList();
connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/?ref={GitHubConstants.DefaultBranchName}"), null); connection.Received().Get<List<RepositoryContent>>(Arg.Is<Uri>(u => u.ToString() == $"repositories/1/contents/?ref={GitHubConstants.DefaultBranchName}"), null);
Assert.Equal(1, contents.Count); Assert.Single(contents);
} }
[Fact] [Fact]