Add a convention test

This commit is contained in:
Henrik Andersson
2015-03-22 19:09:08 +10:00
parent ede59d18de
commit b0ab485ed1
3 changed files with 50 additions and 0 deletions
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Octokit.Tests.Conventions
{
public class PaginationGetAllMethodNameMismatchException : Exception
{
public PaginationGetAllMethodNameMismatchException(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(m => String.Format(" - {0}", m)));
return "Methods found on type {0} should follow the 'GetAll*' naming convention:\r\n{1}"
.FormatWithNewLine(
type.Name,
methodsFormatted);
}
}
}