Clarify why convention tests are failing

This commit is contained in:
Kristian Hellang
2015-09-22 10:32:24 +02:00
parent e1361b150c
commit 7162ce6e72
9 changed files with 139 additions and 26 deletions
@@ -99,6 +99,20 @@ namespace Octokit.Tests.Conventions
{
return type.GetGenericArguments()[0];
}
public static bool IsReadOnlyCollection(this Type type)
{
var isReadOnlyList = type.HasGenericTypeDefinition(typeof(IReadOnlyList<>));
var isReadOnlyDictionary = type.HasGenericTypeDefinition(typeof(IReadOnlyDictionary<,>));
return isReadOnlyList || isReadOnlyDictionary;
}
private static bool HasGenericTypeDefinition(this Type type, Type genericTypeDefinition)
{
return type.IsGenericType && type.GetGenericTypeDefinition() == genericTypeDefinition;
}
}
public enum TypeCategory { Other, Task, GenericTask, ReadOnlyList, ClientInterface }