moved test to new home

This commit is contained in:
Brendan Forster
2016-02-14 15:00:08 +11:00
parent f9f72106be
commit 740b70f3c7
2 changed files with 24 additions and 22 deletions
-21
View File
@@ -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<object[]> GetClientInterfaces()
{
return typeof(IEventsClient)
+24 -1
View File
@@ -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<object[]> 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 });
}
}
}