mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-25 07:34:57 +00:00
1e474f8556
* Unskip pagination convention tests and rework exclusion property names Also exclude Obsolete methods from pagination convention tests * Reaction APIs appear to support pagination, flag to exclude for now and mark a TODO that they need implementing * Repository invitation APIs need pagination implemented * Exclude methods that use an alternative pagination approach * Migrations, Licenses and References all need pagination implemented * Pagination not supported for these methods (determined by API doc and poking the API) so exclude them from convention tests * These methods need renaming to GetAll * Rename offending RepositoryTrafficClient GetReferrers and GetPaths to GetAllReferrers and GetAllPaths * Rename offending RepositoryBranchesClient methods from Get to GetAll
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace Octokit.Tests.Conventions
|
|
{
|
|
public class ApiOptionsMissingException : Exception
|
|
{
|
|
public ApiOptionsMissingException(Type type, IEnumerable<MethodInfo> methods)
|
|
: base(CreateMessage(type, methods))
|
|
{ }
|
|
|
|
static string CreateMessage(Type type, IEnumerable<MethodInfo> methods)
|
|
{
|
|
var methodsFormatted = String.Join("\r\n", methods.Select(FormatMethod));
|
|
return "Methods found on type {0} require an overload which accepts a parameter of type ApiOptions:\r\n{1}"
|
|
.FormatWithNewLine(
|
|
type.Name,
|
|
methodsFormatted);
|
|
}
|
|
|
|
static string FormatMethod(MethodInfo m)
|
|
{
|
|
var formattedParameters = m.GetParameters()
|
|
.Select(p => string.Format("{0} {1}", p.ParameterType.Name, p.Name));
|
|
|
|
var parameterList = string.Join(", ", formattedParameters);
|
|
|
|
return string.Format(" - {0}({1})", m.Name, parameterList);
|
|
}
|
|
}
|
|
}
|