diff --git a/Octokit.Tests.Conventions/ModelTests.cs b/Octokit.Tests.Conventions/ModelTests.cs index f126e8cd..0cfcb3c8 100644 --- a/Octokit.Tests.Conventions/ModelTests.cs +++ b/Octokit.Tests.Conventions/ModelTests.cs @@ -95,27 +95,6 @@ namespace Octokit.Tests.Conventions } } - //TODO: This should (probably) be moved to the PaginationTests class that is being introduced in PR #760 - [Theory] - [MemberData("GetClientInterfaces")] - public void CheckPaginationGetAllMethodNames(Type clientInterface) - { - var methodsOrdered = clientInterface.GetMethodsOrdered(); - - var methodsThatCanPaginate = methodsOrdered - .Where(x => x.ReturnType.GetTypeInfo().TypeCategory == TypeCategory.ReadOnlyList) - .Where(x => x.Name.StartsWith("Get")); - - var invalidMethods = methodsThatCanPaginate - .Where(x => !x.Name.StartsWith("GetAll")) - .ToList(); - - if (invalidMethods.Any()) - { - throw new PaginationGetAllMethodNameMismatchException(clientInterface, invalidMethods); - } - } - public static IEnumerable GetClientInterfaces() { return typeof(IEventsClient) diff --git a/Octokit.Tests.Conventions/PaginationTests.cs b/Octokit.Tests.Conventions/PaginationTests.cs index 135d7bc2..fcd76b63 100644 --- a/Octokit.Tests.Conventions/PaginationTests.cs +++ b/Octokit.Tests.Conventions/PaginationTests.cs @@ -27,6 +27,26 @@ namespace Octokit.Tests.Conventions } } + [Theory] + [MemberData("GetClientInterfaces")] + public void CheckPaginationGetAllMethodNames(Type clientInterface) + { + var methodsOrdered = clientInterface.GetMethodsOrdered(); + + var methodsThatCanPaginate = methodsOrdered + .Where(x => x.ReturnType.GetTypeInfo().TypeCategory == TypeCategory.ReadOnlyList) + .Where(x => x.Name.StartsWith("Get")); + + var invalidMethods = methodsThatCanPaginate + .Where(x => !x.Name.StartsWith("GetAll")) + .ToList(); + + if (invalidMethods.Any()) + { + throw new PaginationGetAllMethodNameMismatchException(clientInterface, invalidMethods); + } + } + static MethodInfo MethodHasAppropriateOverload(MethodInfo method, MethodInfo[] methodsOrdered) { var parameters = method.GetParametersOrdered(); @@ -69,7 +89,10 @@ namespace Octokit.Tests.Conventions public static IEnumerable GetClientInterfaces() { - return typeof(IEventsClient).Assembly.ExportedTypes.Where(TypeExtensions.IsClientInterface).Select(type => new[] { type }); + return typeof(IEventsClient).Assembly.ExportedTypes + .Where(TypeExtensions.IsClientInterface) + .Where(type => type != typeof(IStatisticsClient)) + .Select(type => new[] { type }); } } }